From 3f3cdaac731d3080b99bb698a8f2ec027974b6ea Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Sat, 7 Mar 2026 13:47:05 +0100 Subject: [PATCH] gui2: more work on gui. --- avr/modules/lcd2/gui2/base/guiapp.asm | 182 +++++++++++++++++++++- avr/modules/lcd2/gui2/base/object.asm | 66 ++++++-- avr/modules/lcd2/gui2/base/rootwindow.asm | 33 +--- avr/modules/lcd2/gui2/base/widget.asm | 31 ++++ 4 files changed, 268 insertions(+), 44 deletions(-) diff --git a/avr/modules/lcd2/gui2/base/guiapp.asm b/avr/modules/lcd2/gui2/base/guiapp.asm index cdef39f..2e79710 100644 --- a/avr/modules/lcd2/gui2/base/guiapp.asm +++ b/avr/modules/lcd2/gui2/base/guiapp.asm @@ -25,11 +25,21 @@ .equ GUIAPP_OFFS_CURRENTWINDOW_HI = GUIAPP_OFFS_BEGIN+5 .equ GUIAPP_OFFS_TOUCHWIDGET_LO = GUIAPP_OFFS_BEGIN+6 .equ GUIAPP_OFFS_TOUCHWIDGET_HI = GUIAPP_OFFS_BEGIN+7 -.equ GUIAPP_OFFS_DRAWTIMER = GUIAPP_OFFS_BEGIN+8 +.equ GUIAPP_OFFS_GUITIMER = GUIAPP_OFFS_BEGIN+8 .equ GUIAPP_SIZE = WIDGET_OFFS_BEGIN+9 -.equ GUIAPP_DRAWTIMER = 2 +.equ GUIAPP_GUITIMER = 2 + + + +; *************************************************************************** +; data + +.dseg + +guiapp_touch_event: + .byte WIDGET_TOUCH_SIZE @@ -105,8 +115,8 @@ GuiApp_Init: std Y+GUIAPP_OFFS_ROOTWINDOW_LO, xl std Y+GUIAPP_OFFS_ROOTWINDOW_HI, xh - ldi r16, GUIAPP_DRAWTIMER - std Y+GUIAPP_OFFS_DRAWTIMER, r16 + ldi r16, GUIAPP_GUITIMER + std Y+GUIAPP_OFFS_GUITIMER, r16 GuiApp_Init_ret: ret @@ -353,8 +363,13 @@ GuiApp_OnDestroy: ; @routine GuiApp_OnTimer ; ; @param Y address of object in SDRAM +; @clobbers any, !Y GuiApp_OnTimer: + rcall guiAppCheckTouch ; (any, !Y) + rcall guiAppSendTimerEvents ; (any, !Y) + rcall guiAppCheckSendGuiEvents ; (any, !Y) + sec ret ; @end @@ -372,6 +387,165 @@ GuiApp_OnMsgReceived: +; --------------------------------------------------------------------------- +; @routine GuiApp_OnTouch +; +; @param Y address of object in SDRAM +; @clobbers any, !Y + +GuiApp_OnTouch: + rcall guiAppSendTouchEvents + ret +; @end + + + + +; --------------------------------------------------------------------------- +; @routine guiAppSendTimerEvents +; +; @param Y ptr to GUIAPP +; @clobbers any, !Y + +guiAppSendTimerEvents: + push yl + push yh + ldd r16, Y+GUIAPP_OFFS_ROOTWINDOW_LO + ldd yh, Y+GUIAPP_OFFS_ROOTWINDOW_HI + mov yl, r16 + or yl, yh + breq guiAppSendTimerEvents_done + ldi r16, OBJECT_SIGNAL_TIMER + clr r17 + ldi r20, OBJECT_OPTSLO_TIMER_BIT + mov r21, r20 + bigcall OBJ_TreeHandleSignalIfMatchingOptsLo +guiAppSendTimerEvents_done: + pop yh + pop yl + ret +; @end + + + +; --------------------------------------------------------------------------- +; @routine guiAppCheckSendGuiEvents +; +; Send GUI events to current window if timer elapsed. +; +; @param Y ptr to GUIAPP +; @clobbers any, !Y + +guiAppCheckSendGuiEvents: + push yl + push yh + ldd r16, Y+GUIAPP_OFFS_CURRENTWINDOW_LO + ldd yh, Y+GUIAPP_OFFS_CURRENTWINDOW_HI + mov yl, r16 + or yl, yh + breq guiAppCheckSendGuiEvents_done + + ldd r16, Y+GUIAPP_OFFS_GUITIMER + tst r16 + breq guiAppCheckSendGuiEvents_done + dec r16 + std Y+GUIAPP_OFFS_GUITIMER, r16 + brne guiAppCheckSendGuiEvents_done + + ; timer elapsed, send layout events, draw events + ldi r16, WIDGET_SIGNAL_LAYOUT + clr r17 + ldi r20, (1<