diff --git a/gui/notepad/src/notepad.tal b/gui/notepad/src/notepad.tal index 1244a7b..f07ea7f 100644 --- a/gui/notepad/src/notepad.tal +++ b/gui/notepad/src/notepad.tal @@ -18,9 +18,9 @@ ( | meta ) ;meta #06 DEO2 ( | theme ) - #f08f .System/r DEO2 - #f08f .System/g DEO2 - #f08f .System/b DEO2 + #f00f .System/r DEO2 + #f00f .System/g DEO2 + #f00f .System/b DEO2 load-theme ( | size ) #00e0 .Screen/width DEO2 @@ -74,12 +74,10 @@ POP ( | key ) DUP #1b NEQ ?{ toggle-sketch POP BRK } - DUP #08 NEQ ?{ - .selection/sketch LDZ ?{ erase-sketch POP BRK } - erase } - DUP #7f NEQ ?{ - .selection/sketch LDZ ?{ erase-sketch POP BRK } - delete } + DUP #08 NEQ ?{ .selection/sketch LDZ ?{ erase } + erase-sketch POP BRK } + DUP #7f NEQ ?{ .selection/sketch LDZ ?{ delete } + erase-sketch POP BRK } DUP #09 LTH ?{ DUP insert } POP BRK @@ -119,20 +117,25 @@ @on-mouse-sketch ( -> ) [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn ( | handle states ) - [ LIT &last $1 ] .Mouse/state DEI - ( ) DUP #02 LTH ?{ - ( erase ) } - DUP2 #0001 NEQ2 ?{ - .Mouse/x DEI2 ,&x1 STR2 - .Mouse/y DEI2 #0012 SUB2 ,&y1 STR2 } + [ LIT &last $1 ] .Mouse/state DEI DUP ,&last STR + ( ) DUP2 #0100 NEQ2 ?{ file-save } + ( ) DUP2 #0200 NEQ2 ?{ file-save } + DUP2 #0200 NEQ2 ?{ + ( from ) ,&x1 LDR2 ,&y1 LDR2 + ( to ) .Mouse/x DEI2 .Mouse/y DEI2 #0012 SUB2 + ( paint ) #01 + } + DUP2 #00 NEQ #0001 NEQ2 ?{ + .Mouse/x DEI2 DUP2 ,&x1 STR2 + .Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2 + #01 set-pixel } DUP2 #0101 NEQ2 ?{ ( from* ) [ LIT2 &x1 $2 ] [ LIT2 &y1 $2 ] ( to ) .Mouse/x DEI2 DUP2 ,&x1 STR2 .Mouse/y DEI2 #0012 SUB2 DUP2 ,&y1 STR2 ( paint ) #01 } - ,&last STR - POP BRK + POP2 BRK @on-mouse-foot ( -> ) [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn @@ -195,7 +198,9 @@ JMP2r @erase-sketch ( -- ) - + ;&mcpy .System/expansion DEO2 + ! + &mcpy [ 00 1500 0000 =sketch 00 ] @get-row ( x* y* -- row* ) STH2k #03 SFT2 SWP2 #03 SFT2 SWP2 #001c MUL2 ADD2 #30 SFT2 STH2r #0007 AND2 ADD2 ;sketch ADD2 JMP2r @@ -327,7 +332,7 @@ ;notepad-path file-size #0000 EQU2 ?file-new ( | load file ) ;notepad-path .File/name DEO2 - #8000 .File/length DEO2 + #9500 .File/length DEO2 ;mem .File/read DEO2 JMP2r @@ -343,7 +348,7 @@ @file-save ( -- ) ;notepad-path .File/name DEO2 - #8000 .File/length DEO2 + #9500 .File/length DEO2 ;mem .File/write DEO2 JMP2r