share code.

This commit is contained in:
Martin Preuss
2025-06-03 00:00:14 +02:00
parent dbad237826
commit ae1892f196

View File

@@ -123,36 +123,8 @@ WID_Widget_Handler_getMinHeight:
; @clobbers any, !Y
widgetGetMinWidth:
push yl
push yh
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
ldi r16, WID_SIGNAL_GETMINWIDTH
rjmp widgetGetMinSize
; @end
@@ -164,31 +136,46 @@ widgetGetMinWidth_loopEnd:
; @clobbers any, !Y
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 yh
rcall Tree_GetFirstChildObject ; (none)
clr r24
clr r25
widgetGetMinHeight_loop:
widgetGetMinSize_loop:
mov r17, xl
or r17, xh
breq widgetGetMinHeight_loopEnd
breq widgetGetMinSize_loopEnd
mov yl, xl
mov yh, yl
push r24
push r25
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
pop r25
pop r24
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
rcall Tree_GetNextSibling ; (none)
rjmp widgetGetMinHeight_loop
widgetGetMinHeight_loopEnd:
rjmp widgetGetMinSize_loop
widgetGetMinSize_loopEnd:
mov r18, r24
mov r19, r25
pop yh