More work on layout code.
This commit is contained in:
@@ -103,6 +103,8 @@ WID_Widget_Handler:
|
||||
breq WID_Widget_Handler_getMinWidth
|
||||
cpi r16, WID_SIGNAL_GETMINHEIGHT
|
||||
breq WID_Widget_Handler_getMinHeight
|
||||
cpi r16, WID_SIGNAL_LAYOUT
|
||||
breq WID_Widget_Handler_layout
|
||||
; for now just forward signal to all children
|
||||
WID_Widget_Handler_forward:
|
||||
rcall OBJ_ForwardSignalToChildren
|
||||
@@ -111,71 +113,182 @@ WID_Widget_Handler_getMinWidth:
|
||||
rjmp widgetGetMinWidth
|
||||
WID_Widget_Handler_getMinHeight:
|
||||
rjmp widgetGetMinHeight
|
||||
WID_Widget_Handler_layout:
|
||||
rjmp widgetLayout
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
widgetLayout:
|
||||
rcall wSetChildrenWidthsFromMinWidths
|
||||
rcall wSetChildrenHeightsFromMinHeights
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetGetMinWidth
|
||||
;
|
||||
; @return r19:r18 minimum width of widget
|
||||
; @clobbers any, !Y
|
||||
; count number of expandable children
|
||||
ldi r16, WID_OPTIONS1_BIT_STRETCH_Y
|
||||
ldi r17, WID_OPTIONS1_BIT_STRETCH_Y
|
||||
rcall widgetCountVisibleChildrenWithOptions1 ; (r18, r24, r25, X)
|
||||
tst r18
|
||||
breq widgetLayout_Ydone ; no expandable children, nothing to distribute
|
||||
; determine full height needed by all children
|
||||
push r18 ; number of visible expandable child widgets
|
||||
clr r17 ; mask=0 -> count all visible children
|
||||
rcall wGetSumOfMatchingVisibleChildrenHeights ; r19:r18=sum of all children heights
|
||||
pop r22
|
||||
clr r23 ; r23:r22=number of visible expandable children
|
||||
; calculate number of bytes to add to each expandable child widget
|
||||
ldd r20, Y+WID_OFFS_HEIGHT_LO ; total height
|
||||
ldd r21, Y+WID_OFFS_HEIGHT_HI
|
||||
clr r16
|
||||
ldd r17, Y+WID_OFFS_BORDER_TOP ; subtract top border
|
||||
sub r20, r17
|
||||
sbc r21, r16
|
||||
brcs widgetLayout_heightTooSmall ; jmp if too small
|
||||
ldd r17, Y+WID_OFFS_BORDER_BOT ; subtract bottom border
|
||||
sub r20, r17
|
||||
sbc r21, r16
|
||||
brcs widgetLayout_heightTooSmall ; jmp if too small
|
||||
|
||||
sub r20, r18 ; r21:r20 = HEIGHT-SUM_OF_VIS_CHILDREN_HEIGHTS
|
||||
sbc r21, r19
|
||||
brcc widgetLayout_heightTooSmall
|
||||
breq widgetLayout_yDone ; nothing to distribute
|
||||
bigcall Utils_Divu16_16_16 ; r17:r16 = r21:r20 / r23:r22
|
||||
; add additional pixel to heights of expandable child widgets
|
||||
rcall wAddToHeightsOfExpandableVisibleChildren
|
||||
|
||||
widgetGetMinWidth:
|
||||
ldi r16, WID_SIGNAL_GETMINWIDTH
|
||||
rjmp widgetGetMinSize
|
||||
widgetLayout_yDone:
|
||||
rcall wSetRelYFromHeightInVisibleChildren
|
||||
rcall wAlignChildrenHorizontally
|
||||
widgetLayout_heightTooSmall:
|
||||
; TODO: how to handle this case?
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetGetMinHeight
|
||||
; @routine wAlignChildrenHorizontally
|
||||
;
|
||||
; @return r19:r18 minimum height of widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
widgetGetMinHeight:
|
||||
ldi r16, WID_SIGNAL_GETMINHEIGHT
|
||||
rjmp widgetGetMinSize
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetGetMinSize
|
||||
; Horizontally align children within the width of the parent widget.
|
||||
; Only changes Y+WID_OFFS_REL_X_LO/HI.
|
||||
;
|
||||
; @param r16 signal to send (WID_SIGNAL_GETMINWIDTH, WID_SIGNAL_GETMINHEIGHT)
|
||||
; @return r19:r18 minimum width or height of widget
|
||||
; @clobbers any, !Y
|
||||
; @param Y pointer to object SRAM
|
||||
; @clobbers r16, r17, r18, r19, r24, r25
|
||||
|
||||
widgetGetMinSize:
|
||||
wAlignChildrenHorizontally:
|
||||
push yl
|
||||
push yh
|
||||
ldd r24, Y+WID_OFFS_WIDTH_LO ; parent width
|
||||
ldd r25, Y+WID_OFFS_WIDTH_HI
|
||||
ldd r19, Y+WID_OFFS_BORDER_LEFT ; subtract left border
|
||||
mov r16, r19
|
||||
clr r17
|
||||
sub r24, r16
|
||||
sbc r25, r17
|
||||
ldd r16, Y+WID_OFFS_BORDER_RIGHT ; subtract right border
|
||||
sub r24, r16
|
||||
sbc r25, r17 ; r25:r24=parent width minus lateral borders, r19=left border
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
clr r24
|
||||
clr r25
|
||||
widgetGetMinSize_loop:
|
||||
wAlignChildrenHorizontally_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq widgetGetMinSize_loopEnd
|
||||
breq wAlignChildrenHorizontally_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
push r16
|
||||
push r24
|
||||
push r25
|
||||
ldi r18, 1 ; default value for when the signal is not handled
|
||||
ldi r19, 0 ; default value for when the signal is not handled
|
||||
rcall OBJ_Handler ; ask child for its minimum size
|
||||
pop r25
|
||||
pop r24
|
||||
pop r16
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq wAlignChildrenHorizontally_loopNext
|
||||
push r24
|
||||
push r25
|
||||
push r19
|
||||
rcall wAlignHorizontally
|
||||
pop r19
|
||||
add r24, r19
|
||||
adc r25, r19
|
||||
sub r25, r19
|
||||
std Y+WID_OFFS_REL_X_LO, r24
|
||||
std Y+WID_OFFS_REL_X_HI, r25
|
||||
pop r25
|
||||
pop r24
|
||||
wAlignChildrenHorizontally_loopNext:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp wAlignChildrenHorizontally_loop
|
||||
wAlignChildrenHorizontally_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wAlignHorizontally
|
||||
;
|
||||
; @param r25:r24 parent width minus lateral borders
|
||||
; @return r25:r24 proposed X position relative to parent
|
||||
; @clobbers r16, r17
|
||||
|
||||
wAlignHorizontally:
|
||||
ldd r16, Y+WID_OFFS_OPTIONS1
|
||||
andi r16, (WID_OPTIONS1_BIT_HALIGN0 | WID_OPTIONS1_BIT_HALIGN1)
|
||||
cpi r16, (0<<WID_OPTIONS1_BIT_HALIGN1) | (0<<WID_OPTIONS1_BIT_HALIGN0)
|
||||
breq wAlignHorizontally_left
|
||||
cpi r16, (0<<WID_OPTIONS1_BIT_HALIGN1) | (1<<WID_OPTIONS1_BIT_HALIGN0)
|
||||
breq wAlignHorizontally_right
|
||||
wAlignHorizontally_center:
|
||||
ldd r16, Y+WID_OFFS_WIDTH_LO
|
||||
ldd r17, Y+WID_OFFS_WIDTH_HI
|
||||
sub r24, r16
|
||||
sbc r25, r17
|
||||
lsr r25
|
||||
ror r24
|
||||
ret
|
||||
wAlignHorizontally_left:
|
||||
clr r24
|
||||
clr r25
|
||||
ret
|
||||
wAlignHorizontally_right:
|
||||
ldd r16, Y+WID_OFFS_WIDTH_LO
|
||||
ldd r17, Y+WID_OFFS_WIDTH_HI
|
||||
sub r24, r16
|
||||
sbc r25, r17
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wSetRelYFromHeightInVisibleChildren
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @clobbers r17, r18, r19, r24, r25, X
|
||||
|
||||
wSetRelYFromHeightInVisibleChildren:
|
||||
push yl
|
||||
push yh
|
||||
ldd r24, Y+WID_OFFS_BORDER_TOP
|
||||
clr r25
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
wSetRelYFromHeightInVisibleChildren_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wSetRelYFromHeightInVisibleChildren_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq wSetRelYFromHeightInVisibleChildren_loopNext
|
||||
std Y+WID_OFFS_REL_Y_LO, r24
|
||||
std Y+WID_OFFS_REL_Y_HI, r25
|
||||
ldd r18, Y+WID_OFFS_WIDTH_LO
|
||||
ldd r19, Y+WID_OFFS_WIDTH_HI
|
||||
add r24, r18 ; TODO: handle carry later
|
||||
adc r25, r19
|
||||
adiw r25:r24, WID_WIDGET_INTER_BORDER
|
||||
wSetRelYFromHeightInVisibleChildren_loopNext:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp widgetGetMinSize_loop
|
||||
widgetGetMinSize_loopEnd:
|
||||
rjmp wSetRelYFromHeightInVisibleChildren_loop
|
||||
wSetRelYFromHeightInVisibleChildren_loopEnd:
|
||||
mov r18, r24
|
||||
mov r19, r25
|
||||
pop yh
|
||||
@@ -189,3 +302,370 @@ widgetGetMinSize_loopEnd:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetGetMinWidth
|
||||
;
|
||||
; @return r19:r18 minimum width of widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
widgetGetMinWidth:
|
||||
ldi r16, WID_SIGNAL_GETMINWIDTH
|
||||
rjmp widgetGetLargestChildMinSize
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetGetMinHeight
|
||||
;
|
||||
; @return r19:r18 minimum height of widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
widgetGetMinHeight:
|
||||
ldi r16, WID_SIGNAL_GETMINHEIGHT
|
||||
rjmp widgetSumOfChildrenMinSize
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetSumOfChildrenMinSize
|
||||
;
|
||||
; @param r16 signal to send (WID_SIGNAL_GETMINWIDTH, WID_SIGNAL_GETMINHEIGHT)
|
||||
; @return r19:r18 minimum width or height of widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
widgetSumOfChildrenMinSize:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
clr r24
|
||||
clr r25
|
||||
widgetSumOfChildrenMinSize_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq widgetSumOfChildrenMinSize_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq widgetSumOfChildrenMinSize_loopNext
|
||||
push r16
|
||||
push r24
|
||||
push r25
|
||||
ldi r18, 1 ; default value for when the signal is not handled
|
||||
ldi r19, 0 ; default value for when the signal is not handled
|
||||
rcall OBJ_Handler ; ask child for its minimum size
|
||||
pop r25
|
||||
pop r24
|
||||
pop r16
|
||||
add r24, r18 ; TODO: handle carry later
|
||||
adc r25, r19
|
||||
adiw r25:r24, WID_WIDGET_INTER_BORDER
|
||||
widgetSumOfChildrenMinSize_loopNext:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp widgetSumOfChildrenMinSize_loop
|
||||
widgetSumOfChildrenMinSize_loopEnd:
|
||||
mov r18, r24
|
||||
mov r19, r25
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetGetLargestChildMinSize
|
||||
;
|
||||
; @param r16 signal to send (WID_SIGNAL_GETMINWIDTH, WID_SIGNAL_GETMINHEIGHT)
|
||||
; @return r19:r18 minimum width or height of widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
widgetGetLargestChildMinSize:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
clr r24
|
||||
clr r25
|
||||
widgetGetLargestChildMinSize_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq widgetGetLargestChildMinSize_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq widgetGetLargestChildMinSize_loopNext
|
||||
push r16
|
||||
push r24
|
||||
push r25
|
||||
ldi r18, 1 ; default value for when the signal is not handled
|
||||
ldi r19, 0 ; default value for when the signal is not handled
|
||||
rcall OBJ_Handler ; ask child for its minimum size
|
||||
pop r25
|
||||
pop r24
|
||||
pop r16
|
||||
sub r24, r18
|
||||
sbc r25, r19
|
||||
add r24, r18
|
||||
adc r25, r19
|
||||
brcc widgetGetLargestChildMinSize_loopNext
|
||||
mov r24, r18
|
||||
mov r25, r19
|
||||
widgetGetLargestChildMinSize_loopNext:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp widgetGetLargestChildMinSize_loop
|
||||
widgetGetLargestChildMinSize_loopEnd:
|
||||
mov r18, r24
|
||||
mov r19, r25
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine widgetCountVisibleChildrenWithOptions1
|
||||
;
|
||||
; Count visible direct children with a matching WID_OFFS_OPTIONS1 field.
|
||||
;
|
||||
; @param r16 option1 value combination wanted
|
||||
; @param r17 option1 mask of bits to match
|
||||
; @return r18 number of matching direct children
|
||||
; @clobbers r18, r24, r25, X
|
||||
|
||||
widgetCountVisibleChildrenWithOptions1:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
clr r24
|
||||
widgetCountVisibleChildrenWithOptions1_loop:
|
||||
mov r25, xl
|
||||
or r25, xh
|
||||
breq widgetCountVisibleChildrenWithOptions1_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq widgetCountVisibleChildrenWithOptions1_next
|
||||
ldd r18, Y+WID_OFFS_OPTIONS1
|
||||
eor r18, r17
|
||||
and r18, r16
|
||||
brne widgetCountVisibleChildrenWithOptions1_next
|
||||
inc r24
|
||||
widgetCountVisibleChildrenWithOptions1_next:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp widgetSumOfChildrenMinSize_loop
|
||||
widgetCountVisibleChildrenWithOptions1_loopEnd:
|
||||
mov r18, r24
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wGetSumOfMatchingVisibleChildrenHeights
|
||||
;
|
||||
; Add heights of all matching visible children.
|
||||
;
|
||||
; @param r16 option1 value combination wanted
|
||||
; @param r17 option1 mask of bits to match
|
||||
; @return r19:r18 sum of widths of all visible direct children
|
||||
; @clobbers r24, r25, X
|
||||
|
||||
wGetSumOfMatchingVisibleChildrenHeights:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
clr r24
|
||||
clr r25
|
||||
wGetSumOfMatchingVisibleChildrenHeights_loop:
|
||||
mov r18, xl
|
||||
or r18, xh
|
||||
breq wGetSumOfMatchingVisibleChildrenHeights_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq wGetSumOfMatchingVisibleChildrenHeights_next
|
||||
ldd r18, Y+WID_OFFS_OPTIONS1
|
||||
eor r18, r17
|
||||
and r18, r16
|
||||
brne wGetSumOfMatchingVisibleChildrenHeights_next
|
||||
ldd r18, Y+WID_OFFS_HEIGHT_LO
|
||||
ldd r19, Y+WID_OFFS_HEIGHT_HI
|
||||
add r24, r18
|
||||
adc r25, r19
|
||||
wGetSumOfMatchingVisibleChildrenHeights_next:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp wGetSumOfMatchingVisibleChildrenHeights_loop
|
||||
wGetSumOfMatchingVisibleChildrenHeights_loopEnd:
|
||||
mov r18, r24
|
||||
mov r19, r25
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wAddToWidthsOfExpandableVisibleChildren
|
||||
;
|
||||
; @param Y = pointer to widget data in SRAM
|
||||
; @param r17:r16 number to add to the widths of all visible X-expandable children
|
||||
; @clobbers r18, r19, X
|
||||
|
||||
wAddToWidthsOfExpandableVisibleChildren:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
wAddToWidthsOfExpandableVisibleChildren_loop:
|
||||
mov r18, xl
|
||||
or r18, xh
|
||||
breq wAddToWidthsOfExpandableVisibleChildren_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq wAddToWidthsOfExpandableVisibleChildren_next
|
||||
ldd r18, Y+WID_OFFS_OPTIONS1
|
||||
andi r18, WID_OPTIONS1_BIT_STRETCH_X
|
||||
breq wAddToWidthsOfExpandableVisibleChildren_next
|
||||
ldd r18, Y+WID_OFFS_WIDTH_LO
|
||||
ldd r19, Y+WID_OFFS_WIDTH_HI
|
||||
add r18, r16
|
||||
adc r19, r17
|
||||
std Y+WID_OFFS_WIDTH_LO, r18
|
||||
std Y+WID_OFFS_WIDTH_HI, r19
|
||||
wAddToWidthsOfExpandableVisibleChildren_next:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp wAddToWidthsOfExpandableVisibleChildren_loop
|
||||
wAddToWidthsOfExpandableVisibleChildren_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wAddToHeightsOfExpandableVisibleChildren
|
||||
;
|
||||
; @param Y = pointer to widget data in SRAM
|
||||
; @param r17:r16 number to add to the heights of all visible Y-expandable children
|
||||
; @clobbers r18, r19, X
|
||||
|
||||
wAddToHeightsOfExpandableVisibleChildren:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
wAddToHeightsOfExpandableVisibleChildren_loop:
|
||||
mov r18, xl
|
||||
or r18, xh
|
||||
breq wAddToHeightsOfExpandableVisibleChildren_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq wAddToHeightsOfExpandableVisibleChildren_next
|
||||
ldd r18, Y+WID_OFFS_OPTIONS1
|
||||
andi r18, WID_OPTIONS1_BIT_STRETCH_Y
|
||||
breq wAddToHeightsOfExpandableVisibleChildren_next
|
||||
ldd r18, Y+WID_OFFS_HEIGHT_LO
|
||||
ldd r19, Y+WID_OFFS_HEIGHT_HI
|
||||
add r18, r16
|
||||
adc r19, r17
|
||||
std Y+WID_OFFS_HEIGHT_LO, r18
|
||||
std Y+WID_OFFS_HEIGHT_HI, r19
|
||||
wAddToHeightsOfExpandableVisibleChildren_next:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp wAddToHeightsOfExpandableVisibleChildren_loop
|
||||
wAddToHeightsOfExpandableVisibleChildren_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wSetChildrenWidthsFromMinWidths
|
||||
;
|
||||
; @clobbers any, !Y
|
||||
|
||||
wSetChildrenWidthsFromMinWidths:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
wSetChildrenWidthsFromMinWidths_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wSetChildrenWidthsFromMinWidths_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
sbrs r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
rjmp wSetChildrenWidthsFromMinWidths_loopNext ; jump if not visible
|
||||
sbrc r18, WID_OPTIONS1_BIT_FIXED_WIDTH
|
||||
rjmp wSetChildrenWidthsFromMinWidths_loopNext ; jump if fixed width
|
||||
ldi r16, WID_SIGNAL_GETMINWIDTH
|
||||
ldi r18, 1 ; default value for when the signal is not handled
|
||||
ldi r19, 0 ; default value for when the signal is not handled
|
||||
rcall OBJ_Handler ; ask child for its minimum size
|
||||
std Y+WID_OFFS_WIDTH_LO, r18
|
||||
std Y+WID_OFFS_WIDTH_HI, r19
|
||||
wSetChildrenWidthsFromMinWidths_loopNext:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp wSetChildrenWidthsFromMinWidths_loop
|
||||
wSetChildrenWidthsFromMinWidths_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wSetChildrenHeightsFromMinHeights
|
||||
;
|
||||
; @clobbers any, !Y
|
||||
|
||||
wSetChildrenHeightsFromMinHeights:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
wSetChildrenHeightsFromMinHeights_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wSetChildrenHeightsFromMinHeights_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
sbrs r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
rjmp wSetChildrenHeightsFromMinHeights_loopNext ; jump if not visible
|
||||
sbrc r18, WID_OPTIONS1_BIT_FIXED_HEIGHT
|
||||
rjmp wSetChildrenHeightsFromMinHeights_loopNext ; jump if fixed height
|
||||
ldi r16, WID_SIGNAL_GETMINHEIGHT
|
||||
ldi r18, 1 ; default value for when the signal is not handled
|
||||
ldi r19, 0 ; default value for when the signal is not handled
|
||||
rcall OBJ_Handler ; ask child for its minimum size
|
||||
std Y+WID_OFFS_HEIGHT_LO, r18
|
||||
std Y+WID_OFFS_HEIGHT_HI, r19
|
||||
wSetChildrenHeightsFromMinHeights_loopNext:
|
||||
rcall Tree_GetNextSibling ; (none)
|
||||
rjmp wSetChildrenHeightsFromMinHeights_loop
|
||||
wSetChildrenHeightsFromMinHeights_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user