getting ready to add complexity

This commit is contained in:
Iris Lightshard 2023-03-16 22:44:39 -06:00
parent 0f44a9fff7
commit ad0d627418
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 49 additions and 16 deletions

14
README.md Normal file
View file

@ -0,0 +1,14 @@
# taro
`mblaze` frontend in `uxn` and `crystal`
## messages
Even messages go from `taro-ctl` to the `uxn` windows.
- `0`: mailbox list
- `2`: list mail in mailbox
Odd messages go from the `uxn` windows to `taro-ctl`.
- `1`: change/refresh mailbox

View file

@ -22,7 +22,6 @@ module Taro
end
def initialize(@type, @data)
end
end
@ -114,6 +113,12 @@ module Taro
end
class MblazeProxy
@mailbox : String
def initialize
@mailbox = "INBOX"
end
def list_mail(box : String = "INBOX")
mailCmd = "
mbox=${MBOX_ROOT}/#{box}
@ -133,6 +138,10 @@ module Taro
Process.run(mailCmd, shell: true, output: io)
return io.to_s
end
def set_mbox(box : String)
@mailbox = box
end
end
class TaroCtl
@ -179,6 +188,8 @@ loop do
when taro.mainWindow.lifetime.receive?
exit
when m = taro.mainWindow.msg.receive
# do something
case m.type
when 1 then taro.mblaze.set_mbox(m.data.to_s)
end
end
end

View file

@ -1,6 +1,13 @@
( taro-ls: list mail, navigate mailboxes, and perform actions on mail )
( message types )
%MBOX_LIST { #00 }
%GET_MBOX { #01 }
%MAIL_LIST { #02 }
( UI constants )
%TOP_SECTION { #0020 }
%BOTTOM_SECTION { #0040 }
@ -21,10 +28,11 @@
|0000
@wipe_fg [ $1 ]
@refresh [ &mboxes $1 &list $1 &fg $1 ]
@resizing [ $1 &x $2 &y $2 &dx $2 &dy $2 ]
@decoding [ $1 &msg_type $1 &counting $1 &count $2 &processed $2 ]
@list [ &bytes $2 &len $1 &offset $2 &elem_offset $1 &top $2 &height $1 &select_index $2 &update $1 ]
@mboxes [ &bytes $2 &len $1 &offset $2 &elem_offset $1 &top $2 &height $1 &select_index $2 &sb_len $1 &sb_pos $2 &sb_step $2 ]
@list [ &bytes $2 &len $1 &offset $2 &elem_offset $1 &top $2 &height $1 &select_index $2 &sb_len $1 &sb_pos $2 &sb_step $2 ]
@sb [ &len $1 &pos $2 &step $2 ]
( program )
@ -40,7 +48,7 @@
#0200 .Screen/height DEO2
.Screen/height DEI2 TOP_SECTION BOTTOM_SECTION ADD2 SUB2 #03 SFT2 NIP .list/height STZ
#01 .wipe_fg STZ
#01 .refresh/fg STZ
;on_screen .Screen/vector DEO2
;on_mouse .Mouse/vector DEO2
@ -67,7 +75,7 @@ BRK
POP ;list_data .decoding/processed LDZ2 ADD2 STA
decode_inc_count .list/bytes STZ2
,&count JMP
#01 .list/update STZ
#01 .refresh/list STZ
&no_mail_list
POP
@ -93,12 +101,12 @@ BRK
JMP2r
@decode_is_done ( -- bit )
#01 .list/update STZ
#01 .refresh/list STZ
.decoding/processed LDZ2 .decoding/count LDZ2 EQU2
JMP2r
@on_mouse ( -> )
#01 .wipe_fg STZ
#01 .refresh/fg STZ
get_select_idx_by_mouse
.resizing LDZ #00 EQU ,&resz_check JCN
@ -150,7 +158,7 @@ BRK
,&chk_release JMP
&chk_release
#01 .list/update STZ
#01 .refresh/list STZ
.Screen/height DEI2 TOP_SECTION BOTTOM_SECTION ADD2 SUB2 #03 SFT2 NIP .list/height STZ
.Mouse/state DEI
@ -159,16 +167,16 @@ JMP2r
@on_screen ( -> )
.list/update LDZ #00 EQU ,&no_list JCN
.refresh/list LDZ #00 EQU ,&no_list JCN
draw_mail_list
draw_scrollbar
#00 .list/update STZ
#00 .refresh/list STZ
&no_list
.wipe_fg LDZ #00 EQU ,&no_fg JCN
.refresh/fg LDZ #00 EQU ,&no_fg JCN
clear_fg
draw_resize_handle
draw_cursor
#00 .wipe_fg STZ
#00 .refresh/fg STZ
&no_fg
BRK
@ -349,7 +357,7 @@ JMP2r
.Mouse/y DEI2 TOP_SECTION SUB2 #03 SFT2 .list/top LDZ2 ADD2 .list/select_index STZ2
#01 .list/update STZ
#01 .refresh/list STZ
.Mouse/state DEI #00 EQU ,&no_click JCN
.list/select_index LDZ2 .list/len LDZ2 GTH2 ,&no_click JCN
&no_click
@ -364,7 +372,7 @@ JMP2r
.list/top LDZ2 #0000 EQU2 ,&no_scroll_up JCN
.list/top LDZ2 #0001 SUB2 .list/top STZ2
;update_sb_pos JSR2
#01 .list/update STZ
#01 .refresh/list STZ
&no_scroll_up
JMP2r
@ -373,7 +381,7 @@ JMP2r
.list/top LDZ2 #00 .list/height LDZ ADD2 .list/len LDZ2 EQU2 ,&no_scroll_down JCN
.list/top LDZ2 INC2 .list/top STZ2
;update_sb_pos JSR2
#01 .list/update STZ
#01 .refresh/list STZ
&no_scroll_down
JMP2r