mlayout: works for first row now (still WIP!)
This commit is contained in:
@@ -339,19 +339,25 @@ mkTestWindow:
|
||||
|
||||
push xl ; content window
|
||||
push xh
|
||||
; rcall mkTestWidgets
|
||||
rcall mkSimpleTestWidgets
|
||||
rcall mkTestWidgets
|
||||
; rcall mkSimpleTestWidgets
|
||||
pop xh
|
||||
pop xl
|
||||
mkTestWindow_popRet:
|
||||
pop yh
|
||||
pop yl
|
||||
|
||||
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
|
||||
|
||||
mkTestWindow_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mkTestWidgets
|
||||
;
|
||||
@@ -400,6 +406,82 @@ mkTestWidgets_popRet:
|
||||
mkTestWidgets_ret:
|
||||
ret
|
||||
; @end
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @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_COLUMNS
|
||||
ldi r21, 2
|
||||
bigcall MLayout_new
|
||||
brcc mkTestWidgets_ret
|
||||
|
||||
push yl
|
||||
push yh
|
||||
mov xl, yl ; use HLayout as parent
|
||||
mov xh, yh
|
||||
|
||||
push xl ; MLayout
|
||||
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_HUMIDITY)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_HUMIDITY)
|
||||
bigcall ImageView_new
|
||||
pop xh
|
||||
pop xl
|
||||
brcc mkTestWidgets_popRet
|
||||
|
||||
push xl ; MLayout
|
||||
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_CLOUD)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_CLOUD)
|
||||
bigcall ImageView_new
|
||||
pop xh
|
||||
pop xl
|
||||
brcc mkTestWidgets_popRet
|
||||
|
||||
#if 0
|
||||
push xl ; MLayout
|
||||
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_HUMIDITY)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_HUMIDITY)
|
||||
bigcall ImageView_new
|
||||
pop xh
|
||||
pop xl
|
||||
brcc mkTestWidgets_popRet
|
||||
|
||||
push xl ; MLayout
|
||||
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_LIGHT)
|
||||
ldi r21, HIGH(RESSSOURCE_IMG_LIGHT)
|
||||
bigcall ImageView_new
|
||||
pop xh
|
||||
pop xl
|
||||
brcc mkTestWidgets_popRet
|
||||
#endif
|
||||
|
||||
mkTestWidgets_popRet:
|
||||
pop yh
|
||||
pop yl
|
||||
mkTestWidgets_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
@@ -433,6 +515,8 @@ mkSimpleTestWidgets_ret:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; includes
|
||||
|
||||
@@ -470,7 +554,8 @@ GUI2_MODULE_BEGIN:
|
||||
.include "modules/lcd2/gui2/base/layout.asm"
|
||||
.include "modules/lcd2/gui2/base/hlayout.asm"
|
||||
.include "modules/lcd2/gui2/base/vlayout.asm"
|
||||
.include "modules/lcd2/gui2/base/mlayout2.asm"
|
||||
.include "modules/lcd2/gui2/base/mlayout.asm"
|
||||
.include "modules/lcd2/gui2/base/mlayout_column.asm"
|
||||
.include "modules/lcd2/gui2/base/guiapp.asm"
|
||||
.include "modules/lcd2/gui2/base/mainwindow.asm"
|
||||
.include "modules/lcd2/gui2/base/rootwindow.asm"
|
||||
|
||||
1402
avr/modules/lcd2/gui2/base/mlayout-old.asm
Normal file
1402
avr/modules/lcd2/gui2/base/mlayout-old.asm
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
516
avr/modules/lcd2/gui2/base/mlayout_column.asm
Normal file
516
avr/modules/lcd2/gui2/base/mlayout_column.asm
Normal file
@@ -0,0 +1,516 @@
|
||||
; ***************************************************************************
|
||||
; 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_MLAYOUT_COLUMN_ASM
|
||||
#define AQH_AVR_GUI2_MLAYOUT_COLUMN_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MLayout_LayoutColumnMode @global
|
||||
;
|
||||
; @param Y widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
MLayout_Layout_ColumnMode:
|
||||
rcall mLayoutColumnLayoutHorizontally
|
||||
; rcall mLayoutColumnLayoutVertically
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MLayout_OnGetDefaultWidth_ColumnMode @global
|
||||
;
|
||||
; @param Y widget
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
MLayout_OnGetDefaultWidth_ColumnMode:
|
||||
; DEBUG
|
||||
ldi r18, 10
|
||||
clr r19
|
||||
sec
|
||||
ret
|
||||
|
||||
rcall mLayoutSetDefaultWidthToTmp ; (any, !Y)
|
||||
rcall mLayoutGetBorders ; r22=spacing, r23=border
|
||||
push yl
|
||||
push yh
|
||||
rcall MLayout_GetFirstChildToY
|
||||
rcall mLayoutSumContiguous ; r21:r20 needed minimum row width (r18, r19, r25)
|
||||
pop yh
|
||||
pop yl
|
||||
mov r18, r20
|
||||
mov r19, r21
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MLayout_OnGetDefaultHeight_ColumnMode @global
|
||||
;
|
||||
; @param Y widget
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
MLayout_OnGetDefaultHeight_ColumnMode:
|
||||
; DEBUG
|
||||
ldi r18, 10
|
||||
clr r19
|
||||
sec
|
||||
ret
|
||||
|
||||
bigcall OBJ_GetFirstChild
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
rcall mLayoutSetDefaultHeightToTmp ; (any, !Y)
|
||||
rcall mLayoutGetBorders ; r22=spacing, r23=border
|
||||
rcall mLayoutSumSkipped ; r21:r20 needed minimum row width (r18, r19, r25)
|
||||
mov r18, r20
|
||||
mov r19, r21
|
||||
pop yh
|
||||
pop yl
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnLayoutHorizontally
|
||||
;
|
||||
; @param Y widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
mLayoutColumnLayoutHorizontally:
|
||||
rcall mLayoutGetBorders ; r22=spacing, r23=border
|
||||
ldd r25, Y+MLAYOUT_OFFS_COLSORROWS
|
||||
|
||||
push yl
|
||||
push yh
|
||||
rcall MLayout_GetFirstChildToY ; (none)
|
||||
push r22
|
||||
push r23
|
||||
push r25
|
||||
clr r25
|
||||
rcall mLayoutSetDefaultWidthToTmp ; (any, !Y)
|
||||
clr r25
|
||||
rcall mLayoutCopyTmpToWidth ; (r18, r19, Z)
|
||||
pop r25
|
||||
pop r23
|
||||
pop r22
|
||||
|
||||
; prepare first row
|
||||
rcall mLayoutSetupFirstContiguous ; set max column widths to first row (r18, r19, Z)
|
||||
|
||||
; possibly distribute free space to expandable columns
|
||||
push r22 ; spacing
|
||||
push r23 ; border
|
||||
; rcall mLayoutColumnExpandColumns ; (r16-r23, r25)
|
||||
pop r23
|
||||
pop r22
|
||||
|
||||
; rcall mLayoutColumnCopyTmpFromFirstRow ; copy TMP of every column from first row to following (r18-r21, Z)
|
||||
push r25
|
||||
clr r25
|
||||
rcall mLayoutColumnPositionX ; (r12, r13, r16-r21, X)
|
||||
pop r25
|
||||
pop yl
|
||||
pop yh
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
mLayoutColumnLayoutVertically:
|
||||
rcall mLayoutGetBorders ; r22=spacing, r23=border
|
||||
ldd r25, Y+MLAYOUT_OFFS_COLSORROWS
|
||||
|
||||
push yl
|
||||
push yh
|
||||
rcall MLayout_GetFirstChildToY ; (none)
|
||||
push r22
|
||||
push r23
|
||||
push r25
|
||||
rcall mLayoutSetDefaultHeightToTmp ; (any, !Y)
|
||||
pop r25
|
||||
rcall mLayoutCopyTmpToHeight ; (r18, r19, Z)
|
||||
pop r23
|
||||
pop r22
|
||||
|
||||
; prepare first column
|
||||
rcall mLayoutSetupFirstSkipped ; set max column widths to first column (r18, r19, Z)
|
||||
|
||||
; possibly distribute free space to expandable columns
|
||||
push r22 ; spacing
|
||||
push r23 ; border
|
||||
; rcall mLayoutColumnExpandRows ; (r16-r23)
|
||||
pop r23
|
||||
pop r22
|
||||
|
||||
rcall mLayoutColumnCopyTmpFromFirstColumn ; copy TMP of every column from first row to following (r18-r21, Z)
|
||||
|
||||
rcall mLayoutColumnPositionY ; (r12, r13, r16-r21, X)
|
||||
|
||||
pop yl
|
||||
pop yh
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnCopyTmpFromFirstRow
|
||||
;
|
||||
; @param Y widget
|
||||
; @param R25 widgets per row/column
|
||||
; @clobbers r18-r21, Z
|
||||
|
||||
mLayoutColumnCopyTmpFromFirstRow:
|
||||
push yl
|
||||
push yh
|
||||
ldi zl, LOW(mLayoutCallbackColumnCopyRow)
|
||||
ldi zh, HIGH(mLayoutCallbackColumnCopyRow)
|
||||
rcall mLayoutForEveryObjectContiguous ; (r18-r21, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutCallbackColumnCopyRow
|
||||
;
|
||||
; @param Y widget
|
||||
; @clobbers r18, r19, r20, r21, r25
|
||||
|
||||
mLayoutCallbackColumnCopyRow:
|
||||
push zl
|
||||
push zh
|
||||
rcall mLayoutColumnCopyTmpAcrossColumn ; (r18, r19, r20, r21, Z)
|
||||
pop zh
|
||||
pop zl
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnCopyTmpAcrossColumn
|
||||
;
|
||||
; @param Y widget
|
||||
; @param R25 widgets per row/column
|
||||
; @clobbers r18, r19, r20, r21, Z
|
||||
|
||||
mLayoutColumnCopyTmpAcrossColumn:
|
||||
push yl
|
||||
push yh
|
||||
ldd r20, Y+WIDGET_OFFS_TMP_LO
|
||||
ldd r21, Y+WIDGET_OFFS_TMP_HI
|
||||
ldi zl, LOW(mLayoutCallbackSetTmp)
|
||||
ldi zh, HIGH(mLayoutCallbackSetTmp)
|
||||
rcall mLayoutForEveryObjectSkipped ; (r18, r19, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnCopyTmpFromFirstColumn
|
||||
;
|
||||
; @param Y widget
|
||||
; @param R25 widgets per row/column
|
||||
; @clobbers r18-r21, Z
|
||||
|
||||
mLayoutColumnCopyTmpFromFirstColumn:
|
||||
push yl
|
||||
push yh
|
||||
ldi zl, LOW(mLayoutCallbackColumnCopyColumn)
|
||||
ldi zh, HIGH(mLayoutCallbackColumnCopyColumn)
|
||||
rcall mLayoutForEveryObjectSkipped ; (r18-r21, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutCallbackColumnCopyColumn
|
||||
;
|
||||
; @param Y widget
|
||||
; @param R25 widgets per row/column
|
||||
; @clobbers r18, r19, r20, r21
|
||||
|
||||
mLayoutCallbackColumnCopyColumn:
|
||||
push zl
|
||||
push zh
|
||||
rcall mLayoutColumnCopyTmpAcrossRow ; (r18, r19, r20, r21, Z)
|
||||
pop zh
|
||||
pop zl
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnCopyTmpAcrossRow
|
||||
;
|
||||
; @param Y widget
|
||||
; @param R25 widgets per row/column
|
||||
; @clobbers r18, r19, r20, r21, Z
|
||||
|
||||
mLayoutColumnCopyTmpAcrossRow:
|
||||
push yl
|
||||
push yh
|
||||
ldd r20, Y+WIDGET_OFFS_TMP_LO
|
||||
ldd r21, Y+WIDGET_OFFS_TMP_HI
|
||||
ldi zl, LOW(mLayoutCallbackSetTmp)
|
||||
ldi zh, HIGH(mLayoutCallbackSetTmp)
|
||||
rcall mLayoutForEveryObjectContiguous ; (r18, r19, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnPositionX
|
||||
;
|
||||
; Set X and width to all columns of the row
|
||||
;
|
||||
; @param Y first widget of current row
|
||||
; @param r22 spacing between widgets
|
||||
; @param r23 border at beginning and and
|
||||
; @param R25 widgets per row/column
|
||||
; @clobbers r12, r13, r16-r21, X
|
||||
|
||||
mLayoutColumnPositionX:
|
||||
mov xl, r23 ; start at border
|
||||
clr xh
|
||||
push yl
|
||||
push yh
|
||||
ldi zl, LOW(mLayoutCallbackPositionX)
|
||||
ldi zh, HIGH(mLayoutCallbackPositionX)
|
||||
rcall mLayoutForEveryObjectContiguous ; (r12, r13, r16-r21, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnPositionY
|
||||
;
|
||||
; Set X and width to all columns of the row
|
||||
;
|
||||
; @param Y first widget of current row
|
||||
; @param r22 spacing between widgets
|
||||
; @param r23 border at beginning and end
|
||||
; @param R25 widgets per row/column
|
||||
; @clobbers r12, r13, r16-r21, X
|
||||
|
||||
mLayoutColumnPositionY:
|
||||
mov xl, r23 ; start at border
|
||||
clr xh
|
||||
push yl
|
||||
push yh
|
||||
ldi zl, LOW(mLayoutCallbackPositionY)
|
||||
ldi zh, HIGH(mLayoutCallbackPositionY)
|
||||
rcall mLayoutForEveryObjectSkipped ; (r12, r13, r16-r21, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnExpandColumns
|
||||
;
|
||||
; Calculate additional space per expandable widget in a row.
|
||||
;
|
||||
; @param Y first widget of current row
|
||||
; @param R25 widgets per row/column
|
||||
; @return CFLAG set if there is additional space to distribute
|
||||
; @return r21:r20 space to add to every expandable widget
|
||||
; @clobbers r16-r23
|
||||
|
||||
mLayoutColumnExpandColumns:
|
||||
rcall mLayoutColumnCalcAddSpacePerColumn ; r21:r20=additional space (r16-r23)
|
||||
brcc mLayoutColumnExpandColumns_ret
|
||||
|
||||
ldi r22, (1<<WIDGET_PACK_HSELF1_BIT) | (1<<WIDGET_PACK_HSELF0_BIT) ; mask
|
||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) ; value
|
||||
rcall mLayoutExpandChildrenMatchingPackContiguous ; (r18, r19)
|
||||
|
||||
mLayoutColumnExpandColumns_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnCalcAddSpacePerColumn
|
||||
;
|
||||
; Calculate additional space per expandable widget in a row.
|
||||
;
|
||||
; @param Y first widget of current row
|
||||
; @return CFLAG set if there is additional space to distribute
|
||||
; @return r21:r20 space to add to every expandable widget
|
||||
; @param r22 spacing between widgets
|
||||
; @param r23 border at beginning and and
|
||||
; @param r25 widgets per row/column
|
||||
; @clobbers r16-r23
|
||||
|
||||
mLayoutColumnCalcAddSpacePerColumn:
|
||||
rcall mLayoutSumContiguous ; r21:r20 needed minimum row width (r18, r19)
|
||||
ldd r18, Y+WIDGET_OFFS_WIDTH_LO
|
||||
ldd r19, Y+WIDGET_OFFS_WIDTH_HI
|
||||
sub r18, r20
|
||||
sbc r19, r21
|
||||
brcc mLayoutColumnCalcAddSpacePerElement_none
|
||||
breq mLayoutColumnCalcAddSpacePerElement_none
|
||||
; r19:r18=space to distribute
|
||||
push r18
|
||||
push r19
|
||||
ldi r22, (1<<WIDGET_PACK_HSELF1_BIT) | (1<<WIDGET_PACK_HSELF0_BIT) ; mask
|
||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) ; value
|
||||
rcall mLayoutCountChildrenMatchingPackContiguous ; r20=num of matching children (r18, r19, r25)
|
||||
pop r19
|
||||
pop r18
|
||||
tst r20
|
||||
breq mLayoutColumnCalcAddSpacePerElement_none ; don't divide by zero!
|
||||
mov r22, r20
|
||||
clr r23
|
||||
mov r20, r18
|
||||
mov r21, r19
|
||||
push r25
|
||||
bigcall Utils_Divu16_16_16 ; r17:r16=space per expandable widget (r25)
|
||||
pop r25
|
||||
mov r20, r16
|
||||
mov r21, r17
|
||||
sec
|
||||
rjmp mLayoutColumnCalcAddSpacePerElement_ret
|
||||
mLayoutColumnCalcAddSpacePerElement_none:
|
||||
clr r20
|
||||
clr r21
|
||||
clc
|
||||
mLayoutColumnCalcAddSpacePerElement_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnExpandRows
|
||||
;
|
||||
; Calculate additional space per expandable widget in a column.
|
||||
;
|
||||
; @param Y first widget of current row
|
||||
; @param r25 widgets per row/column
|
||||
; @return CFLAG set if there is additional space to distribute
|
||||
; @return r21:r20 space to add to every expandable widget
|
||||
; @clobbers r16-r23
|
||||
|
||||
mLayoutColumnExpandRows:
|
||||
rcall mLayoutColumnCalcAddSpacePerRow ; r21:r20=additional space (r16-r23)
|
||||
brcc mLayoutColumnExpandRows_ret
|
||||
|
||||
ldi r22, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT) ; mask
|
||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; value
|
||||
rcall mLayoutExpandChildrenMatchingPackSkipped ; (r18, r19)
|
||||
|
||||
mLayoutColumnExpandRows_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mLayoutColumnCalcAddSpacePerRow
|
||||
;
|
||||
; Calculate additional space per expandable widget in a row.
|
||||
;
|
||||
; @param Y first widget of current row
|
||||
; @return CFLAG set if there is additional space to distribute
|
||||
; @return r21:r20 space to add to every expandable widget
|
||||
; @param r22 spacing between widgets
|
||||
; @param r23 border at beginning and and
|
||||
; @param r25 widgets per row/column
|
||||
; @clobbers r16-r23
|
||||
|
||||
mLayoutColumnCalcAddSpacePerRow:
|
||||
rcall mLayoutSumSkipped ; r21:r20 needed minimum row width (r18, r19)
|
||||
ldd r18, Y+WIDGET_OFFS_HEIGHT_LO
|
||||
ldd r19, Y+WIDGET_OFFS_HEIGHT_HI
|
||||
sub r18, r20
|
||||
sbc r19, r21
|
||||
brcc mLayoutColumnCalcAddSpacePerRow_none
|
||||
breq mLayoutColumnCalcAddSpacePerRow_none
|
||||
; r19:r18=space to distribute
|
||||
push r18
|
||||
push r19
|
||||
ldi r22, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT) ; mask
|
||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; value
|
||||
rcall mLayoutCountChildrenMatchingPackSkipped ; r20=num of matching children (r18, r19)
|
||||
pop r19
|
||||
pop r18
|
||||
tst r20
|
||||
breq mLayoutColumnCalcAddSpacePerRow_none ; don't divide by zero!
|
||||
mov r22, r20
|
||||
clr r23
|
||||
mov r20, r18
|
||||
mov r21, r19
|
||||
push r25
|
||||
bigcall Utils_Divu16_16_16 ; r17:r16=space per expandable widget
|
||||
pop r25
|
||||
mov r20, r16
|
||||
mov r21, r17
|
||||
sec
|
||||
rjmp mLayoutColumnCalcAddSpacePerRow_ret
|
||||
mLayoutColumnCalcAddSpacePerRow_none:
|
||||
clr r20
|
||||
clr r21
|
||||
clc
|
||||
mLayoutColumnCalcAddSpacePerRow_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user