gui2: fixed problems with layouts

need to look into spread mode, too.
This commit is contained in:
Martin Preuss
2026-03-11 00:32:08 +01:00
parent 282cd738b4
commit 51cedae0cb
10 changed files with 493 additions and 84 deletions

View File

@@ -253,49 +253,41 @@ test:
sts guiApp, yl
sts guiApp+1, yh
bigcall GuiApp_GetRootWindow
brcc DEBUG_STOP
push yl
push yh
mov xl, r18
mov xh, r19
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_TXT_LIVINGROOM)
ldi r21, HIGH(RESSSOURCE_TXT_LIVINGROOM)
bigcall MainWindow_new
bigcall MainWindow_GetContentWidget
brcc DEBUG_STOP
mov xl, yl ; X=MainWindow
bigcall ClimateWin_new
; rcall mkTestWindow
mov xl, yl
mov xh, yh
push xl ; mainWindow
push xh
mov xl, r18 ; contentWindow
mov xh, r19
push xl
push xh
ldi r16, (1<<OBJECT_OPTS_TIMER_BIT) | (1<<WIDGET_OPTS_INPUT_BIT) | (1<<WIDGET_OPTS_BORDER_BIT) ; OPTS
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, VALUE_ID_SENSOR_CO2_BASE
ldi r21, C03_EEID_SENSOR_CO2
ldi r22, SENSORWATCH_TYPE_CO2
bigcall SensorWatch_new
pop xh
pop xl
pop xh
pop xl
pop yh
pop yl
brcc DEBUG_STOP
brcc DEBUG_STOP2
bigcall GuiApp_EnterWindow
push xl
push xh
bigcall GuiApp_EnterWindow
pop xh
pop xl
brcc DEBUG_STOP3
push yl
push yh
mov yl, xl
mov yh, xh
ldi r16, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT) | (1<<WIDGET_FLAGS_LAYOUT_BIT)
bigcall OBJ_AddFlagsUp
pop yh
pop yl
ret
; ; debug
; ldi r16, LOW(Debug_Style*2)
; std Y+WIDGET_OFFS_STYLE_LO, r16
; ldi r16, HIGH(Debug_Style*2)
; std Y+WIDGET_OFFS_STYLE_HI, r16
DEBUG_STOP:
bigjmp DEBUG1
@@ -309,6 +301,122 @@ DEBUG_STOP3:
mkTestWindow:
bigcall GuiApp_GetRootWindow
brcc mkTestWindow_ret
mov xl, r18 ; use root window as parent for main window
mov xh, r19
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_TXT_LIVINGROOM) ; TODO: use "Room Climate"
ldi r21, HIGH(RESSSOURCE_TXT_LIVINGROOM)
bigcall MainWindow_new
brcc mkTestWindow_ret
; Y=MainWindow
push yl
push yh
bigcall MainWindow_GetContentWidget ; r19:r18=content window
brcc mkTestWindow_popRet
mov xl, r18 ; use content window as parent
mov xh, r19
push xl ; content window
push xh
rcall mkTestWidgets
; rcall mkSimpleTestWidgets
pop xh
pop xl
mkTestWindow_popRet:
pop yh
pop yl
mkTestWindow_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine mkTestWidgets
;
; @param X pointer to MainWindow content window (becomes parent)
; @return CFLAG set of okay, cleared otherwise
; @return Y address of newly created object
mkTestWidgets:
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
; ldi r20, HLAYOUT_MODE_SPREAD
ldi r20, VLAYOUT_MODE_EXPAND
bigcall VLayout_new
brcc mkTestWidgets_ret
push yl
push yh
mov xl, yl ; use HLayout as parent
mov xh, yh
push xl ; HLayout
push xh
ldi r16, 0
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_HUMIDITY96)
ldi r21, HIGH(RESSSOURCE_IMG_HUMIDITY96)
bigcall ImageView_new
pop xh
pop xl
brcc mkTestWidgets_popRet
push xl ; HLayout
push xh
ldi r16, 0
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_CLOUD96)
ldi r21, HIGH(RESSSOURCE_IMG_CLOUD96)
bigcall ImageView_new
pop xh
pop xl
brcc mkTestWidgets_popRet
mkTestWidgets_popRet:
pop yh
pop yl
mkTestWidgets_ret:
ret
; @end
mkSimpleTestWidgets:
push xl ; Contentwindow
push xh
ldi r16, 0
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_HUMIDITY96)
ldi r21, HIGH(RESSSOURCE_IMG_HUMIDITY96)
bigcall ImageView_new
pop xh
pop xl
brcc mkSimpleTestWidgets_ret
push xl ; HLayout
push xh
ldi r16, 0
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSSOURCE_IMG_CLOUD96)
ldi r21, HIGH(RESSSOURCE_IMG_CLOUD96)
bigcall ImageView_new
pop xh
pop xl
brcc mkSimpleTestWidgets_ret
mkSimpleTestWidgets_ret:
ret
; @end
; ***************************************************************************
; includes
@@ -355,9 +463,9 @@ GUI2_MODULE_BEGIN:
.include "modules/lcd2/gui2/base/valuelabel.asm"
.include "modules/lcd2/gui2/aqhome/sensorwatch.asm"
GUI2_MODULE_END:
.equ MODULE_SIZE_GUI2 = GUI2_MODULE_END-GUI2_MODULE_BEGIN
.include "w_climate.asm"
.include "ressources.inc"