gui2: added mclayout (matrix layout ordering by column).

This commit is contained in:
Martin Preuss
2026-04-12 01:31:23 +02:00
parent 7d556c0f26
commit 66be348ecd
6 changed files with 1152 additions and 285 deletions

View File

@@ -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
bigcall LayoutCtx_ReadYDimsContiguous ; (R16, r18, r19, Z)
; 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
; layout
bigcall LayoutCtx_GetMaxSize ; r19:r18=max default size (r18, r19, r20, r21, r24)
bigcall LayoutCtx_SetFixedSize ; (r24)
adiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
ld r18, X
clr r19
sbiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
bigcall LayoutCtx_SetFixedPos ; (r24)
; 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
; pack
bigcall LayoutCtx_PackYContiguous ; (R16, r18, r19, Z)
; pack
push r25
push yl
push yh
bigcall LayoutCtx_PackYContiguous
pop yh
pop yl
pop r25
; write back dims
push r25
push yl
push yh
bigcall LayoutCtx_WriteYDimsContiguous
pop yh
pop yl
pop r25
pop yh
pop yl
; write back dims
bigcall LayoutCtx_WriteYDimsContiguous ; (R16, r18, r19, Z)
ret
; @end
; ---------------------------------------------------------------------------
; @routine hLayout2Horizontally
;
@@ -276,8 +251,6 @@ hLayout2Horizontally:
; ---------------------------------------------------------------------------
; @routine hLayout2PrepareHorizontal
;
@@ -322,51 +295,27 @@ 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
; layout
push r25
cpi r24, HLAYOUT_MODE_SPREAD
breq hLayout2ReadLayoutWriteHorizontal_spread
bigcall LayoutCtx_LayoutExpand ; (r16-r25)
rjmp hLayout2ReadLayoutWriteHorizontal_pack
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
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
; read X positions and flags into new layout context
bigcall LayoutCtx_ReadXDimsContiguous ; (R16, r18, r19, Z)
pop yh
pop yl
; layout
push r25
cpi r24, HLAYOUT_MODE_SPREAD
breq hLayout2ReadLayoutWriteHorizontal_spread
bigcall LayoutCtx_LayoutExpand ; (r16-r25)
rjmp hLayout2ReadLayoutWriteHorizontal_pack
hLayout2ReadLayoutWriteHorizontal_spread:
bigcall LayoutCtx_LayoutSpread ; (r16-r25)
hLayout2ReadLayoutWriteHorizontal_pack:
pop r25
; pack
push r25
bigcall LayoutCtx_PackXContiguous ; (r16-r21, r24, r25)
pop r25
; write back dims
bigcall LayoutCtx_WriteXDimsContiguous ; (r16, r18, r19, r24)
ret
; @end