gui2: more work (vlayout doesn't work, yet).

This commit is contained in:
Martin Preuss
2026-03-09 02:08:33 +01:00
parent 92efebccf1
commit 0758579b43
11 changed files with 657 additions and 523 deletions

View File

@@ -55,8 +55,7 @@ guiapp_touch_event:
;
; @return CFLAG set of okay, cleared otherwise
; @return Y address of newly created object
; @param r16 value for OBJECT_OFFS_OPTS_LO
; @param r17 value for OBJECT_OFFS_OPTS_HI
; @param r16 value for OBJECT_OFFS_OPTS
; @clobbers any
GuiApp_new:
@@ -76,22 +75,13 @@ GuiApp_new_ret:
; @routine GuiApp_Init @global
;
; @param Y address of object in SDRAM
; @param r16 value for OBJECT_OFFS_OPTS_LO
; @param r17 value for OBJECT_OFFS_OPTS_HI
; @param r16 value for OBJECT_OFFS_OPTS
; @clobbers r16, r17, X
GuiApp_Init:
; call base class
bigcall OBJ_Init ; (r16, r17, X)
; clear object-specific data
mov xl, yl
mov xh, yh
adiw xh:xl, GUIAPP_OFFS_BEGIN
clr r16
ldi r17, (GUIAPP_SIZE-GUIAPP_OFFS_BEGIN)
bigcall Utils_FillSram ; (r17, X)
; set default signal map
ldi r16, LOW(GuiApp_DefaultSignalmap*2)
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
@@ -103,13 +93,13 @@ GuiApp_Init:
push yh
mov xl, yl
mov xh, yh
ldi r16, 0 ; opts_lo
ldi r17, 0 ; opts_hi
ldi r16, 0 ; opts
ldi r17, 0 ; pack
bigcall RootWindow_new
; always visible
ldd r16, Y+OBJECT_OFFS_FLAGS
sbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT)
sbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_LAYOUT_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT)
std Y+OBJECT_OFFS_FLAGS, r16
mov xl, yl
@@ -245,6 +235,7 @@ GuiApp_UngrabTouchEvents_ret:
;
; @param Y address of object in SDRAM
; @param CFLAG set if response is not a NULL pointer
; @return r19:r18 root window
; @clobbers none
GuiApp_GetRootWindow:
@@ -377,8 +368,8 @@ GuiApp_OnDestroy:
; @clobbers any, !Y
GuiApp_OnTimer:
rcall guiAppCheckTouch ; (any, !Y)
rcall guiAppSendTimerEvents ; (any, !Y)
; rcall guiAppCheckTouch ; (any, !Y)
; rcall guiAppSendTimerEvents ; (any, !Y)
rcall guiAppCheckSendGuiEvents ; (any, !Y)
sec
ret
@@ -421,9 +412,9 @@ GuiApp_OnTouch:
guiAppSendTimerEvents:
ldi r16, OBJECT_SIGNAL_TIMER
clr r17
ldi r20, (1<<OBJECT_OPTSLO_TIMER_BIT)
ldi r21, (1<<OBJECT_OPTSLO_TIMER_BIT)
rcall guiAppSendRootEventsIfOptsLo
ldi r20, (1<<OBJECT_OPTS_TIMER_BIT)
ldi r21, (1<<OBJECT_OPTS_TIMER_BIT)
rcall guiAppSendRootEventsIfOpts
sec
ret
; @end
@@ -460,7 +451,7 @@ guiAppCheckSendGuiEvents:
clr r17
ldi r20, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_LAYOUT_BIT)
bigcall OBJ_TreeHandleSignalIfFlagsSet ; (any, !Y)
ldi r16, WIDGET_SIGNAL_DRAW
clr r17
ldi r20, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT)
@@ -507,9 +498,9 @@ guiAppSendTouchEvents_sendToAll:
mov yh, r19
ldi r16, WIDGET_SIGNAL_TOUCH
clr r17
ldi r20, (1<<WIDGET_OPTSLO_INPUT_BIT)
ldi r21, (1<<WIDGET_OPTSLO_INPUT_BIT)
bigcall OBJ_TreeHandleSignalIfMatchingOptsLo
ldi r20, (1<<WIDGET_OPTS_INPUT_BIT)
ldi r21, (1<<WIDGET_OPTS_INPUT_BIT)
bigcall OBJ_TreeHandleSignalIfMatchingOpts
guiAppSendTouchEvents_done:
pop yh
pop yl
@@ -533,9 +524,9 @@ guiAppSendTouchEvents_done:
guiAppSendRootMsgEvents:
ldi r16, WIDGET_SIGNAL_TOUCH
clr r17
ldi r20, (1<<OBJECT_OPTSLO_MSGRECV_BIT)
ldi r21, (1<<OBJECT_OPTSLO_MSGRECV_BIT)
rcall guiAppSendRootEventsIfOptsLo
ldi r20, (1<<OBJECT_OPTS_MSGRECV_BIT)
ldi r21, (1<<OBJECT_OPTS_MSGRECV_BIT)
rcall guiAppSendRootEventsIfOpts
sec
ret
; @end
@@ -543,7 +534,7 @@ guiAppSendRootMsgEvents:
; ---------------------------------------------------------------------------
; @routine guiAppSendRootEventsIfOptsLo
; @routine guiAppSendRootEventsIfOpts
;
; Send events to all widgets with matching OPTS_LO.
;
@@ -552,20 +543,20 @@ guiAppSendRootMsgEvents:
; @param R17 selector
; @param xl param1
; @param xh param2
; @param r20 mask for OBJECT_OFFS_OPTS_LO
; @param r21 value for OBJECT_OFFS_OPTS_LO to match
; @param r20 mask for OBJECT_OFFS_OPTS
; @param r21 value for OBJECT_OFFS_OPTS to match
; @clobbers any, !Y
guiAppSendRootEventsIfOptsLo:
guiAppSendRootEventsIfOpts:
push yl
push yh
rcall GuiApp_GetRootWindow ; r19:r18=root window (none)
brcc guiAppSendRootEventsIfOptsLo_done
brcc guiAppSendRootEventsIfOpts_done
; send signal to root window and all below
mov yl, r18
mov yh, r19
bigcall OBJ_TreeHandleSignalIfMatchingOptsLo
guiAppSendRootEventsIfOptsLo_done:
bigcall OBJ_TreeHandleSignalIfMatchingOpts
guiAppSendRootEventsIfOpts_done:
pop yh
pop yl
ret
@@ -609,7 +600,7 @@ guiAppCheckTouch_ret:
GuiApp_DefaultSignalmap:
; header
.dw Object_DefaultSignalmap ; next table to use
.dw Object_DefaultSignalmap*2 ; next table to use
; entries
.db 0, OBJECT_SIGNAL_TIMER, LOW(GuiApp_OnTimer), HIGH(GuiApp_OnTimer)
.db 0, OBJECT_SIGNAL_DESTROY, LOW(GuiApp_OnDestroy), HIGH(GuiApp_OnDestroy)