gui2: mlayout works now (in column mode)!
This commit is contained in:
@@ -383,7 +383,7 @@ mkTestWidgets:
|
|||||||
push xl ; MLayout
|
push xl ; MLayout
|
||||||
push xh
|
push xh
|
||||||
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
|
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
|
||||||
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||||
ldi r20, LOW(RESSSOURCE_TXT_KITCHEN)
|
ldi r20, LOW(RESSSOURCE_TXT_KITCHEN)
|
||||||
ldi r21, HIGH(RESSSOURCE_TXT_KITCHEN)
|
ldi r21, HIGH(RESSSOURCE_TXT_KITCHEN)
|
||||||
bigcall Label_new
|
bigcall Label_new
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ mLayoutCallbackGridX:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutCallbackGridX
|
; @routine mLayoutCallbackPackX
|
||||||
;
|
;
|
||||||
; @param Y widget
|
; @param Y widget
|
||||||
; @param r22 spacing between widgets
|
; @param r22 spacing between widgets
|
||||||
@@ -328,6 +328,60 @@ mLayoutCallbackPackX:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine mLayoutCallbackGridY
|
||||||
|
;
|
||||||
|
; @param Y widget
|
||||||
|
; @param r22 spacing between widgets
|
||||||
|
; @param X current Y pos
|
||||||
|
; @clobbers r10-r13, r16-r21
|
||||||
|
|
||||||
|
mLayoutCallbackGridY:
|
||||||
|
ldd r20, Y+WIDGET_OFFS_TMP_LO
|
||||||
|
ldd r21, Y+WIDGET_OFFS_TMP_HI
|
||||||
|
std Y+WIDGET_OFFS_Y_LO, xl ; set new Y
|
||||||
|
std Y+WIDGET_OFFS_Y_HI, xh
|
||||||
|
add xl, r20 ; add cell width
|
||||||
|
adc xh, r21
|
||||||
|
add xl, r22 ; add spacing
|
||||||
|
adc xh, r22
|
||||||
|
sub xh, r22
|
||||||
|
clc
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine mLayoutCallbackPackY
|
||||||
|
;
|
||||||
|
; @param Y widget
|
||||||
|
; @param r22 spacing between widgets
|
||||||
|
; @clobbers r10-r13, r16-r21, X
|
||||||
|
|
||||||
|
mLayoutCallbackPackY:
|
||||||
|
ldd r10, Y+WIDGET_OFFS_TMP_LO ; calculated cell width
|
||||||
|
ldd r11, Y+WIDGET_OFFS_TMP_HI
|
||||||
|
ldd r12, Y+WIDGET_OFFS_HEIGHT_LO ; default width
|
||||||
|
ldd r13, Y+WIDGET_OFFS_HEIGHT_HI
|
||||||
|
ldd r17, Y+WIDGET_OFFS_PACK
|
||||||
|
lsr r17 ; WIDGET_PACK_VSELF0_BIT = 2 -> shift 2 times right
|
||||||
|
lsr r17
|
||||||
|
andi r17, 3
|
||||||
|
rcall mLayoutPackCell ; R21:R20=relative pos, R19:R18=new size (r16, r17, r18, r19)
|
||||||
|
ldd xl, Y+WIDGET_OFFS_Y_LO
|
||||||
|
ldd xh, Y+WIDGET_OFFS_Y_HI
|
||||||
|
add xl, r20
|
||||||
|
adc xh, r21
|
||||||
|
std Y+WIDGET_OFFS_Y_LO, xl
|
||||||
|
std Y+WIDGET_OFFS_Y_HI, xh
|
||||||
|
std Y+WIDGET_OFFS_HEIGHT_LO, r18
|
||||||
|
std Y+WIDGET_OFFS_HEIGHT_HI, r19
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutCallbackPositionY
|
; @routine mLayoutCallbackPositionY
|
||||||
@@ -347,37 +401,6 @@ add xl, r20
|
|||||||
adc xh, r21
|
adc xh, r21
|
||||||
clc
|
clc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
|
||||||
sbrs r16, WIDGET_FLAGS_VISIBLE_BIT
|
|
||||||
rjmp mLayoutCallbackPositionY_ret
|
|
||||||
ldd r10, Y+WIDGET_OFFS_TMP_LO ; calculated cell width
|
|
||||||
ldd r11, Y+WIDGET_OFFS_TMP_HI
|
|
||||||
ldd r12, Y+WIDGET_OFFS_HEIGHT_LO ; default height
|
|
||||||
ldd r13, Y+WIDGET_OFFS_HEIGHT_HI
|
|
||||||
ldd r17, Y+WIDGET_OFFS_PACK
|
|
||||||
lsr r17 ; WIDGET_PACK_VSELF0_BIT = 2 -> shift 2 times right
|
|
||||||
lsr r17
|
|
||||||
andi r17, 3
|
|
||||||
push r18
|
|
||||||
push r19
|
|
||||||
rcall mLayoutPackCell ; R21:R20=relative pos (r16, r17, r18, r19)
|
|
||||||
pop r19
|
|
||||||
pop r18
|
|
||||||
add r20, xl
|
|
||||||
adc r21, xh
|
|
||||||
std Y+WIDGET_OFFS_Y_LO, r20 ; set new Y
|
|
||||||
std Y+WIDGET_OFFS_Y_HI, r21
|
|
||||||
; std Y+WIDGET_OFFS_HEIGHT_LO, r12 ; set new height
|
|
||||||
; std Y+WIDGET_OFFS_HEIGHT_HI, r13
|
|
||||||
add xl, r18 ; advance Y
|
|
||||||
adc xh, r19
|
|
||||||
add xl, r22 ; add spacing
|
|
||||||
adc xh, r22
|
|
||||||
sub xh, r22
|
|
||||||
mLayoutCallbackPositionY_ret:
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -128,20 +128,10 @@ mLayoutColumnLayoutHorizontally:
|
|||||||
|
|
||||||
; prepare first row
|
; prepare first row
|
||||||
rcall mLayoutSetupFirstContiguous ; set max column widths to first row (r18, r19, Z)
|
rcall mLayoutSetupFirstContiguous ; set max column widths to first row (r18, r19, Z)
|
||||||
|
rcall mLayoutColumnExpandColumns ; (r16-r23)
|
||||||
; possibly distribute free space to expandable columns
|
|
||||||
push r22 ; spacing
|
|
||||||
push r23 ; border
|
|
||||||
rcall mLayoutColumnExpandColumns ; (r16-r23)
|
|
||||||
pop r23
|
|
||||||
pop r22
|
|
||||||
|
|
||||||
rcall mLayoutColumnGridX
|
rcall mLayoutColumnGridX
|
||||||
rcall mLayoutColumnCopyXTmpFromFirstRow
|
rcall mLayoutColumnCopyXTmpFromFirstRow
|
||||||
push r25
|
rcall mLayoutColumnPackX ; (r10-r13, r16-r21, X)
|
||||||
clr r25
|
|
||||||
rcall mLayoutColumnPackX ; (r10-r13, r16-r21, X)
|
|
||||||
pop r25
|
|
||||||
|
|
||||||
pop yh
|
pop yh
|
||||||
pop yl
|
pop yl
|
||||||
@@ -168,22 +158,12 @@ mLayoutColumnLayoutVertically:
|
|||||||
pop r23
|
pop r23
|
||||||
pop r22
|
pop r22
|
||||||
|
|
||||||
; prepare first column
|
rcall mLayoutSetupFirstSkipped ; set max column heights to first column (r18, r19, Z)
|
||||||
rcall mLayoutSetupFirstSkipped ; set max column heights to first column (r18, r19, Z)
|
rcall mLayoutColumnExpandRows ; (r16-r23)
|
||||||
|
rcall mLayoutColumnGridY
|
||||||
; possibly distribute free space to expandable columns
|
|
||||||
push r22 ; spacing
|
|
||||||
push r23 ; border
|
|
||||||
; rcall mLayoutColumnExpandRows ; (r16-r23)
|
|
||||||
pop r23
|
|
||||||
pop r22
|
|
||||||
|
|
||||||
rcall mLayoutColumnPositionY
|
|
||||||
rcall mLayoutColumnCopyTmpFromFirstColumn
|
rcall mLayoutColumnCopyTmpFromFirstColumn
|
||||||
|
rcall mLayoutColumnPackY ; (r10-r13, r16-r21, X)
|
||||||
|
|
||||||
; rcall mLayoutColumnCopyTmpFromFirstColumn ; copy TMP of every column from first row to following (r18-r21, Z)
|
|
||||||
; rcall mLayoutColumnPositionAllY ; (r12, r13, r16-r21, Y)
|
|
||||||
|
|
||||||
pop yh
|
pop yh
|
||||||
pop yl
|
pop yl
|
||||||
ret
|
ret
|
||||||
@@ -310,54 +290,6 @@ mLayoutColumnCopyYTmpAcrossRow:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
; @routine mLayoutColumnPositionAllX
|
|
||||||
;
|
|
||||||
; 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
|
|
||||||
|
|
||||||
mLayoutColumnPositionAllX:
|
|
||||||
mov xl, r23 ; start at border
|
|
||||||
clr xh
|
|
||||||
push yl
|
|
||||||
push yh
|
|
||||||
ldi zl, LOW(mLayoutCallbackColumnPositionXRow)
|
|
||||||
ldi zh, HIGH(mLayoutCallbackColumnPositionXRow)
|
|
||||||
rcall mLayoutForEveryObjectSkipped ; (r12, r13, r16-r21, Y)
|
|
||||||
pop yh
|
|
||||||
pop yl
|
|
||||||
ret
|
|
||||||
; @end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
; @routine mLayoutCallbackColumnPositionXRow
|
|
||||||
;
|
|
||||||
; @param Y widget
|
|
||||||
; @clobbers r12, r13, r16-r21, X
|
|
||||||
|
|
||||||
mLayoutCallbackColumnPositionXRow:
|
|
||||||
push yl
|
|
||||||
push yh
|
|
||||||
push zl
|
|
||||||
push zh
|
|
||||||
rcall mLayoutColumnGridX ; (r12, r13, r16-r21, X, Z)
|
|
||||||
pop zh
|
|
||||||
pop zl
|
|
||||||
pop yh
|
|
||||||
pop yl
|
|
||||||
clc
|
|
||||||
ret
|
|
||||||
; @end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutColumnGridX
|
; @routine mLayoutColumnGridX
|
||||||
;
|
;
|
||||||
@@ -396,77 +328,34 @@ mLayoutColumnGridX:
|
|||||||
; @clobbers r10-r13, r16-r21, X
|
; @clobbers r10-r13, r16-r21, X
|
||||||
|
|
||||||
mLayoutColumnPackX:
|
mLayoutColumnPackX:
|
||||||
M_MLAYOUT_FOREVERY_CONT mLayoutCallbackPackX ; (r10-r13, r16-r21, X)
|
push r25
|
||||||
|
clr r25
|
||||||
|
M_MLAYOUT_FOREVERY_CONT mLayoutCallbackPackX ; (r10-r13, r16-r21, X)
|
||||||
|
pop r25
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutColumnPositionAllY
|
; @routine mLayoutColumnGridY
|
||||||
;
|
;
|
||||||
; Set Y and height to all columns of the row
|
; Set Y and height to all rows of a column
|
||||||
;
|
;
|
||||||
; @param Y first widget of current row
|
; @param Y first widget of current row
|
||||||
; @param r22 spacing between widgets
|
; @param r22 spacing between widgets
|
||||||
; @param r23 border at beginning and and
|
; @param r23 border at beginning and and
|
||||||
; @param R25 widgets per row/column
|
; @param R25 widgets per row/column
|
||||||
; @clobbers r12, r13, r16-r21, Y, Z
|
|
||||||
|
|
||||||
mLayoutColumnPositionAllY:
|
|
||||||
push yl
|
|
||||||
push yh
|
|
||||||
ldi zl, LOW(mLayoutCallbackColumnPositionYColumn)
|
|
||||||
ldi zh, HIGH(mLayoutCallbackColumnPositionYColumn)
|
|
||||||
rcall mLayoutForEveryObjectContiguous ; (r12, r13, r16-r21, Y)
|
|
||||||
pop yh
|
|
||||||
pop yl
|
|
||||||
ret
|
|
||||||
; @end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
|
||||||
; @routine mLayoutCallbackColumnPositionYColumn
|
|
||||||
;
|
|
||||||
; @param Y widget
|
|
||||||
; @clobbers r12, r13, r16-r21, Y
|
|
||||||
|
|
||||||
mLayoutCallbackColumnPositionYColumn:
|
|
||||||
push yl
|
|
||||||
push yh
|
|
||||||
push zl
|
|
||||||
push zh
|
|
||||||
rcall mLayoutColumnPositionY ; (r12, r13, r16-r21, X, Z)
|
|
||||||
pop zh
|
|
||||||
pop zl
|
|
||||||
pop yh
|
|
||||||
pop yl
|
|
||||||
clc
|
|
||||||
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, Z
|
; @clobbers r12, r13, r16-r21, X, Z
|
||||||
|
|
||||||
mLayoutColumnPositionY:
|
mLayoutColumnGridY:
|
||||||
mov xl, r23 ; start at border
|
mov xl, r23 ; start at border
|
||||||
clr xh
|
clr xh
|
||||||
push yl
|
push yl
|
||||||
push yh
|
push yh
|
||||||
ldi zl, LOW(mLayoutCallbackPositionY)
|
ldi zl, LOW(mLayoutCallbackGridY)
|
||||||
ldi zh, HIGH(mLayoutCallbackPositionY)
|
ldi zh, HIGH(mLayoutCallbackGridY)
|
||||||
rcall mLayoutForEveryObjectSkipped ; (r12, r13, r16-r21, Y)
|
rcall mLayoutForEveryObjectSkipped ; (r12, r13, r16-r21, Y)
|
||||||
pop yh
|
pop yh
|
||||||
pop yl
|
pop yl
|
||||||
ret
|
ret
|
||||||
@@ -474,6 +363,26 @@ mLayoutColumnPositionY:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine mLayoutColumnPackY
|
||||||
|
;
|
||||||
|
; Pack each widget inside its cell.
|
||||||
|
;
|
||||||
|
; @param Y first widget of current row
|
||||||
|
; @param r22 spacing between widgets
|
||||||
|
; @param r23 border at beginning and and
|
||||||
|
; @clobbers r10-r13, r16-r21, X
|
||||||
|
|
||||||
|
mLayoutColumnPackY:
|
||||||
|
push r25
|
||||||
|
clr r25
|
||||||
|
M_MLAYOUT_FOREVERY_CONT mLayoutCallbackPackY ; (r10-r13, r16-r21, X)
|
||||||
|
pop r25
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutColumnExpandColumns
|
; @routine mLayoutColumnExpandColumns
|
||||||
;
|
;
|
||||||
@@ -530,8 +439,8 @@ mLayoutColumnExpandColumns_ret:
|
|||||||
mLayoutColumnCalcAddSpacePerColumn:
|
mLayoutColumnCalcAddSpacePerColumn:
|
||||||
push r22
|
push r22
|
||||||
push r23
|
push r23
|
||||||
rcall mLayoutColumnCalcAdditionalSpace ; r21:r20=additional space (R18, R19)
|
rcall mLayoutColumnCalcAdditionalSpaceContiguous ; r21:r20=additional space (R18, R19)
|
||||||
brcc mLayoutColumnCalcAddSpacePerElement_ret
|
brcc mLayoutColumnCalcAddSpacePerColumn_ret
|
||||||
push r20
|
push r20
|
||||||
push r21
|
push r21
|
||||||
ldi r22, (1<<WIDGET_PACK_HSELF1_BIT) | (1<<WIDGET_PACK_HSELF0_BIT) ; mask
|
ldi r22, (1<<WIDGET_PACK_HSELF1_BIT) | (1<<WIDGET_PACK_HSELF0_BIT) ; mask
|
||||||
@@ -542,7 +451,7 @@ mLayoutColumnCalcAddSpacePerColumn:
|
|||||||
pop r21
|
pop r21
|
||||||
pop r20
|
pop r20
|
||||||
tst r22
|
tst r22
|
||||||
breq mLayoutColumnCalcAddSpacePerElement_none ; don't divide by zero!
|
breq mLayoutColumnCalcAddSpacePerColumn_none ; don't divide by zero!
|
||||||
|
|
||||||
push r25
|
push r25
|
||||||
bigcall Utils_Divu16_16_16 ; r17:r16=space per expandable widget (r25)
|
bigcall Utils_Divu16_16_16 ; r17:r16=space per expandable widget (r25)
|
||||||
@@ -550,12 +459,12 @@ mLayoutColumnCalcAddSpacePerColumn:
|
|||||||
mov r20, r16
|
mov r20, r16
|
||||||
mov r21, r17
|
mov r21, r17
|
||||||
sec
|
sec
|
||||||
rjmp mLayoutColumnCalcAddSpacePerElement_ret
|
rjmp mLayoutColumnCalcAddSpacePerColumn_ret
|
||||||
mLayoutColumnCalcAddSpacePerElement_none:
|
mLayoutColumnCalcAddSpacePerColumn_none:
|
||||||
clr r20
|
clr r20
|
||||||
clr r21
|
clr r21
|
||||||
clc
|
clc
|
||||||
mLayoutColumnCalcAddSpacePerElement_ret:
|
mLayoutColumnCalcAddSpacePerColumn_ret:
|
||||||
pop r23
|
pop r23
|
||||||
pop r22
|
pop r22
|
||||||
ret
|
ret
|
||||||
@@ -564,7 +473,7 @@ mLayoutColumnCalcAddSpacePerElement_ret:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutColumnCalcAdditionalSpace
|
; @routine mLayoutColumnCalcAdditionalSpaceContiguous
|
||||||
;
|
;
|
||||||
; Calculate additional space in a row.
|
; Calculate additional space in a row.
|
||||||
;
|
;
|
||||||
@@ -577,7 +486,7 @@ mLayoutColumnCalcAddSpacePerElement_ret:
|
|||||||
; @return r21:r20 available additional space
|
; @return r21:r20 available additional space
|
||||||
; @clobbers r18, r19
|
; @clobbers r18, r19
|
||||||
|
|
||||||
mLayoutColumnCalcAdditionalSpace:
|
mLayoutColumnCalcAdditionalSpaceContiguous:
|
||||||
push r18
|
push r18
|
||||||
push r19
|
push r19
|
||||||
rcall mLayoutSumContiguous ; r21:r20 needed minimum row width (r18, r19)
|
rcall mLayoutSumContiguous ; r21:r20 needed minimum row width (r18, r19)
|
||||||
@@ -585,17 +494,17 @@ mLayoutColumnCalcAdditionalSpace:
|
|||||||
pop r18
|
pop r18
|
||||||
sub r18, r20
|
sub r18, r20
|
||||||
sbc r19, r21
|
sbc r19, r21
|
||||||
brcs mLayoutColumnCalcAdditionalSpace_none
|
brcs mLayoutColumnCalcAdditionalSpaceContiguous_none
|
||||||
breq mLayoutColumnCalcAdditionalSpace_none
|
breq mLayoutColumnCalcAdditionalSpaceContiguous_none
|
||||||
mov r20, r18
|
mov r20, r18
|
||||||
mov r21, r19
|
mov r21, r19
|
||||||
sec
|
sec
|
||||||
rjmp mLayoutColumnCalcAdditionalSpace_ret
|
rjmp mLayoutColumnCalcAdditionalSpaceContiguous_ret
|
||||||
mLayoutColumnCalcAdditionalSpace_none:
|
mLayoutColumnCalcAdditionalSpaceContiguous_none:
|
||||||
clr r20
|
clr r20
|
||||||
clr r21
|
clr r21
|
||||||
clc
|
clc
|
||||||
mLayoutColumnCalcAdditionalSpace_ret:
|
mLayoutColumnCalcAdditionalSpaceContiguous_ret:
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -607,18 +516,32 @@ mLayoutColumnCalcAdditionalSpace_ret:
|
|||||||
; Calculate additional space per expandable widget in a column.
|
; Calculate additional space per expandable widget in a column.
|
||||||
;
|
;
|
||||||
; @param Y first widget of current row
|
; @param Y first widget of current row
|
||||||
; @param r25 widgets per row/column
|
; @param R25 widgets per row/column
|
||||||
; @return CFLAG set if there is additional space to distribute
|
; @return CFLAG set if there is additional space to distribute
|
||||||
; @return r21:r20 space to add to every expandable widget
|
; @return r21:r20 space to add to every expandable widget
|
||||||
; @clobbers r16-r23
|
; @clobbers r16-r21
|
||||||
|
|
||||||
mLayoutColumnExpandRows:
|
mLayoutColumnExpandRows:
|
||||||
rcall mLayoutColumnCalcAddSpacePerRow ; r21:r20=additional space (r16-r23)
|
push yl
|
||||||
|
push yh
|
||||||
|
bigcall OBJ_GetParent
|
||||||
|
mov yl, r18
|
||||||
|
mov yh, r19
|
||||||
|
ldd r18, Y+WIDGET_OFFS_HEIGHT_LO
|
||||||
|
ldd r19, Y+WIDGET_OFFS_HEIGHT_HI
|
||||||
|
pop yh
|
||||||
|
pop yl
|
||||||
|
|
||||||
|
rcall mLayoutColumnCalcAddSpacePerRow ; r21:r20=additional space (r16-r23)
|
||||||
brcc mLayoutColumnExpandRows_ret
|
brcc mLayoutColumnExpandRows_ret
|
||||||
|
|
||||||
ldi r22, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT) ; mask
|
push r22
|
||||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; value
|
push r23
|
||||||
rcall mLayoutExpandMatchingPackSkipped ; (r18, 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 mLayoutExpandMatchingPackSkipped ; (r18, r19)
|
||||||
|
pop r23
|
||||||
|
pop r22
|
||||||
|
|
||||||
mLayoutColumnExpandRows_ret:
|
mLayoutColumnExpandRows_ret:
|
||||||
ret
|
ret
|
||||||
@@ -629,53 +552,90 @@ mLayoutColumnExpandRows_ret:
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutColumnCalcAddSpacePerRow
|
; @routine mLayoutColumnCalcAddSpacePerRow
|
||||||
;
|
;
|
||||||
; Calculate additional space per expandable widget in a row.
|
; Calculate additional space per expandable widget in a column.
|
||||||
;
|
;
|
||||||
; @param Y first widget of current row
|
; @param Y first widget of current row
|
||||||
|
; @param r19:r18 width of parent widget
|
||||||
; @return CFLAG set if there is additional space to distribute
|
; @return CFLAG set if there is additional space to distribute
|
||||||
; @return r21:r20 space to add to every expandable widget
|
; @return r21:r20 space to add to every expandable widget
|
||||||
; @param r22 spacing between widgets
|
; @param r22 spacing between widgets
|
||||||
; @param r23 border at beginning and and
|
; @param r23 border at beginning and and
|
||||||
; @param r25 widgets per row/column
|
; @param r25 widgets per row/column
|
||||||
; @clobbers r16-r23
|
; @clobbers r16-r21
|
||||||
|
|
||||||
mLayoutColumnCalcAddSpacePerRow:
|
mLayoutColumnCalcAddSpacePerRow:
|
||||||
rcall mLayoutSumSkipped ; r21:r20 needed minimum row width (r18, r19)
|
push r22
|
||||||
ldd r18, Y+WIDGET_OFFS_HEIGHT_LO
|
push r23
|
||||||
ldd r19, Y+WIDGET_OFFS_HEIGHT_HI
|
rcall mLayoutColumnCalcAdditionalSpaceSkipped ; r21:r20=additional space (R18, R19)
|
||||||
sub r18, r20
|
brcc mLayoutColumnCalcAddSpacePerRow_ret
|
||||||
sbc r19, r21
|
push r20
|
||||||
brcc mLayoutColumnCalcAddSpacePerRow_none
|
push r21
|
||||||
breq mLayoutColumnCalcAddSpacePerRow_none
|
ldi r22, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT) ; mask
|
||||||
; r19:r18=space to distribute
|
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; value
|
||||||
push r18
|
rcall mLayoutCountMatchingPackContiguous ; r20=num of matching items (r18, r19)
|
||||||
push r19
|
mov r22, r20
|
||||||
ldi r22, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT) ; mask
|
clr r23
|
||||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; value
|
pop r21
|
||||||
rcall mLayoutCountChildrenMatchingPackSkipped ; r20=num of matching children (r18, r19)
|
pop r20
|
||||||
pop r19
|
tst r22
|
||||||
pop r18
|
breq mLayoutColumnCalcAddSpacePerRow_none ; don't divide by zero!
|
||||||
tst r20
|
|
||||||
breq mLayoutColumnCalcAddSpacePerRow_none ; don't divide by zero!
|
push r25
|
||||||
mov r22, r20
|
bigcall Utils_Divu16_16_16 ; r17:r16=space per expandable widget (r25)
|
||||||
clr r23
|
pop r25
|
||||||
mov r20, r18
|
mov r20, r16
|
||||||
mov r21, r19
|
mov r21, r17
|
||||||
push r25
|
sec
|
||||||
bigcall Utils_Divu16_16_16 ; r17:r16=space per expandable widget
|
rjmp mLayoutColumnCalcAddSpacePerRow_ret
|
||||||
pop r25
|
|
||||||
mov r20, r16
|
|
||||||
mov r21, r17
|
|
||||||
sec
|
|
||||||
rjmp mLayoutColumnCalcAddSpacePerRow_ret
|
|
||||||
mLayoutColumnCalcAddSpacePerRow_none:
|
mLayoutColumnCalcAddSpacePerRow_none:
|
||||||
clr r20
|
clr r20
|
||||||
clr r21
|
clr r21
|
||||||
clc
|
clc
|
||||||
mLayoutColumnCalcAddSpacePerRow_ret:
|
mLayoutColumnCalcAddSpacePerRow_ret:
|
||||||
|
pop r23
|
||||||
|
pop r22
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine mLayoutColumnCalcAdditionalSpaceSkipped
|
||||||
|
;
|
||||||
|
; Calculate additional space in a row.
|
||||||
|
;
|
||||||
|
; @param Y first widget of current row
|
||||||
|
; @param r19:r18 width of parent widget
|
||||||
|
; @param r22 spacing between widgets
|
||||||
|
; @param r23 border at beginning and and
|
||||||
|
; @param r25 widgets per row/column
|
||||||
|
; @return CFLAG set if there is additional space to distribute
|
||||||
|
; @return r21:r20 available additional space
|
||||||
|
; @clobbers r18, r19
|
||||||
|
|
||||||
|
mLayoutColumnCalcAdditionalSpaceSkipped:
|
||||||
|
push r18
|
||||||
|
push r19
|
||||||
|
rcall mLayoutSumSkipped ; r21:r20 needed minimum row width (r18, r19)
|
||||||
|
pop r19
|
||||||
|
pop r18
|
||||||
|
sub r18, r20
|
||||||
|
sbc r19, r21
|
||||||
|
brcs mLayoutColumnCalcAdditionalSpaceSkipped_none
|
||||||
|
breq mLayoutColumnCalcAdditionalSpaceSkipped_none
|
||||||
|
mov r20, r18
|
||||||
|
mov r21, r19
|
||||||
|
sec
|
||||||
|
rjmp mLayoutColumnCalcAdditionalSpaceSkipped_ret
|
||||||
|
mLayoutColumnCalcAdditionalSpaceSkipped_none:
|
||||||
|
clr r20
|
||||||
|
clr r21
|
||||||
|
clc
|
||||||
|
mLayoutColumnCalcAdditionalSpaceSkipped_ret:
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user