more work on dialogs.

This commit is contained in:
Martin Preuss
2025-11-17 23:01:26 +01:00
parent 520f371560
commit fbcfd65e7f
6 changed files with 174 additions and 46 deletions

View File

@@ -31,9 +31,8 @@
.equ DIALOG_FN_FINI = 1
.equ DIALOG_FN_SHOW = 2
.equ DIALOG_FN_HIDE = 3
.equ DIALOG_FN_DRAW = 4
.equ DIALOG_FN_TOUCH = 5
.equ DIALOG_FN_TIMER = 6
.equ DIALOG_FN_TOUCH = 4
.equ DIALOG_FN_TIMER = 5
@@ -87,9 +86,20 @@ DialogMgr_Init:
; ---------------------------------------------------------------------------
; @routine DialogMgr_Every100ms @global
;
; Handle display touch events
; Send timer event to every app in the stack (started with last added app).
DialogMgr_Every100ms:
; check for touch input changes
rcall Display_InputGetState ; r16=flags, r5:r4=x, r7:r6=y
mov r17, r16
andi r17, (1<<DISPLAY_IFLAGS_CHGCOORD_BIT) | (1<<DISPLAY_IFLAGS_CHGPRESS_BIT)
breq DialogMgr_Every100ms_sendTimer
mov r18, r16
ldi r23, DIALOG_FN_TOUCH
rcall DialogMgr_CallCurrentHandler
DialogMgr_Every100ms_sendTimer:
; send timer event to all dialogs in stack
ldi xl, LOW(dialogStack)
ldi xh, HIGH(dialogStack)
@@ -109,7 +119,7 @@ DialogMgr_Every100ms_loop:
push xh
push r17
ldi r23, DIALOG_FN_TIMER
rcall DialogMgr_CallCurrentHandler
rcall DialogMgr_CallHandler
pop r17
pop xh
pop xl
@@ -129,6 +139,11 @@ DialogMgr_Every100ms_ret:
; @clobbers R16, R17, R22, X (any)
DialogMgr_CallHandler:
tst yl
brne DialogMgr_CallHandler_go
tst yh
breq DialogMgr_CallHandler_ret
DialogMgr_CallHandler_go:
ldi xl, LOW(dialogWindow)
ldi xh, HIGH(dialogWindow)
ldd r16, Y+DIALOG_OFFS_HANDLER_LO
@@ -186,6 +201,7 @@ DialogMgr_PushDialog:
DialogMgr_PushDialog_push:
lds r16, dialogStackPos
mov r17, r16
add r17, r17 ; *2
push xl
push xh
@@ -200,10 +216,13 @@ DialogMgr_PushDialog_push:
pop xl
inc r16
sts dialogStackPos, r16
sts dialogCurrent, yl
sts dialogCurrent+1, yh
; activate new app
ldd r17, Y+DIALOG_OFFS_OPTIONS
ori r17, (1<<DIALOG_OPT_ACTIVE_BIT)
std Y+DIALOG_OFFS_OPTIONS, r17
ldi r23, DIALOG_FN_SHOW
rcall DialogMgr_CallHandler
sec
@@ -273,6 +292,23 @@ DialogMgr_PopDialog_ret:
; ---------------------------------------------------------------------------
; @routine Dialog_Init @global
;
; @param Y pointer to screen object in SDRAM
; @clobbers R16, R17, X
Dialog_Init:
mov xl, yl
mov xh, yh
ldi r17, DIALOG_SIZE
clr r16
bigcall Utils_FillSram ; (R17, X)
ret
; @end
#endif ; AQHOME_AVR_MODS_GUI_DIALOG_ASM