taro-ls: add button row on the bottom, handle hover effect; taro-ctl: implement making all as read

This commit is contained in:
Iris Lightshard 2023-03-19 14:10:38 -06:00
parent 68783e113b
commit 47c0289dd6
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 70 additions and 4 deletions

View file

@ -155,6 +155,11 @@ module Taro
return run_cmd(mailCmd)
end
def mark_all_read
mailCmd = "mflag -S :"
return run_cmd(mailCmd)
end
def set_mbox(box : String)
@mailbox = box
end
@ -209,6 +214,9 @@ loop do
when 1 then
taro.mblaze.set_mbox(String.new(m.data))
taro.mainWindow.write_msg(2_u8, taro.mblaze.list_mail.to_slice)
when 3 then
taro.mblaze.mark_all_read
taro.mainWindow.write_msg(2_u8, taro.mblaze.list_mail.to_slice)
end
end
end

View file

@ -43,7 +43,7 @@
|0000
@refresh [ &mboxes $1 &list $1 &fg $1 ]
@refresh [ &mboxes $1 &list $1 &fg $1 &btns $1 ]
@resizing [ $1 &x $2 &y $2 &dx $2 &dy $2 ]
@decoding [ $1 &msg_type $1 &counting $1 &count $2 &processed $2 ]
@mboxes [ &bytes $2 &data $2 &len $2 &offset $2 &elem_offset $1
@ -52,6 +52,7 @@
@list [ &bytes $2 &data $2 &len $2 &offset $2 &elem_offset $1
&top $2 &height $1 &select_index $2 &select_len $2
&sb_len $1 &sb_pos $2 &sb_step $2 ]
@btn_colors [ &read_all $1 ]
( program )
@ -72,7 +73,9 @@
.Screen/height DEI2 TOP_SECTION BOTTOM_SECTION ADD2 MID_SEPARATOR ADD2 SUB2 #03 SFT2 NIP .list/height STZ
TOP_SECTION #03 SFT2 NIP .mboxes/height STZ
#01 .refresh/btns STZ
#01 .refresh/fg STZ
#03 .btn_colors/read_all STZ
;on_screen .Screen/vector DEO2
;on_mouse .Mouse/vector DEO2
@ -179,6 +182,7 @@ BRK
;mbox_select_handler .mboxes .refresh/mboxes #0000 #00 mouse_event_list
;noop_list_click .list .refresh/list TOP_SECTION MID_SEPARATOR ADD2 #04 mouse_event_list
#01 mouse_event_buttons
.resizing LDZ #00 EQU ,&resz_check JCN
( resizing )
@ -204,6 +208,31 @@ BRK
#01 .refresh/fg STZ
BRK
@mouse_event_buttons ( numBtns -- )
STH
( TODO: check if any button is active and only refresh if it is )
STHkr #00 &while EQUk ,&end JCN
DUP .btn_colors ADD #03 SWP STZ
INC
,&while JMP &end POP2
.Mouse/x DEI2 #0008 LTH2 ,&done JCN
.Mouse/x DEI2 #0008 SUB2 [ STHkr #00 SWP #40 SFT2 #0001 SUB2 ] GTH2 ,&done JCN
.Mouse/y DEI2 .Screen/height DEI2 #0020 SUB2 LTH2 ,&done JCN
.Mouse/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ,&done JCN
#01 [ .Mouse/x DEI2 #0008 SUB2 #04 SFT2 NIP ] .btn_colors ADD STZ
&done
#01 .refresh/btns STZ
POPr
JMP2r
@handle_rsz ( -- mousestate )
( chk_x_rsz )
@ -387,6 +416,11 @@ JMP2r
#00 .refresh/list STZ
&no_list
.refresh/btns LDZ #00 EQU ,&no_btns JCN
.btn_colors/read_all LDZ ;all_read_button #0008 .Screen/height DEI2 #0020 SUB2 draw_button_2x2_symmetrical
#00 .refresh/btns STZ
&no_btns
.refresh/fg LDZ #00 EQU ,&no_fg JCN
clear_fg
draw_resize_handle
@ -448,7 +482,7 @@ JMP2r
JMP2r
@shouldnt_draw_word ( list -- flag )
@shouldnt_draw_word ( list -- bit )
DUP LB_OFFSET LDZ2 DUP2
( above top of view )
@ -621,6 +655,26 @@ JMP2r
JMP2r
@draw_button_2x2_symmetrical ( color sprite* x* y* -- )
.Screen/y DEO2
.Screen/x DEO2
.Screen/addr DEO2
STHk .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
STHkr #10 ADD .Screen/sprite DEO
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
STHkr #20 ADD .Screen/sprite DEO
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
STHr #30 ADD .Screen/sprite DEO
JMP2r
( -== util ==- )
@strlen ( addr* -- len* )
@ -632,6 +686,10 @@ JMP2r
JMP2r
@debug_u8 ( byte -- )
#00 SWP debug_u16
JMP2r
@debug_u16 ( short* -- )
SWP ,&byte JSR
@ -640,8 +698,6 @@ JMP2r
JMP2r
@debug ( str* -- )
&while
@ -658,6 +714,8 @@ JMP2r
@scrollbar [ 0707 0707 0707 0707 ]
@blank [ 0000 0000 0000 0000 ]
@all_read_button [ 0001 0111 0904 0278 ]
@font [
00 00 00 00 00 00 00 00 00 18 18 18 08 00 08 00 00 14 14 00 00 00 00 00 00 24 7e 24 24 7e 24 00
00 10 3c 50 38 14 78 10 00 00 44 08 10 20 44 00 00 18 20 32 2c 24 1a 00 00 18 10 20 00 00 00 00