gui2: X-layout works now!
This commit is contained in:
@@ -277,14 +277,14 @@ mLayoutCallbackSetYTmp:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutCallbackPositionX
|
; @routine mLayoutCallbackGridX
|
||||||
;
|
;
|
||||||
; @param Y widget
|
; @param Y widget
|
||||||
; @param r22 spacing between widgets
|
; @param r22 spacing between widgets
|
||||||
; @param X current X pos
|
; @param X current X pos
|
||||||
; @clobbers r10-r13, r16-r21
|
; @clobbers r10-r13, r16-r21
|
||||||
|
|
||||||
mLayoutCallbackPositionX:
|
mLayoutCallbackGridX:
|
||||||
ldd r20, Y+WIDGET_OFFS_TMP_LO
|
ldd r20, Y+WIDGET_OFFS_TMP_LO
|
||||||
ldd r21, Y+WIDGET_OFFS_TMP_HI
|
ldd r21, Y+WIDGET_OFFS_TMP_HI
|
||||||
std Y+WIDGET_OFFS_X_LO, xl ; set new X
|
std Y+WIDGET_OFFS_X_LO, xl ; set new X
|
||||||
@@ -296,40 +296,39 @@ mLayoutCallbackPositionX:
|
|||||||
sub xh, r22
|
sub xh, r22
|
||||||
clc
|
clc
|
||||||
ret
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
; ldd r16, Y+OBJECT_OFFS_FLAGS
|
|
||||||
; sbrs r16, WIDGET_FLAGS_VISIBLE_BIT
|
; ---------------------------------------------------------------------------
|
||||||
; rjmp mLayoutCallbackPositionX_ret
|
; @routine mLayoutCallbackGridX
|
||||||
|
;
|
||||||
|
; @param Y widget
|
||||||
|
; @param r22 spacing between widgets
|
||||||
|
; @clobbers r10-r13, r16-r21, X
|
||||||
|
|
||||||
|
mLayoutCallbackPackX:
|
||||||
ldd r10, Y+WIDGET_OFFS_TMP_LO ; calculated cell width
|
ldd r10, Y+WIDGET_OFFS_TMP_LO ; calculated cell width
|
||||||
ldd r11, Y+WIDGET_OFFS_TMP_HI
|
ldd r11, Y+WIDGET_OFFS_TMP_HI
|
||||||
ldd r12, Y+WIDGET_OFFS_WIDTH_LO ; default width
|
ldd r12, Y+WIDGET_OFFS_WIDTH_LO ; default width
|
||||||
ldd r13, Y+WIDGET_OFFS_WIDTH_HI
|
ldd r13, Y+WIDGET_OFFS_WIDTH_HI
|
||||||
ldd r17, Y+WIDGET_OFFS_PACK
|
ldd r17, Y+WIDGET_OFFS_PACK
|
||||||
andi r17, 3 ; WIDGET_PACK_HSELF0_BIT = 0, no shift necessary
|
andi r17, 3 ; WIDGET_PACK_HSELF0_BIT = 0, no shift necessary
|
||||||
push r10 ; cell width
|
rcall mLayoutPackCell ; R21:R20=relative pos, R19:R18=new size (r16, r17, r18, r19)
|
||||||
push r11
|
ldd xl, Y+WIDGET_OFFS_X_LO
|
||||||
rcall mLayoutPackCell ; R21:R20=relative pos, R19:R18=new size (r17, r18, r19)
|
ldd xh, Y+WIDGET_OFFS_X_HI
|
||||||
pop r11
|
add xl, r20
|
||||||
pop r10
|
adc xh, r21
|
||||||
add r20, xl
|
std Y+WIDGET_OFFS_X_LO, xl
|
||||||
adc r21, xh
|
std Y+WIDGET_OFFS_X_HI, xh
|
||||||
std Y+WIDGET_OFFS_X_LO, r20 ; set new X
|
std Y+WIDGET_OFFS_WIDTH_LO, r18
|
||||||
std Y+WIDGET_OFFS_X_HI, r21
|
|
||||||
std Y+WIDGET_OFFS_WIDTH_LO, r18 ; set new width
|
|
||||||
std Y+WIDGET_OFFS_WIDTH_HI, r19
|
std Y+WIDGET_OFFS_WIDTH_HI, r19
|
||||||
add xl, r10 ; advance X
|
|
||||||
adc xh, r11
|
|
||||||
add xl, r22 ; add spacing
|
|
||||||
adc xh, r22
|
|
||||||
sub xh, r22
|
|
||||||
mLayoutCallbackPositionX_ret:
|
|
||||||
clc
|
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutCallbackPositionY
|
; @routine mLayoutCallbackPositionY
|
||||||
;
|
;
|
||||||
@@ -362,7 +361,7 @@ ret
|
|||||||
andi r17, 3
|
andi r17, 3
|
||||||
push r18
|
push r18
|
||||||
push r19
|
push r19
|
||||||
rcall mLayoutPackCell ; R21:R20=relative pos (r17, r18, r19)
|
rcall mLayoutPackCell ; R21:R20=relative pos (r16, r17, r18, r19)
|
||||||
pop r19
|
pop r19
|
||||||
pop r18
|
pop r18
|
||||||
add r20, xl
|
add r20, xl
|
||||||
@@ -555,7 +554,7 @@ mLayoutCallbackGetMaxTmp_ret:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutCountChildrenMatchingPackContiguous
|
; @routine mLayoutCountMatchingPackContiguous
|
||||||
;
|
;
|
||||||
; @param Y object whose TMP value is to be added
|
; @param Y object whose TMP value is to be added
|
||||||
; @param r22 mask for WIDGET_OFFS_PACK
|
; @param r22 mask for WIDGET_OFFS_PACK
|
||||||
@@ -564,7 +563,7 @@ mLayoutCallbackGetMaxTmp_ret:
|
|||||||
; @return r20 number of matching children
|
; @return r20 number of matching children
|
||||||
; @clobbers r18, r19
|
; @clobbers r18, r19
|
||||||
|
|
||||||
mLayoutCountChildrenMatchingPackContiguous:
|
mLayoutCountMatchingPackContiguous:
|
||||||
push yl
|
push yl
|
||||||
push yh
|
push yh
|
||||||
clr r20
|
clr r20
|
||||||
@@ -629,7 +628,7 @@ mLayoutCallbackCountChildrenMatchingPack_ret:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutExpandChildrenMatchingPackContiguous
|
; @routine mLayoutExpandMatchingPackContiguous
|
||||||
;
|
;
|
||||||
; @param Y object whose TMP value is to be added
|
; @param Y object whose TMP value is to be added
|
||||||
; @param r21:r20 value to add to TMP
|
; @param r21:r20 value to add to TMP
|
||||||
@@ -638,12 +637,11 @@ mLayoutCallbackCountChildrenMatchingPack_ret:
|
|||||||
; @param r25 number of widgets to handle
|
; @param r25 number of widgets to handle
|
||||||
; @clobbers r18, r19
|
; @clobbers r18, r19
|
||||||
|
|
||||||
mLayoutExpandChildrenMatchingPackContiguous:
|
mLayoutExpandMatchingPackContiguous:
|
||||||
push yl
|
push yl
|
||||||
push yh
|
push yh
|
||||||
clr r20
|
ldi zl, LOW(mLayoutCallbackExpandMatchingPack)
|
||||||
ldi zl, LOW(mLayoutCallbackExpandChildrenMatchingPack)
|
ldi zh, HIGH(mLayoutCallbackExpandMatchingPack)
|
||||||
ldi zh, HIGH(mLayoutCallbackExpandChildrenMatchingPack)
|
|
||||||
rcall mLayoutForEveryObjectContiguous ; (r18, r19, Y)
|
rcall mLayoutForEveryObjectContiguous ; (r18, r19, Y)
|
||||||
pop yh
|
pop yh
|
||||||
pop yl
|
pop yl
|
||||||
@@ -653,7 +651,7 @@ mLayoutExpandChildrenMatchingPackContiguous:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutExpandChildrenMatchingPackSkipped
|
; @routine mLayoutExpandMatchingPackSkipped
|
||||||
;
|
;
|
||||||
; @param Y object whose TMP value is to be added
|
; @param Y object whose TMP value is to be added
|
||||||
; @param r21:r20 value to add to TMP
|
; @param r21:r20 value to add to TMP
|
||||||
@@ -662,12 +660,11 @@ mLayoutExpandChildrenMatchingPackContiguous:
|
|||||||
; @param r25 number of widgets to skip
|
; @param r25 number of widgets to skip
|
||||||
; @clobbers r18, r19
|
; @clobbers r18, r19
|
||||||
|
|
||||||
mLayoutExpandChildrenMatchingPackSkipped:
|
mLayoutExpandMatchingPackSkipped:
|
||||||
push yl
|
push yl
|
||||||
push yh
|
push yh
|
||||||
clr r20
|
ldi zl, LOW(mLayoutCallbackExpandMatchingPack)
|
||||||
ldi zl, LOW(mLayoutCallbackExpandChildrenMatchingPack)
|
ldi zh, HIGH(mLayoutCallbackExpandMatchingPack)
|
||||||
ldi zh, HIGH(mLayoutCallbackExpandChildrenMatchingPack)
|
|
||||||
rcall mLayoutForEveryObjectSkipped ; (r18, r19, Y)
|
rcall mLayoutForEveryObjectSkipped ; (r18, r19, Y)
|
||||||
pop yh
|
pop yh
|
||||||
pop yl
|
pop yl
|
||||||
@@ -677,7 +674,7 @@ mLayoutExpandChildrenMatchingPackSkipped:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutCallbackExpandChildrenMatchingPack
|
; @routine mLayoutCallbackExpandMatchingPack
|
||||||
;
|
;
|
||||||
; @param Y object whose TMP value is to be added
|
; @param Y object whose TMP value is to be added
|
||||||
; @param r21:r20 space to add to expandable widgets
|
; @param r21:r20 space to add to expandable widgets
|
||||||
@@ -686,21 +683,21 @@ mLayoutExpandChildrenMatchingPackSkipped:
|
|||||||
; @return CFLAG clear (to not abort the loop function)
|
; @return CFLAG clear (to not abort the loop function)
|
||||||
; @clobbers r18, r19
|
; @clobbers r18, r19
|
||||||
|
|
||||||
mLayoutCallbackExpandChildrenMatchingPack:
|
mLayoutCallbackExpandMatchingPack:
|
||||||
ldd r18, Y+OBJECT_OFFS_FLAGS
|
ldd r18, Y+OBJECT_OFFS_FLAGS
|
||||||
sbrs r18, WIDGET_FLAGS_VISIBLE_BIT
|
sbrs r18, WIDGET_FLAGS_VISIBLE_BIT
|
||||||
rjmp mLayoutCallbackExpandChildrenMatchingPack_ret
|
rjmp mLayoutCallbackExpandMatchingPack_ret
|
||||||
ldd r18, Y+WIDGET_OFFS_PACK
|
ldd r18, Y+WIDGET_OFFS_PACK
|
||||||
eor r18, r23
|
eor r18, r23
|
||||||
and r18, r22
|
and r18, r22
|
||||||
brne mLayoutCallbackExpandChildrenMatchingPack_ret
|
brne mLayoutCallbackExpandMatchingPack_ret
|
||||||
ldd r18, Y+WIDGET_OFFS_TMP_LO
|
ldd r18, Y+WIDGET_OFFS_TMP_LO
|
||||||
ldd r19, Y+WIDGET_OFFS_TMP_HI
|
ldd r19, Y+WIDGET_OFFS_TMP_HI
|
||||||
add r18, r20
|
add r18, r20
|
||||||
adc r19, r21
|
adc r19, r21
|
||||||
std Y+WIDGET_OFFS_TMP_LO, r18
|
std Y+WIDGET_OFFS_TMP_LO, r18
|
||||||
std Y+WIDGET_OFFS_TMP_HI, r19
|
std Y+WIDGET_OFFS_TMP_HI, r19
|
||||||
mLayoutCallbackExpandChildrenMatchingPack_ret:
|
mLayoutCallbackExpandMatchingPack_ret:
|
||||||
clc
|
clc
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
@@ -871,7 +868,7 @@ mLayoutCallbackCopyTmpToHeight:
|
|||||||
; @param r22 spacing between widgets
|
; @param r22 spacing between widgets
|
||||||
; @param r23 border at beginning and and
|
; @param r23 border at beginning and and
|
||||||
; @return r21:r20 total size in the given dimension including borders and inter-widget spacing
|
; @return r21:r20 total size in the given dimension including borders and inter-widget spacing
|
||||||
; @clobbers r18, r19, r25
|
; @clobbers r18, r19
|
||||||
|
|
||||||
mLayoutSumContiguous:
|
mLayoutSumContiguous:
|
||||||
push yl
|
push yl
|
||||||
@@ -880,7 +877,7 @@ mLayoutSumContiguous:
|
|||||||
clr r21
|
clr r21
|
||||||
ldi zl, LOW(mLayoutCallbackAddToSum)
|
ldi zl, LOW(mLayoutCallbackAddToSum)
|
||||||
ldi zh, HIGH(mLayoutCallbackAddToSum)
|
ldi zh, HIGH(mLayoutCallbackAddToSum)
|
||||||
rcall mLayoutForEveryObjectContiguous ; (r18, r19, r25, Y)
|
rcall mLayoutForEveryObjectContiguous ; (r18, r19, Y)
|
||||||
sub r20, r22 ; undo last adding inter-widget space
|
sub r20, r22 ; undo last adding inter-widget space
|
||||||
sbc r21, r22
|
sbc r21, r22
|
||||||
add r21, r22
|
add r21, r22
|
||||||
@@ -1081,18 +1078,19 @@ mLayoutGetBorders:
|
|||||||
; @param r22 spacing (between widgets)
|
; @param r22 spacing (between widgets)
|
||||||
; @return R21:R20 pos
|
; @return R21:R20 pos
|
||||||
; @return R19:R18 new size of widget
|
; @return R19:R18 new size of widget
|
||||||
; @clobbers r17, r18, r19
|
; @clobbers r16, r17, r18, r19
|
||||||
|
|
||||||
mLayoutPackCell:
|
mLayoutPackCell:
|
||||||
clr r20 ; preset pos
|
clr r20 ; preset pos
|
||||||
clr r21
|
clr r21
|
||||||
mov r18, r13 ; preset widget size
|
mov r18, r12 ; preset widget size
|
||||||
mov r19, r12
|
mov r19, r13
|
||||||
|
|
||||||
; subtract borders from cell size
|
; subtract borders from cell size
|
||||||
|
clr r16
|
||||||
sub r10, r22 ; subtract spacing
|
sub r10, r22 ; subtract spacing
|
||||||
sbc r11, r22
|
sbc r11, r16
|
||||||
add r11, r22
|
brcs mLayoutPackCell_ret
|
||||||
|
|
||||||
andi r17, 3 ; only 2 bits pack mode
|
andi r17, 3 ; only 2 bits pack mode
|
||||||
cpi r17, WIDGET_PACK_FILLED
|
cpi r17, WIDGET_PACK_FILLED
|
||||||
|
|||||||
@@ -132,14 +132,16 @@ mLayoutColumnLayoutHorizontally:
|
|||||||
; possibly distribute free space to expandable columns
|
; possibly distribute free space to expandable columns
|
||||||
push r22 ; spacing
|
push r22 ; spacing
|
||||||
push r23 ; border
|
push r23 ; border
|
||||||
push r25
|
rcall mLayoutColumnExpandColumns ; (r16-r23)
|
||||||
; rcall mLayoutColumnExpandColumns ; (r16-r23, r25)
|
|
||||||
pop r25
|
|
||||||
pop r23
|
pop r23
|
||||||
pop r22
|
pop r22
|
||||||
|
|
||||||
rcall mLayoutColumnPositionX
|
rcall mLayoutColumnGridX
|
||||||
rcall mLayoutColumnCopyXTmpFromFirstRow
|
rcall mLayoutColumnCopyXTmpFromFirstRow
|
||||||
|
push r25
|
||||||
|
clr r25
|
||||||
|
rcall mLayoutColumnPackX ; (r10-r13, r16-r21, X)
|
||||||
|
pop r25
|
||||||
|
|
||||||
pop yh
|
pop yh
|
||||||
pop yl
|
pop yl
|
||||||
@@ -345,7 +347,7 @@ mLayoutCallbackColumnPositionXRow:
|
|||||||
push yh
|
push yh
|
||||||
push zl
|
push zl
|
||||||
push zh
|
push zh
|
||||||
rcall mLayoutColumnPositionX ; (r12, r13, r16-r21, X, Z)
|
rcall mLayoutColumnGridX ; (r12, r13, r16-r21, X, Z)
|
||||||
pop zh
|
pop zh
|
||||||
pop zl
|
pop zl
|
||||||
pop yh
|
pop yh
|
||||||
@@ -357,7 +359,7 @@ mLayoutCallbackColumnPositionXRow:
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutColumnPositionX
|
; @routine mLayoutColumnGridX
|
||||||
;
|
;
|
||||||
; Set X and width to all columns of the row
|
; Set X and width to all columns of the row
|
||||||
;
|
;
|
||||||
@@ -367,13 +369,13 @@ mLayoutCallbackColumnPositionXRow:
|
|||||||
; @param R25 widgets per row/column
|
; @param R25 widgets per row/column
|
||||||
; @clobbers r12, r13, r16-r21, X, Z
|
; @clobbers r12, r13, r16-r21, X, Z
|
||||||
|
|
||||||
mLayoutColumnPositionX:
|
mLayoutColumnGridX:
|
||||||
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(mLayoutCallbackPositionX)
|
ldi zl, LOW(mLayoutCallbackGridX)
|
||||||
ldi zh, HIGH(mLayoutCallbackPositionX)
|
ldi zh, HIGH(mLayoutCallbackGridX)
|
||||||
rcall mLayoutForEveryObjectContiguous ; (r12, r13, r16-r21, Y)
|
rcall mLayoutForEveryObjectContiguous ; (r12, r13, r16-r21, Y)
|
||||||
pop yh
|
pop yh
|
||||||
pop yl
|
pop yl
|
||||||
@@ -382,6 +384,24 @@ mLayoutColumnPositionX:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine mLayoutColumnPackX
|
||||||
|
;
|
||||||
|
; 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
|
||||||
|
; @param R25 widgets per row/column
|
||||||
|
; @clobbers r10-r13, r16-r21, X
|
||||||
|
|
||||||
|
mLayoutColumnPackX:
|
||||||
|
M_MLAYOUT_FOREVERY_CONT mLayoutCallbackPackX ; (r10-r13, r16-r21, X)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine mLayoutColumnPositionAllY
|
; @routine mLayoutColumnPositionAllY
|
||||||
;
|
;
|
||||||
@@ -463,15 +483,29 @@ mLayoutColumnPositionY:
|
|||||||
; @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
|
||||||
|
|
||||||
mLayoutColumnExpandColumns:
|
mLayoutColumnExpandColumns:
|
||||||
|
push yl
|
||||||
|
push yh
|
||||||
|
bigcall OBJ_GetParent
|
||||||
|
mov yl, r18
|
||||||
|
mov yh, r19
|
||||||
|
ldd r18, Y+WIDGET_OFFS_WIDTH_LO
|
||||||
|
ldd r19, Y+WIDGET_OFFS_WIDTH_HI
|
||||||
|
pop yh
|
||||||
|
pop yl
|
||||||
|
|
||||||
rcall mLayoutColumnCalcAddSpacePerColumn ; r21:r20=additional space (r16-r23)
|
rcall mLayoutColumnCalcAddSpacePerColumn ; r21:r20=additional space (r16-r23)
|
||||||
brcc mLayoutColumnExpandColumns_ret
|
brcc mLayoutColumnExpandColumns_ret
|
||||||
|
|
||||||
ldi r22, (1<<WIDGET_PACK_HSELF1_BIT) | (1<<WIDGET_PACK_HSELF0_BIT) ; mask
|
push r22
|
||||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) ; value
|
push r23
|
||||||
rcall mLayoutExpandChildrenMatchingPackContiguous ; (r18, 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 mLayoutExpandMatchingPackContiguous ; (r18, r19)
|
||||||
|
pop r23
|
||||||
|
pop r22
|
||||||
|
|
||||||
mLayoutColumnExpandColumns_ret:
|
mLayoutColumnExpandColumns_ret:
|
||||||
ret
|
ret
|
||||||
@@ -485,47 +519,83 @@ mLayoutColumnExpandColumns_ret:
|
|||||||
; Calculate additional space per expandable widget in a row.
|
; Calculate additional space per expandable widget in a row.
|
||||||
;
|
;
|
||||||
; @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
|
||||||
|
|
||||||
mLayoutColumnCalcAddSpacePerColumn:
|
mLayoutColumnCalcAddSpacePerColumn:
|
||||||
rcall mLayoutSumContiguous ; r21:r20 needed minimum row width (r18, r19)
|
push r22
|
||||||
ldd r18, Y+WIDGET_OFFS_WIDTH_LO
|
push r23
|
||||||
ldd r19, Y+WIDGET_OFFS_WIDTH_HI
|
rcall mLayoutColumnCalcAdditionalSpace ; r21:r20=additional space (R18, R19)
|
||||||
sub r18, r20
|
brcc mLayoutColumnCalcAddSpacePerElement_ret
|
||||||
sbc r19, r21
|
push r20
|
||||||
brcc mLayoutColumnCalcAddSpacePerElement_none
|
push r21
|
||||||
breq mLayoutColumnCalcAddSpacePerElement_none
|
ldi r22, (1<<WIDGET_PACK_HSELF1_BIT) | (1<<WIDGET_PACK_HSELF0_BIT) ; mask
|
||||||
; r19:r18=space to distribute
|
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) ; value
|
||||||
|
rcall mLayoutCountMatchingPackContiguous ; r20=num of matching items (r18, r19)
|
||||||
|
mov r22, r20
|
||||||
|
clr r23
|
||||||
|
pop r21
|
||||||
|
pop r20
|
||||||
|
tst r22
|
||||||
|
breq mLayoutColumnCalcAddSpacePerElement_none ; don't divide by zero!
|
||||||
|
|
||||||
|
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:
|
||||||
|
pop r23
|
||||||
|
pop r22
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine mLayoutColumnCalcAdditionalSpace
|
||||||
|
;
|
||||||
|
; 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
|
||||||
|
|
||||||
|
mLayoutColumnCalcAdditionalSpace:
|
||||||
push r18
|
push r18
|
||||||
push r19
|
push r19
|
||||||
ldi r22, (1<<WIDGET_PACK_HSELF1_BIT) | (1<<WIDGET_PACK_HSELF0_BIT) ; mask
|
rcall mLayoutSumContiguous ; r21:r20 needed minimum row width (r18, r19)
|
||||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) ; value
|
|
||||||
rcall mLayoutCountChildrenMatchingPackContiguous ; r20=num of matching children (r18, r19, r25)
|
|
||||||
pop r19
|
pop r19
|
||||||
pop r18
|
pop r18
|
||||||
tst r20
|
sub r18, r20
|
||||||
breq mLayoutColumnCalcAddSpacePerElement_none ; don't divide by zero!
|
sbc r19, r21
|
||||||
mov r22, r20
|
brcs mLayoutColumnCalcAdditionalSpace_none
|
||||||
clr r23
|
breq mLayoutColumnCalcAdditionalSpace_none
|
||||||
mov r20, r18
|
mov r20, r18
|
||||||
mov r21, r19
|
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
|
sec
|
||||||
rjmp mLayoutColumnCalcAddSpacePerElement_ret
|
rjmp mLayoutColumnCalcAdditionalSpace_ret
|
||||||
mLayoutColumnCalcAddSpacePerElement_none:
|
mLayoutColumnCalcAdditionalSpace_none:
|
||||||
clr r20
|
clr r20
|
||||||
clr r21
|
clr r21
|
||||||
clc
|
clc
|
||||||
mLayoutColumnCalcAddSpacePerElement_ret:
|
mLayoutColumnCalcAdditionalSpace_ret:
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -548,7 +618,7 @@ mLayoutColumnExpandRows:
|
|||||||
|
|
||||||
ldi r22, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT) ; mask
|
ldi r22, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT) ; mask
|
||||||
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; value
|
ldi r23, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; value
|
||||||
rcall mLayoutExpandChildrenMatchingPackSkipped ; (r18, r19)
|
rcall mLayoutExpandMatchingPackSkipped ; (r18, r19)
|
||||||
|
|
||||||
mLayoutColumnExpandRows_ret:
|
mLayoutColumnExpandRows_ret:
|
||||||
ret
|
ret
|
||||||
|
|||||||
Reference in New Issue
Block a user