uxn-utils/gui/notepad/notepad.tal

226 lines
4.3 KiB
Tal
Raw Normal View History

2023-04-26 00:20:12 -04:00
|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
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0100
( theme )
2023-04-26 12:07:09 -04:00
#f0f0 .System/r DEO2
#f000 .System/g DEO2
2023-04-26 00:20:12 -04:00
#f00f .System/b DEO2
( size )
#00e0 .Screen/width DEO2
2023-04-26 00:32:24 -04:00
#00f8 .Screen/height DEO2
2023-04-26 00:20:12 -04:00
( unlock )
;on-console .Console/vector DEO2
2023-04-26 00:44:57 -04:00
;on-mouse-body .Mouse/vector DEO2
2023-04-26 00:20:12 -04:00
draw-header
2023-04-26 00:32:24 -04:00
draw-footer
2023-04-26 00:20:12 -04:00
BRK
@on-console ( -> )
BRK
2023-04-26 00:44:57 -04:00
@on-mouse-head ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn update-cursor
trap-mouse
.Mouse/state DEI ?&on-mouse-down
BRK
&on-mouse-down ( -> )
BRK
@on-mouse-body ( -> )
2023-04-26 00:20:12 -04:00
2023-04-26 00:32:24 -04:00
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;caret-icn update-cursor
2023-04-26 00:44:57 -04:00
trap-mouse
.Mouse/state DEI ?&on-mouse-down
BRK
&on-mouse-down ( -> )
BRK
@on-mouse-foot ( -> )
[ LIT2 00 -Mouse/state ] DEI NEQ #41 ADD ;mouse-icn update-cursor
trap-mouse
2023-04-26 12:07:09 -04:00
.Mouse/state DEI #00 NEQ .Mouse/x DEI2 #0018 LTH2 AND ?&on-mouse-down
2023-04-26 00:32:24 -04:00
BRK
&on-mouse-down ( -> )
2023-04-26 12:07:09 -04:00
.Mouse/y DEI2 #00d6 SUB2 NIP
#18 .Mouse/x DEI2 NIP SUB
ADD #18 LTH ?&go-next prev-page BRK
&go-next next-page
2023-04-26 00:20:12 -04:00
BRK
2023-04-26 00:44:57 -04:00
(
@|core )
@trap-mouse ( -- )
.Mouse/y DEI2
DUP2 #0018 GTH2 ?&no-head
POP2 ;on-mouse-head .Mouse/vector DEO2 JMP2r
&no-head
DUP2 #00d6 LTH2 ?&no-foot
POP2 ;on-mouse-foot .Mouse/vector DEO2 JMP2r
&no-foot
POP2
;on-mouse-body .Mouse/vector DEO2
JMP2r
2023-04-26 12:07:09 -04:00
@prev-page ( -- )
#ff phex/b #0a18 DEO
JMP2r
@next-page ( -- )
#01 phex/b #0a18 DEO
JMP2r
2023-04-26 00:32:24 -04:00
@update-cursor ( color addr* -- )
[ LIT2 15 -Screen/auto ] DEO
#40 draw-cursor
.Mouse/x DEI2 ,draw-cursor/x STR2
.Mouse/y DEI2 ,draw-cursor/y STR2
.Screen/addr DEO2
@draw-cursor ( color -- )
[ LIT2 &x $2 ] .Screen/x DEO2
[ LIT2 &y $2 ] .Screen/y DEO2
.Screen/sprite DEO
JMP2r
2023-04-26 00:20:12 -04:00
(
@|drawing )
@draw-header ( -- )
2023-04-26 00:32:24 -04:00
( a )
2023-04-26 00:20:12 -04:00
#0000
DUP2 .Screen/x DEO2
.Screen/y DEO2
#15 .Screen/auto DEO
;bar-icn/a .Screen/addr DEO2
#01 .Screen/sprite DEO
( close )
;close-icn/default .Screen/addr DEO2
#01 .Screen/sprite DEOk DEO
( lead )
#e9 &l
;bar-icn/b .Screen/addr DEO2
#01 .Screen/sprite DEO
INC DUP ?&l
POP
;bar-icn/b .Screen/addr DEO2
#01 .Screen/sprite DEOk DEO
( title )
#004b .Screen/x DEO2
#86 .Screen/auto DEO
;title-icn .Screen/addr DEO2
#01 .Screen/sprite DEOk DEO
( line )
#d2 .Screen/auto DEO
#0000 .Screen/x DEO2
#0010 .Screen/y DEO2
;line-icn .Screen/addr DEO2
#01 .Screen/sprite DEO
#0070 .Screen/x DEO2
#0010 .Screen/y DEO2
#01 .Screen/sprite DEO
JMP2r
2023-04-26 00:32:24 -04:00
@draw-footer ( -- )
#26 .Screen/auto DEO
#0000 .Screen/x DEO2
.Screen/height DEI2 #0020 SUB2 .Screen/y DEO2
;page-icn .Screen/addr DEO2
#01 .Screen/sprite DEOk DEOk DEOk DEO
( across )
#01 .Screen/auto DEO
#0018 .Screen/x DEO2
.Screen/height DEI2 #0008 SUB2 .Screen/y DEO2
;page-icn/bottom .Screen/addr DEO2
#e7 &l
#01 .Screen/sprite DEO
INC DUP ?&l
POP
JMP2r
2023-04-26 00:44:57 -04:00
@phex ( short* -- ) SWP phex/b &b ( byte -- ) DUP #04 SFT phex/c &c ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO JMP2r
2023-04-26 00:20:12 -04:00
(
@|assets )
2023-04-26 00:32:24 -04:00
@caret-icn [
c628 1010 1010 1010 1010 1010 1010 28c6 ]
2023-04-26 00:44:57 -04:00
@mouse-icn [
80c0 e0f0 f8fc feff f8d8 8c0c 0606 0000 ]
2023-04-26 00:20:12 -04:00
@bar-icn
&a [
0000 007e 007e 007e 007e 007e 007e 0000 ]
&b [
0000 00ff 00ff 00ff 00ff 00ff 00ff 0000 ]
&c [
0000 00fe 00fe 00fe 00fe 00fe 00fe 0000 ]
@close-icn
&default [
0000 00ff 8080 8080 8080 8080 80ff 0000
0000 00ef 202f 202f 202f 202f 20ef 0000 ]
&active [
0000 00ff 84a4 9580 f180 95a4 84ff 0000
0000 00ef 20af 202f e02f 20af 20ef 0000 ]
@title-icn [
0000 0080 0080 0080 0000 0000 82c2 e2f2
0000 0000 0000 3c66 0000 0000 3030 7831
0000 0000 0000 f098 0000 0000 1f19 1919
0000 0000 0080 8f91 0000 0000 0101 0f99
0000 0000 8080 8080 0080 0080 0080 0000
ba9e 8e86 8200 0000 6666 6666 3c00 0000
3131 3131 1800 0000 98f8 8088 f000 0000
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 ]
@line-icn [
00ff 0000 0000 0000 ]