gui2: new layout modules basically work now.

This commit is contained in:
Martin Preuss
2026-04-12 17:01:30 +02:00
parent 505910bd12
commit 710af679cb
8 changed files with 517 additions and 29 deletions

View File

@@ -67,7 +67,7 @@ HLayout2_new_ret:
; @param X parent widget (if any)
; @param r16 value for OBJECT_OFFS_OPTS
; @param r17 value for WIDGET_OFFS_PACK
; @param r20 layout mode (HLAYOUT_MODE_EXPAND, HLAYOUT_MODE_SPREAD)
; @param r20 layout mode (HLAYOUT2_MODE_EXPAND, HLAYOUT2_MODE_SPREAD)
; @clobbers r16, r17, X
HLayout2_Init:
@@ -209,6 +209,53 @@ hLayout2PrepareVertical:
; @clobbers r16-r24
hLayout2ReadLayoutWriteVertical:
; read positions and flags into new layout context
bigcall LayoutCtx_ReadYDimsContiguous ; (R16, r18, r19, Z)
; layout
adiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
ld r18, X
clr r19
sbiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
bigcall LayoutCtx_SetFixedPos ; (r24)
mov r22, r18 ; save border
bigcall LayoutCtx_GetMaxSize ; r19:r18=max default size (r18, r19, r20, r21, r24)
ldd r16, Y+WIDGET_OFFS_PACK
andi r16, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT)
cpi r16, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT)
brne vLayout2ReadLayoutWriteVertical_setSize
; use full possible width
adiw xh:xl, LAYOUT_CTX_OFFS_TOTALSIZE_LO
ld r18, X+
ld r19, X
sbiw xh:xl, (LAYOUT_CTX_OFFS_TOTALSIZE_LO+1)
clr r23
lsl r22
rol r23
sub r18, r22
sbc r19, r23
vLayout2ReadLayoutWriteVertical_setSize:
bigcall LayoutCtx_SetFixedSize ; (r24)
; pack
bigcall LayoutCtx_PackYContiguous ; (R16, r18, r19, Z)
ret
; read positions and flags into new layout context
bigcall LayoutCtx_ReadYDimsContiguous ; (R16, r18, r19, Z)
@@ -225,7 +272,7 @@ hLayout2ReadLayoutWriteVertical:
bigcall LayoutCtx_PackYContiguous ; (R16, r18, r19, Z)
; write back dims
bigcall LayoutCtx_WriteYDimsContiguous ; (R16, r18, r19, Z)
; bigcall LayoutCtx_WriteYDimsContiguous ; (R16, r18, r19, Z)
ret
; @end
@@ -289,14 +336,13 @@ hLayout2PrepareHorizontal:
; @clobbers r16-r24
hLayout2ReadLayoutWriteHorizontal:
; layout
ldd r24, Y+HLAYOUT2_OFFS_MODE
; read X positions and flags into new layout context
bigcall LayoutCtx_ReadXDimsContiguous ; (R16, r18, r19, Z)
; layout
push r25
cpi r24, HLAYOUT_MODE_SPREAD
ldd r24, Y+HLAYOUT2_OFFS_MODE
cpi r24, HLAYOUT2_MODE_SPREAD
breq hLayout2ReadLayoutWriteHorizontal_spread
bigcall LayoutCtx_LayoutExpand ; (r16-r25)
rjmp hLayout2ReadLayoutWriteHorizontal_pack
@@ -311,7 +357,7 @@ hLayout2ReadLayoutWriteHorizontal_pack:
pop r25
; write back dims
bigcall LayoutCtx_WriteXDimsContiguous ; (r16, r18, r19, r24)
; bigcall LayoutCtx_WriteXDimsContiguous ; (r16, r18, r19, r24)
ret
; @end