c03: use DIALOG as base class for MenuWin

This commit is contained in:
Martin Preuss
2026-05-13 20:08:36 +02:00
parent 76def6c8dc
commit 79e7ac47d9

View File

@@ -14,7 +14,7 @@
; ***************************************************************************
; defines
.equ MENUWIN_OFFS_BEGIN = MAINWINDOW_SIZE
.equ MENUWIN_OFFS_BEGIN = DIALOG_SIZE
.equ MENUWIN_SIZE = MENUWIN_OFFS_BEGIN+0
@@ -77,7 +77,7 @@ MenuWin_Init:
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSOURCE_TXT_AQHOME)
ldi r21, HIGH(RESSOURCE_TXT_AQHOME)
bigcall MainWindow_Init
bigcall Dialog_Init
brcc MenuWin_Init_ret
; set default signal map
@@ -190,67 +190,21 @@ menuWinCreateButton_ret:
; ---------------------------------------------------------------------------
; @routine MenuWin_OnShow
;
; @param Y MainWindow
; @routine MenuWin_OnMkContent
MenuWin_OnShow:
; check visible flag
ldd r16, Y+OBJECT_OFFS_FLAGS
sbrc r16, WIDGET_FLAGS_VISIBLE_BIT
rjmp MenuWin_OnShow_ret
; create content
bigcall MainWindow_CreateContentWidget ; r19:r18=content window
brcc MenuWin_OnShow_ret
mov xl, r18 ; use content window as parent
MenuWin_OnMkContent:
bigcall MainWindow_GetContentWidget ; r19:r18=content window
brcc MenuWin_OnMkContent_ret
mov xl, r18 ; use content window as parent
mov xh, r19
; set VISIBLE flag
ldd r16, Y+OBJECT_OFFS_FLAGS
sbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT)
std Y+OBJECT_OFFS_FLAGS, r16
rcall menuWinCreateContent
MenuWin_OnShow_ret:
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine MenuWin_OnHide @global
;
; @param Y pointer to dialog
; @return CFLAG set of okay, cleared otherwise
; @clobbers any, !Y
MenuWin_OnHide:
ldd r16, Y+OBJECT_OFFS_FLAGS
sbrs r16, WIDGET_FLAGS_VISIBLE_BIT
rjmp MenuWin_OnHide_ret
; prepare destruction of content
bigcall MainWindow_GetContentWidget
brcc MenuWin_OnHide_ret
push yl
; Y=MainWindow, X=content window
push yl ; main window
push yh
mov yl, r18
mov yh, r19
ldd r16, Y+OBJECT_OFFS_FLAGS
sbr r16, (1<<OBJECT_FLAGS_DESTROY_BIT)
std Y+OBJECT_OFFS_FLAGS, r16
pop yh
rcall menuWinCreateContent
pop yh ; main window
pop yl
; clr VISIBLE flag
ldd r16, Y+OBJECT_OFFS_FLAGS
cbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT)
std Y+OBJECT_OFFS_FLAGS, r16
MenuWin_OnHide_ret:
MenuWin_OnMkContent_ret:
sec
ret
; @end
@@ -320,15 +274,14 @@ MenuWin_OnCmdDebug:
MenuWin_DefaultSignalmap:
; header
.dw MainWindow_DefaultSignalmap*2 ; next table to use
.dw Dialog_DefaultSignalmap*2 ; next table to use
; entries
.db 0, WIDGET_SIGNAL_SHOW, LOW(MenuWin_OnShow), HIGH(MenuWin_OnShow)
.db 0, WIDGET_SIGNAL_HIDE, LOW(MenuWin_OnHide), HIGH(MenuWin_OnHide)
.db MENUWIN_SEL_CLIMATE, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdClimate), HIGH(MenuWin_OnCmdClimate)
.db MENUWIN_SEL_LIGHT, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdLight), HIGH(MenuWin_OnCmdLight)
.db MENUWIN_SEL_WINDOWS, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdWindows), HIGH(MenuWin_OnCmdWindows)
.db MENUWIN_SEL_NETSTATS, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdNetStats), HIGH(MenuWin_OnCmdNetStats)
.db MENUWIN_SEL_DEBUG, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdDebug), HIGH(MenuWin_OnCmdDebug)
.db 0, DIALOG_SIGNAL_MKCONTENT, LOW(MenuWin_OnMkContent), HIGH(MenuWin_OnMkContent)
.db MENUWIN_SEL_CLIMATE, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdClimate), HIGH(MenuWin_OnCmdClimate)
.db MENUWIN_SEL_LIGHT, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdLight), HIGH(MenuWin_OnCmdLight)
.db MENUWIN_SEL_WINDOWS, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdWindows), HIGH(MenuWin_OnCmdWindows)
.db MENUWIN_SEL_NETSTATS, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdNetStats), HIGH(MenuWin_OnCmdNetStats)
.db MENUWIN_SEL_DEBUG, WIDGET_SIGNAL_COMMAND, LOW(MenuWin_OnCmdDebug), HIGH(MenuWin_OnCmdDebug)
.db 0, 0, 0, 0 ; end of table