~rabbits/turye

b23c80f71a0d34fefd028481ccc6aa81c08caf54 — Devine Lu Linvega 5 months ago 3dacec0
Added shortcuts to move width and guide
1 files changed, 50 insertions(+), 11 deletions(-)

M src/turye.tal
M src/turye.tal => src/turye.tal +50 -11
@@ 1,5 1,10 @@
( app/turye : font editor )

( TODOs:
	> move edit status in filepath
	> add block in scrollbar corner
	> add tool so 2 button mouse can use )

|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|10 @Console &vector $2 &read $1 &pad $5 &write $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1


@@ 74,15 79,20 @@ BRK
		01 "s =file-save "Save $1
		01 "e =file-export "Export $1
		01 "q =exit "Exit $1
	08 "Edit $1
	06 "Edit $1
		01 "c =edit-copy "Copy $1
		01 "v =edit-paste "Paste $1
		01 "x =edit-cut "Cut $1
		00 08 =edit-erase "Erase $1
		12 00 =edit-incr-guide "UpGuide $1
		22 00 =edit-decr-guide "DownGuide $1
	06 "Glyph $1
		11 00 =edit-drag-up "DragUp $1
		21 00 =edit-drag-down "DragDown $1
		41 00 =edit-shift-left "ShiftLeft $1
		81 00 =edit-shift-right "ShiftRight $1
		42 00 =edit-decr-width "DecrWidth $1
		82 00 =edit-incr-width "IncrWidth $1
	04 "Move $1
		10 00 =move-up "Up $1
		20 00 =move-down "Down $1


@@ 371,15 381,15 @@ JMP2r
	.preview/x LDZ2 #0008 SUB2 .Screen/x DEO2
	.preview/y LDZ2 #0008 SUB2 .Screen/y DEO2
	;frame-chr #110a draw-frame

	.preview/x LDZ2 #0002 SUB2 .Screen/x DEO2
	.preview/y LDZ2 #0011 SUB2 .Screen/y DEO2
	#f8 draw-tab
	#0a ;draw-chr/color STA
	;dict/preview draw-str POP2
	;dict/preview #f8 draw-tab

	( fill )
	.preview/x LDZ2 #0000 ADD2 .Screen/x DEO2
	.preview/y LDZ2 #0000 ADD2 .Screen/y DEO2
	.preview/x LDZ2 .Screen/x DEO2
	.preview/y LDZ2 .Screen/y DEO2
	#a1 .Screen/auto DEO
	;fill-icn .Screen/addr DEO2
	#ef &l #03 .Screen/sprite DEO INC DUP ?&l POP


@@ 415,7 425,7 @@ JMP2r

JMP2r

@draw-tab ( !len -- )
@draw-tab ( str* !len -- )

	.Screen/x DEI2 ROT
	#15 .Screen/auto DEO


@@ 427,6 437,7 @@ JMP2r
		INC DUP ?&l POP
	#81 .Screen/sprite DEOk DEO
	#0008 ADD2 .Screen/x DEO2
	draw-str POP2

JMP2r



@@ 450,9 461,8 @@ JMP2r

	.collection-view/x LDZ2 #0002 SUB2 .Screen/x DEO2
	.collection-view/y LDZ2 #0011 SUB2 .Screen/y DEO2
	#00 ;src get-strw NIP #03 SFT #02 ADD SUB draw-tab
	;draw-chr/color STA
	;src draw-str POP2
	;src #00 ;src get-strw NIP #03 SFT #02 ADD SUB draw-tab

JMP2r



@@ 483,6 493,10 @@ JMP2r

JMP2r

@buf &hn $1 &ln $2

@hexc ( hex -- char ) #0f AND DUP #09 GTH #07 MUL ADD #30 ADD JMP2r

@draw-editor-frame ( -- )

	.editor-view/x LDZ2 #0008 SUB2 .Screen/x DEO2


@@ 490,10 504,11 @@ JMP2r
	;frame-chr #1110 draw-frame
	.editor-view/x LDZ2 #0002 SUB2 .Screen/x DEO2
	.editor-view/y LDZ2 #0011 SUB2 .Screen/y DEO2
	#fd draw-tab
	.glyph LDZ
		DUP #04 SFT hexc ;buf/hn STA
		hexc ;buf/ln STA
	#0a ;draw-chr/color STA
	.glyph LDZ draw-byte
	#20 draw-chr
	;buf #fd draw-tab

@draw-editor ( -- )



@@ 929,6 944,30 @@ JMP2r

!redraw

@edit-decr-width ( -- )

	.glyph LDZ DUP get-width #01 SUB set-width

JMP2r

@edit-incr-width ( -- )

	.glyph LDZ DUP get-width INC set-width

JMP2r

@edit-incr-guide ( -- )

	.guide LDZ #01 SUB .guide STZ

!redraw

@edit-decr-guide ( -- )

	.guide LDZ INC .guide STZ

!redraw

(
@|stdlib )