share code.
This commit is contained in:
@@ -123,36 +123,8 @@ WID_Widget_Handler_getMinHeight:
|
|||||||
; @clobbers any, !Y
|
; @clobbers any, !Y
|
||||||
|
|
||||||
widgetGetMinWidth:
|
widgetGetMinWidth:
|
||||||
push yl
|
ldi r16, WID_SIGNAL_GETMINWIDTH
|
||||||
push yh
|
rjmp widgetGetMinSize
|
||||||
rcall Tree_GetFirstChildObject ; (none)
|
|
||||||
clr r24
|
|
||||||
clr r25
|
|
||||||
widgetGetMinWidth_loop:
|
|
||||||
mov r17, xl
|
|
||||||
or r17, xh
|
|
||||||
breq widgetGetMinWidth_loopEnd
|
|
||||||
mov yl, xl
|
|
||||||
mov yh, yl
|
|
||||||
push r24
|
|
||||||
push r25
|
|
||||||
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
|
|
||||||
pop r25
|
|
||||||
pop r24
|
|
||||||
add r24, r18 ; TODO: handle carry later
|
|
||||||
adc r25, r19
|
|
||||||
adiw r25:r24, WID_WIDGET_INTER_BORDER
|
|
||||||
rcall Tree_GetNextSibling ; (none)
|
|
||||||
rjmp widgetGetMinWidth_loop
|
|
||||||
widgetGetMinWidth_loopEnd:
|
|
||||||
mov r18, r24
|
|
||||||
mov r19, r25
|
|
||||||
pop yh
|
|
||||||
pop yl
|
|
||||||
ret
|
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|
||||||
@@ -164,31 +136,46 @@ widgetGetMinWidth_loopEnd:
|
|||||||
; @clobbers any, !Y
|
; @clobbers any, !Y
|
||||||
|
|
||||||
widgetGetMinHeight:
|
widgetGetMinHeight:
|
||||||
|
ldi r16, WID_SIGNAL_GETMINHEIGHT
|
||||||
|
rjmp widgetGetMinSize
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine widgetGetMinSize
|
||||||
|
;
|
||||||
|
; @param r16 signal to send (WID_SIGNAL_GETMINWIDTH, WID_SIGNAL_GETMINHEIGHT)
|
||||||
|
; @return r19:r18 minimum width or height of widget
|
||||||
|
; @clobbers any, !Y
|
||||||
|
|
||||||
|
widgetGetMinSize:
|
||||||
push yl
|
push yl
|
||||||
push yh
|
push yh
|
||||||
rcall Tree_GetFirstChildObject ; (none)
|
rcall Tree_GetFirstChildObject ; (none)
|
||||||
clr r24
|
clr r24
|
||||||
clr r25
|
clr r25
|
||||||
widgetGetMinHeight_loop:
|
widgetGetMinSize_loop:
|
||||||
mov r17, xl
|
mov r17, xl
|
||||||
or r17, xh
|
or r17, xh
|
||||||
breq widgetGetMinHeight_loopEnd
|
breq widgetGetMinSize_loopEnd
|
||||||
mov yl, xl
|
mov yl, xl
|
||||||
mov yh, yl
|
mov yh, yl
|
||||||
push r24
|
push r16
|
||||||
push r25
|
push r24
|
||||||
ldi r16, WID_SIGNAL_GETMINHEIGHT
|
push r25
|
||||||
ldi r18, 1 ; default value for when the signal is not handled
|
ldi r18, 1 ; default value for when the signal is not handled
|
||||||
ldi r19, 0 ; 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
|
rcall OBJ_Handler ; ask child for its minimum size
|
||||||
pop r25
|
pop r25
|
||||||
pop r24
|
pop r24
|
||||||
|
pop r16
|
||||||
add r24, r18 ; TODO: handle carry later
|
add r24, r18 ; TODO: handle carry later
|
||||||
adc r25, r19
|
adc r25, r19
|
||||||
adiw r25:r24, WID_WIDGET_INTER_BORDER
|
adiw r25:r24, WID_WIDGET_INTER_BORDER
|
||||||
rcall Tree_GetNextSibling ; (none)
|
rcall Tree_GetNextSibling ; (none)
|
||||||
rjmp widgetGetMinHeight_loop
|
rjmp widgetGetMinSize_loop
|
||||||
widgetGetMinHeight_loopEnd:
|
widgetGetMinSize_loopEnd:
|
||||||
mov r18, r24
|
mov r18, r24
|
||||||
mov r19, r25
|
mov r19, r25
|
||||||
pop yh
|
pop yh
|
||||||
|
|||||||
Reference in New Issue
Block a user