gui2: added mclayout (matrix layout ordering by column).
This commit is contained in:
@@ -268,6 +268,207 @@ DEBUG_STOP3:
|
||||
|
||||
|
||||
|
||||
DEBUG_DUMPCTX:
|
||||
lds yl, guiApp
|
||||
lds yh, guiApp+1
|
||||
bigcall GuiApp_GetRootWindow
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
|
||||
bigcall Widget_Clear
|
||||
|
||||
clr r4
|
||||
clr r5
|
||||
clr r6
|
||||
clr r7
|
||||
|
||||
adiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
||||
ld r24, X+
|
||||
|
||||
DEBUG_DUMPCTX_loop:
|
||||
clr r4
|
||||
clr r5
|
||||
rcall DEBUG_DUMPCTXITEM
|
||||
ldi r16, 20
|
||||
clr r17
|
||||
add r6, r16
|
||||
adc r7, r17
|
||||
dec r24
|
||||
brne DEBUG_DUMPCTX_loop
|
||||
bigjmp DEBUG3
|
||||
|
||||
|
||||
DEBUG_DUMPONEITEM:
|
||||
lds yl, guiApp
|
||||
lds yh, guiApp+1
|
||||
bigcall GuiApp_GetRootWindow
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall Widget_Clear
|
||||
|
||||
clr r4
|
||||
clr r5
|
||||
clr r6
|
||||
clr r7
|
||||
rjmp DEBUG_DUMPCTXITEM
|
||||
|
||||
DEBUG_DUMPCTXITEM:
|
||||
adiw xh:xl, LAYOUT_CTX_ITEM_OFFS_POS_LO
|
||||
ld r20, X+ ; pos
|
||||
ld r21, X+
|
||||
rcall DEBUG_WRITE_INT
|
||||
ldi r16, 65
|
||||
clr r17
|
||||
add r4, r16
|
||||
adc r5, r17
|
||||
|
||||
ld r20, X+ ; size
|
||||
ld r21, X+
|
||||
rcall DEBUG_WRITE_INT
|
||||
ldi r16, 65
|
||||
clr r17
|
||||
add r4, r16
|
||||
adc r5, r17
|
||||
|
||||
ld r20, X+ ; flags
|
||||
clr r21
|
||||
rcall DEBUG_WRITE_INT
|
||||
ldi r16, 65
|
||||
clr r17
|
||||
add r4, r16
|
||||
adc r5, r17
|
||||
ret
|
||||
|
||||
|
||||
|
||||
DEBUG_DUMPWDG:
|
||||
lds yl, guiApp
|
||||
lds yh, guiApp+1
|
||||
bigcall GuiApp_GetRootWindow
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
|
||||
push zl
|
||||
push zh
|
||||
bigcall Widget_Clear
|
||||
pop zh
|
||||
pop zl
|
||||
|
||||
clr r4
|
||||
clr r5
|
||||
clr r6
|
||||
clr r7
|
||||
|
||||
push yl
|
||||
push yh
|
||||
mov yl, zl
|
||||
mov yh, zh
|
||||
bigcall OBJ_GetFirstChild
|
||||
pop yh
|
||||
pop yl
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
ldi r24, 11
|
||||
DEBUG_DUMPWDG_loop:
|
||||
rcall DEBUG_DUMPCWDG
|
||||
|
||||
ldi r16, 20
|
||||
clr r17
|
||||
add r6, r16
|
||||
adc r7, r17
|
||||
dec r24
|
||||
breq DEBUG_DUMPWDG_end
|
||||
push yl
|
||||
push yh
|
||||
mov yl, zl
|
||||
mov yh, zh
|
||||
bigcall OBJ_GetNext
|
||||
pop yh
|
||||
pop yl
|
||||
mov zl, r18
|
||||
mov zh, r19
|
||||
brcc DEBUG_DUMPWDG_end
|
||||
rjmp DEBUG_DUMPWDG_loop
|
||||
|
||||
DEBUG_DUMPWDG_end:
|
||||
bigjmp DEBUG3
|
||||
|
||||
|
||||
DEBUG_DUMPCWDG:
|
||||
clr r4
|
||||
clr r5
|
||||
|
||||
ldd r20, Z+WIDGET_OFFS_X_LO
|
||||
ldd r21, Z+WIDGET_OFFS_X_HI
|
||||
rcall DEBUG_WRITE_INT
|
||||
ldi r16, 65
|
||||
clr r17
|
||||
add r4, r16
|
||||
adc r5, r17
|
||||
|
||||
ldd r20, Z+WIDGET_OFFS_Y_LO
|
||||
ldd r21, Z+WIDGET_OFFS_Y_HI
|
||||
rcall DEBUG_WRITE_INT
|
||||
ldi r16, 65
|
||||
clr r17
|
||||
add r4, r16
|
||||
adc r5, r17
|
||||
|
||||
ldd r20, Z+WIDGET_OFFS_WIDTH_LO
|
||||
ldd r21, Z+WIDGET_OFFS_WIDTH_HI
|
||||
rcall DEBUG_WRITE_INT
|
||||
ldi r16, 65
|
||||
clr r17
|
||||
add r4, r16
|
||||
adc r5, r17
|
||||
|
||||
ldd r20, Z+WIDGET_OFFS_HEIGHT_LO
|
||||
ldd r21, Z+WIDGET_OFFS_HEIGHT_HI
|
||||
rcall DEBUG_WRITE_INT
|
||||
ldi r16, 65
|
||||
clr r17
|
||||
add r4, r16
|
||||
adc r5, r17
|
||||
|
||||
ldd r20, Z+WIDGET_OFFS_TMP_LO
|
||||
ldd r21, Z+WIDGET_OFFS_TMP_HI
|
||||
rcall DEBUG_WRITE_INT
|
||||
ldi r16, 65
|
||||
clr r17
|
||||
add r4, r16
|
||||
adc r5, r17
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
; @param r21:r20: number
|
||||
DEBUG_WRITE_INT:
|
||||
push r24
|
||||
push zl
|
||||
push zh
|
||||
ldi r24, 0
|
||||
push xl
|
||||
push xh
|
||||
bigcall IntToAscii ; X=pointer to text
|
||||
push r4
|
||||
push r5
|
||||
bigcall Widget_DrawTextRam ; (any, !Y)
|
||||
pop r5
|
||||
pop r4
|
||||
pop xh
|
||||
pop xl
|
||||
pop zh
|
||||
pop zl
|
||||
pop r24
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Debug_Style:
|
||||
.dw DISPLAY_COLOR_BLACK ; frontCol_norm
|
||||
.dw DISPLAY_COLOR_GREEN ; backCol_norm
|
||||
@@ -334,6 +535,7 @@ GUI2_MODULE_BEGIN:
|
||||
.include "modules/lcd2/gui2/aqhome/sensorwatch.asm"
|
||||
.include "modules/lcd2/gui2/base/layout2.asm"
|
||||
.include "modules/lcd2/gui2/base/hlayout2.asm"
|
||||
.include "modules/lcd2/gui2/base/mclayout.asm"
|
||||
GUI2_MODULE_END:
|
||||
.equ MODULE_SIZE_GUI2 = GUI2_MODULE_END-GUI2_MODULE_BEGIN
|
||||
|
||||
|
||||
@@ -96,9 +96,9 @@ ClimateWin_Init_ret:
|
||||
climateWinCreateSensorWatches:
|
||||
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, HLAYOUT_MODE_EXPAND
|
||||
bigcall HLayout_new
|
||||
; ldi r20, HLAYOUT2_MODE_SPREAD
|
||||
ldi r20, HLAYOUT2_MODE_EXPAND
|
||||
bigcall HLayout2_new
|
||||
brcc climateWinCreateSensorWatches_ret
|
||||
|
||||
mov xl, yl ; use HLayout as parent
|
||||
|
||||
@@ -152,9 +152,8 @@ netStatWinCreateContent:
|
||||
; create MLayout
|
||||
ldi r16, 0 ; OPTS
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
ldi r20, MLAYOUT_MODE_COLUMNS
|
||||
ldi r21, 2 ; columns per row
|
||||
bigcall MLayout_new
|
||||
ldi r20, 2 ; columns per row
|
||||
bigcall MCLayout_new
|
||||
brcc netStatWinCreateContent_ret
|
||||
|
||||
mov xl, yl ; use MLayout as parent
|
||||
|
||||
@@ -98,7 +98,7 @@ HLayout2_Init:
|
||||
|
||||
HLayout2_OnLayout:
|
||||
; create and preset context
|
||||
rcall LayoutCtx_CreateContextFor1D
|
||||
rcall LayoutCtx_CreateContextFor1D ; X=ctx, r16=num of children
|
||||
brcc HLayout2_OnLayout_ret
|
||||
; do layout
|
||||
mov r25, r16
|
||||
@@ -129,6 +129,8 @@ HLayout2_OnGetDefaultHeight:
|
||||
; rcall Layout_SetDefaultHeights
|
||||
; rcall Layout_GetMaxTmp
|
||||
; bigcall Widget_AddOuterStyleBorders ; (r20, r21)
|
||||
ldi r18, 10
|
||||
clr r19
|
||||
sec
|
||||
ret
|
||||
|
||||
@@ -146,6 +148,8 @@ HLayout2_OnGetDefaultHeight:
|
||||
HLayout2_OnGetDefaultWidth:
|
||||
; rcall Layout_SetDefaultWidths
|
||||
; rcall Layout_SumTmpValues ; r19:r18=default width
|
||||
ldi r18, 10
|
||||
clr r19
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
@@ -201,7 +205,7 @@ hLayout2PrepareVertical:
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine hLayout2ReadLayoutWriteHorizontal
|
||||
; @routine hLayout2ReadLayoutWriteVertical
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param X layout context
|
||||
@@ -209,57 +213,28 @@ hLayout2PrepareVertical:
|
||||
; @clobbers r16-r24
|
||||
|
||||
hLayout2ReadLayoutWriteVertical:
|
||||
push yl
|
||||
push yh
|
||||
push r24
|
||||
bigcall OBJ_GetFirstChild
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
|
||||
; read positions and flags into new layout context
|
||||
push r25
|
||||
push yl
|
||||
push yh
|
||||
bigcall LayoutCtx_ReadYDimsContiguous
|
||||
pop yh
|
||||
pop yl
|
||||
pop r25
|
||||
pop r24
|
||||
bigcall LayoutCtx_ReadYDimsContiguous ; (R16, r18, r19, Z)
|
||||
|
||||
; layout
|
||||
bigcall LayoutCtx_GetMaxSize ; r19:r18=max default size (r18, r19, r20, r21, r24)
|
||||
bigcall LayoutCtx_SetFixedSize ; (r24)
|
||||
push r25
|
||||
bigcall LayoutCtxSetPos ; (r16-r25)
|
||||
pop r25
|
||||
adiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
|
||||
ld r18, X
|
||||
clr r19
|
||||
sbiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
|
||||
bigcall LayoutCtx_SetFixedPos ; (r24)
|
||||
|
||||
; pack
|
||||
push r25
|
||||
push yl
|
||||
push yh
|
||||
bigcall LayoutCtx_PackYContiguous
|
||||
pop yh
|
||||
pop yl
|
||||
pop r25
|
||||
bigcall LayoutCtx_PackYContiguous ; (R16, r18, r19, Z)
|
||||
|
||||
; write back dims
|
||||
push r25
|
||||
push yl
|
||||
push yh
|
||||
bigcall LayoutCtx_WriteYDimsContiguous
|
||||
pop yh
|
||||
pop yl
|
||||
pop r25
|
||||
pop yh
|
||||
pop yl
|
||||
bigcall LayoutCtx_WriteYDimsContiguous ; (R16, r18, r19, Z)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine hLayout2Horizontally
|
||||
;
|
||||
@@ -276,8 +251,6 @@ hLayout2Horizontally:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine hLayout2PrepareHorizontal
|
||||
;
|
||||
@@ -322,21 +295,9 @@ hLayout2PrepareHorizontal:
|
||||
hLayout2ReadLayoutWriteHorizontal:
|
||||
; layout
|
||||
ldd r24, Y+HLAYOUT2_OFFS_MODE
|
||||
push yl
|
||||
push yh
|
||||
push r24
|
||||
bigcall OBJ_GetFirstChild ; (none)
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
; read X positions and flags into new layout context
|
||||
push r25
|
||||
push yl
|
||||
push yh
|
||||
bigcall LayoutCtx_ReadXDimsContiguous ; (r16, r18, r19, r24, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
pop r25
|
||||
pop r24
|
||||
bigcall LayoutCtx_ReadXDimsContiguous ; (R16, r18, r19, Z)
|
||||
|
||||
; layout
|
||||
push r25
|
||||
cpi r24, HLAYOUT_MODE_SPREAD
|
||||
@@ -347,26 +308,14 @@ hLayout2ReadLayoutWriteHorizontal_spread:
|
||||
bigcall LayoutCtx_LayoutSpread ; (r16-r25)
|
||||
hLayout2ReadLayoutWriteHorizontal_pack:
|
||||
pop r25
|
||||
|
||||
; pack
|
||||
push r25
|
||||
push yl
|
||||
push yh
|
||||
bigcall LayoutCtx_PackXContiguous ; (r16-r21, r24, r25, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
bigcall LayoutCtx_PackXContiguous ; (r16-r21, r24, r25)
|
||||
pop r25
|
||||
|
||||
; write back dims
|
||||
push r25
|
||||
push yl
|
||||
push yh
|
||||
bigcall LayoutCtx_WriteXDimsContiguous ; (r16, r18, r19, r24, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
pop r25
|
||||
|
||||
pop yh
|
||||
pop yl
|
||||
bigcall LayoutCtx_WriteXDimsContiguous ; (r16, r18, r19, r24)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
289
avr/modules/lcd2/gui2/base/mclayout.asm
Normal file
289
avr/modules/lcd2/gui2/base/mclayout.asm
Normal file
@@ -0,0 +1,289 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2026 by Martin Preuss
|
||||
; email : martin@libchipcard.de
|
||||
;
|
||||
; ***************************************************************************
|
||||
; * This file is part of the project "AqHome". *
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
#ifndef AQH_AVR_GUI2_MCLAYOUT_ASM
|
||||
#define AQH_AVR_GUI2_MCLAYOUT_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
.equ MCLAYOUT_OFFS_BEGIN = WIDGET_SIZE
|
||||
.equ MCLAYOUT_OFFS_MODE = MCLAYOUT_OFFS_BEGIN+0
|
||||
.equ MCLAYOUT_OFFS_COLUMNS = MCLAYOUT_OFFS_BEGIN+1
|
||||
.equ MCLAYOUT_SIZE = MCLAYOUT_OFFS_BEGIN+2
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MCLayout_new @global
|
||||
;
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @return Y address of newly created object
|
||||
; @param X parent widget
|
||||
; @param r16 value for OBJECT_OFFS_OPTS
|
||||
; @param r17 value for WIDGET_OFFS_PACK
|
||||
; @param r20 number of columns or rows (depending on mode in r20)
|
||||
; @clobbers any
|
||||
|
||||
MCLayout_new:
|
||||
push r20
|
||||
ldi r24, LOW(MCLAYOUT_SIZE)
|
||||
ldi r25, HIGH(MCLAYOUT_SIZE)
|
||||
bigcall Object_Alloc ; (!r16, !r17, !X)
|
||||
pop r20
|
||||
brcc MCLayout_new_ret
|
||||
rcall MCLayout_Init ; (r16, r17, X)
|
||||
sec
|
||||
MCLayout_new_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MCLayout_Init @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param X parent widget (if any)
|
||||
; @param r16 value for OBJECT_OFFS_OPTS
|
||||
; @param r17 value for WIDGET_OFFS_PACK
|
||||
; @param r20 number of columns or rows (depending on mode in r20)
|
||||
; @clobbers r16, r17, X
|
||||
|
||||
MCLayout_Init:
|
||||
push r20
|
||||
; call base class
|
||||
bigcall Widget_Init ; (r16, r17, X)
|
||||
pop r20
|
||||
|
||||
; set widget-specific data
|
||||
std Y+MCLAYOUT_OFFS_COLUMNS, r20
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(MCLayout_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(MCLayout_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MCLayout_OnGetDefaultHeight
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
MCLayout_OnGetDefaultHeight:
|
||||
; rcall Layout_SetDefaultHeights
|
||||
; rcall Layout_GetMaxTmp
|
||||
; bigcall Widget_AddOuterStyleBorders ; (r20, r21)
|
||||
ldi r18, 10
|
||||
clr r19
|
||||
sec
|
||||
ret
|
||||
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MCLayout_OnGetDefaultWidth
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
MCLayout_OnGetDefaultWidth:
|
||||
; rcall Layout_SetDefaultWidths
|
||||
; rcall Layout_SumTmpValues ; r19:r18=default width
|
||||
ldi r18, 10
|
||||
clr r19
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MCLayout_OnLayout
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
MCLayout_OnLayout:
|
||||
ldd r25, Y+MCLAYOUT_OFFS_COLUMNS
|
||||
rcall Layout_CountChildrenSkipped ; r16=number of rows used (r18, r19)
|
||||
|
||||
mov r24, r16 ; store for later
|
||||
ldd r17, Y+MCLAYOUT_OFFS_COLUMNS
|
||||
cp r16, r17
|
||||
brcc MCLayout_OnLayout_mkCtx
|
||||
mov r16, r17
|
||||
MCLayout_OnLayout_mkCtx:
|
||||
; create and preset context
|
||||
push r24 ; num of children
|
||||
rcall LayoutCtx_CreateContextForN ; X=ctx (any, !R16, !Y)
|
||||
pop r24
|
||||
brcc MCLayout_OnLayout_ret
|
||||
|
||||
push r24 ; num of children
|
||||
ldd r24, Y+MCLAYOUT_OFFS_COLUMNS
|
||||
rcall mcLayoutHorizontally
|
||||
pop r24
|
||||
rcall mcLayoutVertically
|
||||
|
||||
; release layout context
|
||||
bigcall LayoutCtx_free
|
||||
|
||||
; force re-drawing of this widget, clear layout bit
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
sbr r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||
cbr r16, (1<<WIDGET_FLAGS_LAYOUT_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
MCLayout_OnLayout_ret:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mcLayoutVertically
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param X layout context
|
||||
; @param r24 number of rows
|
||||
; @clobbers any, !X, !Y
|
||||
|
||||
mcLayoutVertically:
|
||||
; prepare
|
||||
push xl
|
||||
push xh
|
||||
push r24
|
||||
rcall Layout2_SetDefaultHeights ; (any, !Y)
|
||||
pop r24
|
||||
pop xh
|
||||
pop xl
|
||||
|
||||
ldd r20, Y+WIDGET_OFFS_HEIGHT_LO
|
||||
ldd r21, Y+WIDGET_OFFS_HEIGHT_HI
|
||||
adiw xh:xl, LAYOUT_CTX_OFFS_TOTALSIZE_LO
|
||||
st X+, r20
|
||||
st X, r21
|
||||
sbiw xh:xl, (LAYOUT_CTX_OFFS_TOTALSIZE_LO+1)
|
||||
adiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
||||
st X, r24
|
||||
sbiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
||||
|
||||
; read positions and flags into new layout context
|
||||
ldd r25, Y+MCLAYOUT_OFFS_COLUMNS
|
||||
bigcall LayoutCtx_ReadYMaxDimsVertical ; (r16-r20, Z)
|
||||
|
||||
; layout
|
||||
bigcall LayoutCtx_LayoutExpand ; (r16-r25)
|
||||
|
||||
; pack
|
||||
ldd r25, Y+MCLAYOUT_OFFS_COLUMNS
|
||||
rcall LayoutCtx_PackYVertical ; (r16, r18, r19, r24, Z)
|
||||
|
||||
|
||||
;mov zl, yl
|
||||
;mov zh, yh
|
||||
;bigcall DEBUG_DUMPWDG
|
||||
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mcLayoutHorizontally
|
||||
;
|
||||
; @param Y pointer to widget
|
||||
; @param X layout context
|
||||
; @param r24 number of items to use
|
||||
; @clobbers any, !Y
|
||||
|
||||
mcLayoutHorizontally:
|
||||
; prepare
|
||||
push xl
|
||||
push xh
|
||||
push r24
|
||||
rcall Layout2_SetDefaultWidths ; (any, !Y)
|
||||
pop r24
|
||||
pop xh
|
||||
pop xl
|
||||
|
||||
; setup layout context for horizontal operations
|
||||
ldd r20, Y+WIDGET_OFFS_WIDTH_LO
|
||||
ldd r21, Y+WIDGET_OFFS_WIDTH_HI
|
||||
adiw xh:xl, LAYOUT_CTX_OFFS_TOTALSIZE_LO
|
||||
st X+, r20
|
||||
st X, r21
|
||||
sbiw xh:xl, (LAYOUT_CTX_OFFS_TOTALSIZE_LO+1)
|
||||
adiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
||||
st X, r24
|
||||
sbiw xh:xl, LAYOUT_CTX_OFFS_NUMITEMS
|
||||
|
||||
; read positions and flags into new layout context
|
||||
ldd r25, Y+MCLAYOUT_OFFS_COLUMNS
|
||||
bigcall LayoutCtx_ReadXMaxDimsHorizontal ; (r16-r20, Z)
|
||||
|
||||
; layout
|
||||
bigcall LayoutCtx_LayoutExpand ; (r16-r25)
|
||||
|
||||
; pack
|
||||
ldd r25, Y+MCLAYOUT_OFFS_COLUMNS
|
||||
rcall LayoutCtx_PackXHorizontal ; (r16, r18, r19, r24, Z)
|
||||
|
||||
;bigjmp DEBUG_DUMPCTX ; still correct, maybe packXHorizontal doesn't set pos correctly?
|
||||
|
||||
;mov zl, yl
|
||||
;mov zh, yh
|
||||
;bigcall DEBUG_DUMPWDG
|
||||
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data in FLASH
|
||||
|
||||
MCLayout_DefaultSignalmap:
|
||||
; header
|
||||
.dw Widget_DefaultSignalmap*2 ; next table to use
|
||||
; entries
|
||||
.db 0, WIDGET_SIGNAL_LAYOUT, LOW(MCLayout_OnLayout), HIGH(MCLayout_OnLayout)
|
||||
.db WIDGET_VALUE_DEFAULT_WIDTH, WIDGET_SIGNAL_GETVALUE, LOW(MCLayout_OnGetDefaultWidth), HIGH(MCLayout_OnGetDefaultWidth)
|
||||
.db WIDGET_VALUE_DEFAULT_HEIGHT, WIDGET_SIGNAL_GETVALUE, LOW(MCLayout_OnGetDefaultHeight), HIGH(MCLayout_OnGetDefaultHeight)
|
||||
|
||||
.db 0, 0, 0, 0 ; end of table
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user