From 7d556c0f26e41d42cd0eba3491fb6e31b1838fab Mon Sep 17 00:00:00 2001 From: Martin Preuss Date: Fri, 10 Apr 2026 00:07:53 +0200 Subject: [PATCH] gui2: more work on preparing code sharing for all layout modules. --- avr/modules/lcd2/gui2/base/hlayout2.asm | 165 ++++++++++---- avr/modules/lcd2/gui2/base/layout2.asm | 288 ++++++++++++++++-------- 2 files changed, 314 insertions(+), 139 deletions(-) diff --git a/avr/modules/lcd2/gui2/base/hlayout2.asm b/avr/modules/lcd2/gui2/base/hlayout2.asm index 1388f9c..db91c60 100644 --- a/avr/modules/lcd2/gui2/base/hlayout2.asm +++ b/avr/modules/lcd2/gui2/base/hlayout2.asm @@ -97,27 +97,15 @@ HLayout2_Init: ; @clobbers any, !Y HLayout2_OnLayout: - ; create layout context - bigcall OBJ_CountDirectChildren ; r16=num of children (r18, r19) - tst r16 - breq HLayout2_OnLayout_ret - push r16 - bigcall LayoutCtx_new ; X=new ctx (r16, r17, r18, r19, r24, r25) - pop r16 + ; create and preset context + rcall LayoutCtx_CreateContextFor1D brcc HLayout2_OnLayout_ret - ; set borders and spacing in layout context - bigcall Widget_GetBorderAndSpacing ; (none) - adiw xh:xl, LAYOUT_CTX_OFFS_BORDERS - st X+, r23 ; store border - st X, r22 ; store spacing - sbiw xh:xl, (LAYOUT_CTX_OFFS_BORDERS+1) ; do layout mov r25, r16 rcall hLayout2Horizontally rcall hLayout2Vertically ; release layout context bigcall LayoutCtx_free - ; force re-drawing of this widget, clear layout bit ldd r16, Y+OBJECT_OFFS_FLAGS sbr r16, (1<