From 712adb45e707825e568c9badb6f7edabb130c3db Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 28 May 2024 20:07:47 -0700 Subject: [PATCH] Added hover state on page corner --- gui/notepad/src/assets.tal | 23 +++++++++---------- gui/notepad/src/notepad.tal | 45 +++++++++++++++++++++++++------------ 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/gui/notepad/src/assets.tal b/gui/notepad/src/assets.tal index ed6fbcf..07a4869 100644 --- a/gui/notepad/src/assets.tal +++ b/gui/notepad/src/assets.tal @@ -48,30 +48,29 @@ 1f18 1818 1800 0000 0f19 1919 0f00 0000 9999 9999 8f00 0000 8080 8080 8000 0000 ] -@page-icn [ - 00ff 4020 1008 0402 00ff 0000 0000 0000 - 00ff 0101 0101 0101 0100 0000 0000 0000 - 0080 4020 1008 0402 0101 0101 0101 0101 - 0000 0000 0000 0000 0100 0000 0000 0000 - 0181 4121 1109 0503 0000 ff00 ff00 ffff - 0000 ff00 ff00 ffff 0100 ff00 ff00 ffff ] - &bottom [ ff00 ff00 ff00 ffff ] - -@page-icn-next [ +@corner-icn [ 0000 00ff 4020 1008 0000 00ff 0000 0000 0000 00fc 0404 0404 0402 0100 0000 0000 0000 0080 4020 1008 0404 0404 0404 0404 0000 0000 0000 0000 0402 0100 0000 0000 0404 0484 4424 140c 0000 ff00 ff00 ffff 0000 ff00 ff00 ffff 0700 ff00 ff00 ffff ] - -@page-icn-prev [ + ( b ) [ 0000 0000 00ff 4020 0000 0000 00ff 0000 0000 0000 00f0 1010 1008 0402 0100 0000 0000 0000 0080 4020 1010 1010 1010 1010 0000 0000 0000 0000 1008 0402 0100 0000 1010 1010 1090 5030 0000 ff00 ff00 ffff 0000 ff00 ff00 ffff 1f00 ff00 ff00 ffff ] + ( c ) [ + 00ff 4020 1008 0402 00ff 0000 0000 0000 + 00ff 0101 0101 0101 0100 0000 0000 0000 + 0080 4020 1008 0402 0101 0101 0101 0101 + 0000 0000 0000 0000 0100 0000 0000 0000 + 0181 4121 1109 0503 0000 ff00 ff00 ffff + 0000 ff00 ff00 ffff 0100 ff00 ff00 ffff ] + +@bottom-icn [ ff00 ff00 ff00 ffff ] @line-icn [ 00ff 0000 0000 0000 ] diff --git a/gui/notepad/src/notepad.tal b/gui/notepad/src/notepad.tal index e878301..1930b03 100644 --- a/gui/notepad/src/notepad.tal +++ b/gui/notepad/src/notepad.tal @@ -3,7 +3,7 @@ |00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |80 @Controller &vector $2 &button $1 &key $1 -|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1 +|90 @Mouse &vector $2 &x $1 &lx $1 &y $1 &ly $1 &state $1 &chord $1 |a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |000 @@ -105,11 +105,12 @@ @on-mouse-foot ( -> ) [ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn - [ LIT2 00 -Mouse/state ] DEI NEQ .Mouse/x DEI2 #0018 LTH2 AND ?&on-mouse-down + ( | continue ) + [ LIT2 00 -Mouse/state ] DEI NEQ .Mouse/x DEI2 #0018 LTH2 AND ?&down BRK - &on-mouse-down ( -> ) + &down ( -> ) [ LIT2 00 -Mouse/state ] DEO - .Mouse/y DEI2 #00d6 SUB2 NIP [ LIT2 18 -Mouse/x ] DEI2 NIP SUB ADD #18 LTH ?&go-next + .Mouse/y DEI2 #00da SUB2 NIP [ LIT2 18 -Mouse/x ] DEI2 NIP SUB ADD #18 LTH ?&go-next prev-page BRK &go-next next-page BRK @on-frame ( -> ) @@ -281,6 +282,7 @@ @|core ) @ ( -- ) + #00 .Mouse/y DEI2 DUP2 #0018 GTH2 ?{ POP2 ;on-mouse-head .Mouse/vector DEO2 JMP2r } @@ -446,7 +448,7 @@ ( | page end ) .Screen/y DEI2 #00c8 NEQ2 ?{ ;etc-icn .Screen/addr DEO2 - #01 .Screen/sprite DEO + [ LIT2 01 -Screen/sprite ] DEO POP2 JMP2r } ( | draw char ) DUP2 #0001 SUB2 LDA2 char-addr .Screen/addr DEO2 @@ -461,20 +463,16 @@ [ LIT2 05 -Screen/sprite ] DEO .Screen/x DEI2k #0008 SUB2 ROT DEO2 &block walk-char POP INC2 LDAk ?&>w - &end POP2 JMP2r + POP2 JMP2r @ ( -- ) [ LIT2 00 -collapsed ] LDZ EQU ?{ JMP2r } - [ LIT2 26 -Screen/auto ] DEO - #0000 .Screen/x DEO2 - .Screen/height DEI2 #0020 SUB2 DUP2 .Screen/y DEO2 - ;page-icn .Screen/addr DEO2 - [ LIT2 01 -Screen/sprite ] DEOk DEOk DEOk DEO + #01 ( | across ) [ LIT2 01 -Screen/auto ] DEO #0018 .Screen/x DEO2 - DUP2 #0018 ADD2 .Screen/y DEO2 - ;page-icn/bottom .Screen/addr DEO2 + .Screen/height DEI2 DUP2 #0008 SUB2 .Screen/y DEO2 + ;bottom-icn .Screen/addr DEO2 #e7 &>l ( -- ) [ LIT2 01 -Screen/sprite ] DEO @@ -483,11 +481,30 @@ ( | page number ) [ LIT2 15 -Screen/auto ] DEO .Screen/width DEI2 #01 SFT2 #0003 SUB2 .Screen/x DEO2 - .Screen/y DEO2 + #001e SUB2 .Screen/y DEO2 #0011 .page LDZ ADD #50 SFT2 ;font/glyphs ADD2 .Screen/addr DEO2 [ LIT2 01 -Screen/sprite ] DEO JMP2r +@ ( force -- ) + ( get positions ) .Mouse/lx DEI .Mouse/ly DEI + ( test x ) OVR #18 GTH ?&skip + ( test y ) DUP #db LTH ?&skip + #da SUB #18 ROT SUB ADD #18 LTH INC SWP ! + &skip POP2 #00 SWP + ( >> ) + +@ ( state force -- ) + ( force ) ?{ + [ LIT &last ff ] NEQk ?{ POP2 JMP2r } + POP DUP ,&last STR } + [ LIT2 26 -Screen/auto ] DEO + #0000 .Screen/x DEO2 + .Screen/height DEI2 #0020 SUB2 .Screen/y DEO2 + #00 SWP #0060 MUL2 ;corner-icn ADD2 .Screen/addr DEO2 + [ LIT2 01 -Screen/sprite ] DEOk DEOk DEOk DEO + JMP2r + @ ( -- ) .Screen/x DEI2k #0010 ADD2 #33 SFT2 ROT DEO2 JMP2r