avr: work on simple GUI module to be used by node c02.
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
#ifndef AQH_AVR_WIN_H
|
||||
#define AQH_AVR_WIN_H
|
||||
#ifndef AQH_AVR_WIN_DEFS_H
|
||||
#define AQH_AVR_WIN_DEFS_H
|
||||
|
||||
|
||||
; tree/list data
|
||||
@@ -18,12 +18,11 @@
|
||||
.equ OBJ_OFFS_OBJECT = OBJ_OFFS_TREE+TREE_SIZE
|
||||
.equ OBJ_OFFS_HANDLERFN_LO = OBJ_OFFS_OBJECT
|
||||
.equ OBJ_OFFS_HANDLERFN_HI = OBJ_OFFS_OBJECT+1
|
||||
.equ OBJ_OFFS_LINKS_LO = OBJ_OFFS_OBJECT+2
|
||||
.equ OBJ_OFFS_LINKS_HI = OBJ_OFFS_OBJECT+3
|
||||
.equ OBJ_OFFS_TIMERS_LO = OBJ_OFFS_OBJECT+4
|
||||
.equ OBJ_OFFS_TIMERS_HI = OBJ_OFFS_OBJECT+5
|
||||
.equ OBJ_OFFS_OPTIONS = OBJ_OFFS_OBJECT+6
|
||||
.equ OBJ_OFFS_SIZE = OBJ_OFFS_OBJECT+7
|
||||
.equ OBJ_OFFS_TARGET_LO = OBJ_OFFS_OBJECT+2
|
||||
.equ OBJ_OFFS_TARGET_HI = OBJ_OFFS_OBJECT+3
|
||||
.equ OBJ_OFFS_IDFORTARGET = OBJ_OFFS_OBJECT+4
|
||||
.equ OBJ_OFFS_OPTIONS = OBJ_OFFS_OBJECT+5
|
||||
.equ OBJ_OFFS_SIZE = OBJ_OFFS_OBJECT+6
|
||||
|
||||
; widget data
|
||||
.equ WID_OFFS_WIDGET = OBJ_OFFS_SIZE
|
||||
@@ -59,6 +58,7 @@
|
||||
.equ WID_OPTIONS0_BIT_VISIBLE = 0 ; OBJ_OFFS_OPTIONS
|
||||
.equ WID_OPTIONS0_BIT_DIRTY = 1
|
||||
.equ WID_OPTIONS0_BIT_LAYOUT = 2
|
||||
.equ WID_OPTIONS0_BIT_DATAINSDRAM = 3 ; text or other data is in SDRAM, not in flash
|
||||
|
||||
.equ WID_OPTIONS1_BIT_STRETCH_X = 0 ; WID_OFFS_OPTIONS1
|
||||
.equ WID_OPTIONS1_BIT_STRETCH_Y = 1
|
||||
@@ -98,21 +98,6 @@
|
||||
|
||||
|
||||
|
||||
; Links
|
||||
|
||||
.equ OBJ_LINK_OFFS_LIST = 0
|
||||
.equ OBJ_LINK_OFFS_SIGNAL = LIST_SIZE
|
||||
.equ OBJ_LINK_OFFS_SLOT = LIST_SIZE+1
|
||||
.equ OBJ_LINK_OFFS_TARGET_LO = LIST_SIZE+2
|
||||
.equ OBJ_LINK_OFFS_TARGET_HI = LIST_SIZE+3
|
||||
.equ OBJ_LINK_SIZE = LIST_SIZE+4
|
||||
; fns:
|
||||
; - removeLinksTo(Y=win, r19:r18=target)
|
||||
; - addLink(Y=win, r16=signal, r17=slot, r19:r18=target)
|
||||
; - removeLinks(Y=win)
|
||||
|
||||
|
||||
|
||||
.equ TIMER_OFFS_LIST = 0
|
||||
.equ TIMER_OFFS_TIMER = LIST_SIZE
|
||||
.equ TIMER_OFFS_VALUE_LO = TIMER_OFFS_TIMER
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
#ifndef AQH_AVR_WIN_OBJECT_H
|
||||
#define AQH_AVR_WIN_OBJECT_H
|
||||
|
||||
|
||||
.cseg
|
||||
|
||||
@@ -15,20 +18,24 @@
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_Init @global
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param r17 options
|
||||
; @clobbers X
|
||||
; Generally every object only reports its signals to a single other object
|
||||
; (called the target). However, every object can receive signals from multiple
|
||||
; sender objects. To allow this the target assigns its own id (called idForTarget)
|
||||
; to the new object in order to determine who sent the signal and to act accordingly.
|
||||
; There are system signals which don't use idForTarget (like OBJ_SIGNAL_DESTROY).
|
||||
;
|
||||
; @param Y pointer to object in SRAM
|
||||
; @param r18 options
|
||||
; @clobbers r16, r17, X
|
||||
|
||||
OBJ_Init:
|
||||
push r17
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
clr r16
|
||||
ldi r17, OBJ_OFFS_SIZE
|
||||
bigcall Utils_FillSram ; (R17, X)
|
||||
bigcall Tree_InitObject ; (R16)
|
||||
pop r17
|
||||
std Y+OBJ_OFFS_OPTIONS, r17
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
clr r16
|
||||
ldi r17, OBJ_OFFS_SIZE
|
||||
bigcall Utils_FillSram ; (R17, X)
|
||||
bigcall Tree_InitObject ; (R16)
|
||||
std Y+OBJ_OFFS_OPTIONS, r18
|
||||
ldi r16, LOW(OBJ_DefaultHandler)
|
||||
std Y+OBJ_OFFS_HANDLERFN_LO, r16
|
||||
ldi r16, HIGH(OBJ_DefaultHandler)
|
||||
@@ -38,12 +45,28 @@ OBJ_Init:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_SetTarget @global
|
||||
;
|
||||
; @param r19 srcIdForTarget
|
||||
; @param X pointer to target
|
||||
; @clobbers none
|
||||
|
||||
OBJ_SetTarget:
|
||||
std Y+OBJ_OFFS_TARGET_LO, xl
|
||||
std Y+OBJ_OFFS_TARGET_HI, xh
|
||||
std Y+OBJ_OFFS_IDFORTARGET, r19
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_SetHandler @global
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param Z pointer to handler function (word address)
|
||||
; @clobbers X
|
||||
; @clobbers none
|
||||
|
||||
OBJ_SetHandler:
|
||||
std Y+OBJ_OFFS_HANDLERFN_LO, zl
|
||||
@@ -68,55 +91,20 @@ OBJ_GetHandler:
|
||||
|
||||
|
||||
|
||||
OBJ_DefaultHandler:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_free @global
|
||||
; @routine OBJ_DefaultHandler @global
|
||||
;
|
||||
; @param Y pointer to object in SRAM
|
||||
; This is a default signal handler which does nothing.
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param r18 signal
|
||||
; @param r19 srcIdForTarget
|
||||
; @param R20 1st param
|
||||
; @param R21 2nd param
|
||||
; @param X 3rd param
|
||||
; @clobbers any
|
||||
|
||||
OBJ_free:
|
||||
; free children
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
OBJ_free_loop:
|
||||
mov r16, xl
|
||||
or r16, xh
|
||||
breq OBJ_free_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
rcall Tree_GetNextSibling
|
||||
push xl ; next
|
||||
push xh ; next
|
||||
rcall OBJ_free
|
||||
pop xh ; next
|
||||
pop xl ; next
|
||||
rjmp OBJ_free_loop
|
||||
OBJ_free_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
|
||||
rcall Tree_UnlinkObject ; (r16, r17, x)
|
||||
|
||||
push yl
|
||||
push yh
|
||||
ldi r16, OBJ_SIGNAL_DESTROY
|
||||
rcall OBJ_Handler
|
||||
pop yh
|
||||
pop yl
|
||||
rcall objFreeLinks
|
||||
rcall objFreeTimers
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
rcall Heap_free
|
||||
OBJ_DefaultHandler:
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
@@ -124,15 +112,62 @@ OBJ_free_loopEnd:
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_Handler
|
||||
; @routine OBJ_Fini @global
|
||||
;
|
||||
; This routine calls OBJ_Fini on every child object, Then it sends the signal
|
||||
; OBJ_SIGNAL_DESTROY to this object allowing it to release all its ressources
|
||||
; (including memory space if using heap or other dynamic ressources).
|
||||
;
|
||||
; @param Y pointer to object in SRAM
|
||||
; @clobbers any, !Y
|
||||
|
||||
OBJ_Fini:
|
||||
; fini children
|
||||
push yl
|
||||
push yh
|
||||
bigcall Tree_GetFirstChildObject ; (none)
|
||||
OBJ_Fini_loop:
|
||||
mov r16, xl
|
||||
or r16, xh
|
||||
breq OBJ_Fini_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
bigcall Tree_GetNextSibling
|
||||
push xl ; next
|
||||
push xh ; next
|
||||
rcall OBJ_Fini
|
||||
pop xh ; next
|
||||
pop xl ; next
|
||||
rjmp OBJ_Fini_loop
|
||||
OBJ_Fini_loopEnd:
|
||||
pop yh
|
||||
pop yl
|
||||
|
||||
bigcall Tree_UnlinkObject ; (r16, r17, x)
|
||||
|
||||
push yl
|
||||
push yh
|
||||
ldi r18, OBJ_SIGNAL_DESTROY
|
||||
clr r19
|
||||
rcall OBJ_Handler
|
||||
pop yh ; probably no longer usable pointer,
|
||||
pop yl ; especially if using heap!
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_Handler @global
|
||||
;
|
||||
; Signal handler for an object. A signal can have up to 3 parameters
|
||||
; conveyed in registers R18, R19 and X.
|
||||
; conveyed in registers R20, R21 and X.
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param r16 signal
|
||||
; @param R18 1st param
|
||||
; @param R19 2nd param
|
||||
; @param r18 signal
|
||||
; @param r19 srcIdForTarget
|
||||
; @param R20 1st param
|
||||
; @param R21 2nd param
|
||||
; @param X 3rd param
|
||||
|
||||
OBJ_Handler:
|
||||
@@ -146,22 +181,22 @@ OBJ_Handler:
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_ForwardSignalToChildren
|
||||
; @routine OBJ_ForwardSignalToChildren @global
|
||||
;
|
||||
; Signal handler for an object. A signal can have up to 3 parameters
|
||||
; conveyed in registers R18, R19 and X.
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param r16 signal
|
||||
; @param R18 1st param
|
||||
; @param R19 2nd param
|
||||
; @param r18 signal
|
||||
; @param R20 1st param
|
||||
; @param R21 2nd param
|
||||
; @param X 3rd param
|
||||
; @clobbers any, !r16, !r18, !r19, !Y
|
||||
; @clobbers any, !r18, !r20, !r21, !Y
|
||||
|
||||
OBJ_ForwardSignalToChildren:
|
||||
push yl
|
||||
push yh
|
||||
rcall Tree_GetFirstChildObject ; (none)
|
||||
bigcall Tree_GetFirstChildObject ; (none)
|
||||
OBJ_ForwardSignalToChildren_loop:
|
||||
clc
|
||||
mov r17, xl
|
||||
@@ -169,21 +204,22 @@ OBJ_ForwardSignalToChildren_loop:
|
||||
breq OBJ_ForwardSignalToChildren_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
push r16
|
||||
push r18
|
||||
push r19
|
||||
push r18
|
||||
push r20
|
||||
push r21
|
||||
push xl
|
||||
push xh
|
||||
push yl
|
||||
push yh
|
||||
clr r19 ; srcId for target set to 0 (this is a direct call to the handler)
|
||||
rcall OBJ_Handler
|
||||
pop yh
|
||||
pop yl
|
||||
pop xh
|
||||
pop xl
|
||||
pop r19
|
||||
pop r18
|
||||
pop r16
|
||||
pop r21
|
||||
pop r20
|
||||
pop r18
|
||||
rcall Tree_GetNextSibling
|
||||
rjmp OBJ_ForwardSignalToChildren_loop
|
||||
OBJ_ForwardSignalToChildren_loopEnd:
|
||||
@@ -195,246 +231,27 @@ OBJ_ForwardSignalToChildren_loopEnd:
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_EmitSignal
|
||||
; @routine OBJ_EmitSignal @global
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param r16 signal to emit
|
||||
; @param R18 1st param
|
||||
; @param R19 2nd param
|
||||
; @param r18 signal
|
||||
; @param R20 1st param
|
||||
; @param R21 2nd param
|
||||
; @param X 3rd param
|
||||
; @clobbers any, !Y
|
||||
|
||||
OBJ_EmitSignal:
|
||||
push yl
|
||||
push yh
|
||||
ldd r17, Y+OBJ_OFFS_LINKS_LO
|
||||
ldd yh, Y+OBJ_OFFS_LINKS_HI
|
||||
mov yl, r17
|
||||
OBJ_EmitSignal_loop:
|
||||
push r16
|
||||
rcall objCheckEmitSignalForLink ; (any, !X, !Y, !R18, !R19)
|
||||
pop r16
|
||||
push xl
|
||||
push xh
|
||||
rcall List_GetNextObject ; (none)
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
pop xh
|
||||
pop xl
|
||||
mov r17, yl
|
||||
or r17, yh
|
||||
brne OBJ_EmitSignal_loop
|
||||
OBJ_EmitSignal_popRet:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_AddLink @global
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param X pointer to link
|
||||
; @clobbers R16, R17
|
||||
|
||||
OBJ_AddLink:
|
||||
ldd r16, Y+OBJ_OFFS_LINKS_LO
|
||||
ldd r17, Y+OBJ_OFFS_LINKS_HI
|
||||
tst r16
|
||||
brne OBJ_AddLink_addToExisting
|
||||
tst r17
|
||||
brne OBJ_AddLink_addToExisting
|
||||
; empty list, new link is first
|
||||
std Y+OBJ_OFFS_LINKS_LO, xl
|
||||
std Y+OBJ_OFFS_LINKS_HI, xh
|
||||
rjmp OBJ_AddLink_end
|
||||
OBJ_AddLink_addToExisting:
|
||||
push xl
|
||||
push xh
|
||||
push yl
|
||||
push yh
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
mov xl, r16
|
||||
mov xh, r17
|
||||
rcall List_AddObject ; (r16, r17, x)
|
||||
pop yh
|
||||
pop yl
|
||||
pop xh
|
||||
pop xl
|
||||
OBJ_AddLink_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_RemoveLink @global
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param X pointer to link
|
||||
; @clobbers R16, R17
|
||||
|
||||
OBJ_RemoveLink:
|
||||
ldd r16, Y+OBJ_OFFS_LINKS_LO
|
||||
ldd r17, Y+OBJ_OFFS_LINKS_HI
|
||||
cp r16, xl
|
||||
brne OBJ_RemoveLink_notFirst
|
||||
cp r17, xh
|
||||
brne OBJ_RemoveLink_notFirst
|
||||
clr r16
|
||||
std Y+OBJ_OFFS_LINKS_LO, r16
|
||||
std Y+OBJ_OFFS_LINKS_HI, r16
|
||||
rjmp OBJ_RemoveLink_end
|
||||
OBJ_RemoveLink_notFirst:
|
||||
push xl
|
||||
push xh
|
||||
push yl
|
||||
push yh
|
||||
mov yl, xl
|
||||
mov yh, r17
|
||||
mov xl, r16
|
||||
mov xh, r17
|
||||
rcall List_UnlinkObject ; (r16, r17, x)
|
||||
pop yh
|
||||
pop yl
|
||||
pop xh
|
||||
pop xl
|
||||
OBJ_RemoveLink_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_AddTimer @global
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param X pointer to timer
|
||||
; @clobbers R16, R17
|
||||
|
||||
OBJ_AddTimer:
|
||||
ldd r16, Y+OBJ_OFFS_TIMERS_LO
|
||||
ldd r17, Y+OBJ_OFFS_TIMERS_HI
|
||||
tst r16
|
||||
brne OBJ_AddTimer_addToExisting
|
||||
tst r17
|
||||
brne OBJ_AddTimer_addToExisting
|
||||
; empty list, new timer is first
|
||||
std Y+OBJ_OFFS_TIMERS_LO, xl
|
||||
std Y+OBJ_OFFS_TIMERS_HI, xh
|
||||
rjmp OBJ_AddTimer_end
|
||||
OBJ_AddTimer_addToExisting:
|
||||
push xl
|
||||
push xh
|
||||
push yl
|
||||
push yh
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
mov xl, r16
|
||||
mov xh, r17
|
||||
rcall List_AddObject ; (r16, r17, x)
|
||||
pop yh
|
||||
pop yl
|
||||
pop xh
|
||||
pop xl
|
||||
OBJ_AddTimer_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_RemoveTimer @global
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param X pointer to timer
|
||||
; @clobbers R16, R17
|
||||
|
||||
OBJ_RemoveTimer:
|
||||
ldd r16, Y+OBJ_OFFS_TIMERS_LO
|
||||
ldd r17, Y+OBJ_OFFS_TIMERS_HI
|
||||
cp r16, xl
|
||||
brne OBJ_RemoveTimer_notFirst
|
||||
cp r17, xh
|
||||
brne OBJ_RemoveTimer_notFirst
|
||||
clr r16
|
||||
std Y+OBJ_OFFS_TIMERS_LO, r16
|
||||
std Y+OBJ_OFFS_TIMERS_HI, r16
|
||||
rjmp OBJ_RemoveTimer_end
|
||||
OBJ_RemoveTimer_notFirst:
|
||||
push xl
|
||||
push xh
|
||||
push yl
|
||||
push yh
|
||||
mov yl, xl
|
||||
mov yh, r17
|
||||
mov xl, r16
|
||||
mov xh, r17
|
||||
rcall List_UnlinkObject ; (r16, r17, x)
|
||||
pop yh
|
||||
pop yl
|
||||
pop xh
|
||||
pop xl
|
||||
OBJ_RemoveTimer_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @param r16 signal
|
||||
; @param Y link
|
||||
; @clobbers any, !X, !Y, !R18, !R19
|
||||
|
||||
objCheckEmitSignalForLink:
|
||||
ldd r17, Y+OBJ_LINK_OFFS_SIGNAL
|
||||
cp r16, r17
|
||||
brne objCheckEmitSignalForLink_ret
|
||||
push yl
|
||||
push yh
|
||||
push xl
|
||||
push xh
|
||||
push r18
|
||||
push r19
|
||||
ldd r16, Y+OBJ_LINK_OFFS_SLOT
|
||||
ldd r17, Y+OBJ_LINK_OFFS_TARGET_LO
|
||||
ldd yh, Y+OBJ_LINK_OFFS_TARGET_HI
|
||||
mov yl, r17
|
||||
rcall OBJ_Handler
|
||||
pop r19
|
||||
pop r18
|
||||
pop xh
|
||||
pop xl
|
||||
pop yh
|
||||
pop yl
|
||||
objCheckEmitSignalForLink_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine objFreeLinks
|
||||
;
|
||||
; @clobbers r16, r17, r18, r19, r24, r25, X
|
||||
|
||||
objFreeLinks:
|
||||
push yl
|
||||
push yh
|
||||
ldd r16, Y+OBJ_OFFS_LINKS_LO
|
||||
ldd r17, Y+OBJ_OFFS_LINKS_HI
|
||||
clr r18
|
||||
std Y+OBJ_OFFS_LINKS_LO, r18
|
||||
std Y+OBJ_OFFS_LINKS_HI, r18
|
||||
ldd r16, Y+OBJ_OFFS_TARGET_LO
|
||||
ldd r17, Y+OBJ_OFFS_TARGET_HI
|
||||
ldd r19, Y+OBJ_OFFS_IDFORTARGET
|
||||
mov yl, r16
|
||||
mov yh, r17
|
||||
ldi zl, LOW(Obj_Link_free)
|
||||
ldi zh, HIGH(Obj_Link_free)
|
||||
rcall List_ForEveryObject ; (r16, r17, r18, r19, r24, r25, X, Y)
|
||||
or r16, r17
|
||||
breq OBJ_EmitSignal_end
|
||||
rcall OBJ_Handler
|
||||
OBJ_EmitSignal_end:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
@@ -442,115 +259,5 @@ objFreeLinks:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine objFreeTimers
|
||||
;
|
||||
; @clobbers r16, r17, r18, r19, r24, r25, X
|
||||
|
||||
objFreeTimers:
|
||||
push yl
|
||||
push yh
|
||||
ldd r16, Y+OBJ_OFFS_TIMERS_LO
|
||||
ldd r17, Y+OBJ_OFFS_TIMERS_HI
|
||||
clr r18
|
||||
std Y+OBJ_OFFS_TIMERS_LO, r18
|
||||
std Y+OBJ_OFFS_TIMERS_HI, r18
|
||||
mov yl, r16
|
||||
mov yh, r17
|
||||
ldi zl, LOW(Obj_Timer_free)
|
||||
ldi zh, HIGH(Obj_Timer_free)
|
||||
rcall List_ForEveryObject ; (r16, r17, r18, r19, r24, r25, X, Y)
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_Link_new @global
|
||||
;
|
||||
; @return CF set if okay, cleared on error
|
||||
; @return Y pointer to SRAM for link
|
||||
; @clobbers r16, r17, X
|
||||
|
||||
OBJ_Link_new:
|
||||
ldi r24, LOW(OBJ_LINK_SIZE)
|
||||
ldi r25, HIGH(OBJ_LINK_SIZE)
|
||||
bigcall Heap_Alloc
|
||||
brcc OBJ_Link_new_end
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
clr r16
|
||||
ldi r17, OBJ_LINK_SIZE
|
||||
bigcall Utils_FillSram ; (R17, X)
|
||||
rcall List_InitObject ; (R16)
|
||||
sec
|
||||
OBJ_Link_new_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_Link_free @global
|
||||
;
|
||||
; @param Y pointer to SRAM for link
|
||||
; @clobbers r16, r17, r24, r25, X
|
||||
|
||||
OBJ_Link_free:
|
||||
rcall List_FiniObject ; (R16)
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
rcall Heap_free ; (r16, r17, r24, r25, X)
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_Timer_new @global
|
||||
;
|
||||
; @return CF set if okay, cleared on error
|
||||
; @return Y pointer to SRAM for timer
|
||||
; @clobbers r16, r17, X
|
||||
|
||||
OBJ_Timer_new:
|
||||
ldi r24, LOW(TIMER_SIZE)
|
||||
ldi r25, HIGH(TIMER_SIZE)
|
||||
bigcall Heap_Alloc
|
||||
brcc OBJ_Timer_new_end
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
clr r16
|
||||
ldi r17, TIMER_SIZE
|
||||
bigcall Utils_FillSram ; (R17, X)
|
||||
rcall List_InitObject ; (R16)
|
||||
sec
|
||||
OBJ_Timer_new_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine OBJ_Timer_free @global
|
||||
;
|
||||
; @param Y pointer to SRAM for timer
|
||||
; @clobbers r16, r17, r24, r25, X
|
||||
|
||||
OBJ_Timer_free:
|
||||
rcall List_FiniObject ; (R16)
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
bigcall Heap_free ; (r16, r17, r24, r25, X)
|
||||
clc
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
#endif ; AQH_AVR_WIN_OBJECT_H
|
||||
|
||||
|
||||
770
avr/modules/lcd2/win/w_layout.asm
Normal file
770
avr/modules/lcd2/win/w_layout.asm
Normal file
@@ -0,0 +1,770 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2025 by Martin Preuss
|
||||
; email : martin@libchipcard.de
|
||||
;
|
||||
; ***************************************************************************
|
||||
; * This file is part of the project "AqHome". *
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defs
|
||||
|
||||
.equ WID_WIDGET_INTER_BORDER = 2
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine WID_Widget_new @global
|
||||
;
|
||||
; @param Y pointer to window SRAM
|
||||
; @param X pointer to parent
|
||||
; @param r18 WID_OFFS_OPTIONS1
|
||||
; @param r19 WID_OFFS_OPTIONS2
|
||||
|
||||
WID_Widget_Init:
|
||||
push r18
|
||||
push r19
|
||||
push xl
|
||||
push xh
|
||||
ldi zl, LOW(WID_Widget_Handler)
|
||||
ldi zh, HIGH(WID_Widget_Handler)
|
||||
clr r17
|
||||
rcall OBJ_Init
|
||||
pop xh
|
||||
pop xl
|
||||
pop r19
|
||||
pop r18
|
||||
std Y+WID_OFFS_OPTIONS1, r18
|
||||
std Y+WID_OFFS_OPTIONS2, r19
|
||||
mov r16, xl
|
||||
or r16, xh
|
||||
breq WID_Widget_noParent
|
||||
; copy defaults from parent
|
||||
adiw xh:xl, WID_OFFS_BG_COL_LO
|
||||
ld r16, X+ ; WID_OFFS_BG_COL_LO
|
||||
std Y+WID_OFFS_BG_COL_LO, r16
|
||||
ld r16, X+ ; WID_OFFS_BG_COL_HI
|
||||
std Y+WID_OFFS_BG_COL_HI, r16
|
||||
ld r16, X+ ; WID_OFFS_FG_COL_LO
|
||||
std Y+WID_OFFS_FG_COL_LO, r16
|
||||
ld r16, X+ ; WID_OFFS_FG_COL_HI
|
||||
std Y+WID_OFFS_FG_COL_HI, r16
|
||||
ld r16, X+ ; WID_OFFS_FONT_LO
|
||||
std Y+WID_OFFS_FONT_LO, r16
|
||||
ld r16, X+ ; WID_OFFS_FONT_HI
|
||||
std Y+WID_OFFS_FONT_HI, r16
|
||||
rjmp WID_Widget_end
|
||||
WID_Widget_noParent: ; preset without parent
|
||||
clr r16
|
||||
std Y+WID_OFFS_FONT_LO, r16
|
||||
std Y+WID_OFFS_FONT_HI, r16
|
||||
|
||||
std Y+WID_OFFS_FG_COL_LO, r16 ; foreground black
|
||||
std Y+WID_OFFS_FG_COL_HI, r16
|
||||
dec r16
|
||||
std Y+WID_OFFS_BG_COL_LO, r16 ; background white
|
||||
std Y+WID_OFFS_BG_COL_HI, r16
|
||||
|
||||
ldi r16, 2 ; default borders
|
||||
std Y+WID_OFFS_BORDER_TOP, r16
|
||||
std Y+WID_OFFS_BORDER_BOT, r16
|
||||
std Y+WID_OFFS_BORDER_LEFT, r16
|
||||
std Y+WID_OFFS_BORDER_RIGHT, r16
|
||||
WID_Widget_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine WID_Widget_Handler
|
||||
;
|
||||
; Signal handler for an object. A signal can have up to 3 parameters
|
||||
; conveyed in registers R18, R19 and X.
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param r16 signal
|
||||
; @param R18 1st param
|
||||
; @param R19 2nd param
|
||||
; @param X 3rd param
|
||||
; @clobbers any, !Y
|
||||
|
||||
WID_Widget_Handler:
|
||||
cpi r16, WID_SIGNAL_GETMINWIDTH
|
||||
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
|
||||
cpi r16, WID_SIGNAL_DRAW
|
||||
breq WID_Widget_Handler_draw
|
||||
; for now just forward signal to all children
|
||||
WID_Widget_Handler_forward:
|
||||
rcall OBJ_ForwardSignalToChildren
|
||||
ret
|
||||
WID_Widget_Handler_getMinWidth:
|
||||
rjmp widgetGetMinWidth
|
||||
WID_Widget_Handler_getMinHeight:
|
||||
rjmp widgetGetMinHeight
|
||||
WID_Widget_Handler_layout:
|
||||
rjmp widgetLayout
|
||||
WID_Widget_Handler_draw:
|
||||
rjmp wDraw
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
wDraw:
|
||||
ldd r16, Y+OBJ_OFFS_OPTIONS
|
||||
sbrs r16, WID_OPTIONS0_BIT_VISIBLE ; only draw visible widgets
|
||||
rjmp wDraw_ret
|
||||
cbr r16, (1<<WID_OPTIONS0_BIT_DIRTY)
|
||||
std Y+OBJ_OFFS_OPTIONS, r16
|
||||
|
||||
; fill window background
|
||||
ldd r2, Y+WID_OFFS_BG_COL_LO
|
||||
ldd r3, Y+WID_OFFS_BG_COL_HI
|
||||
ldd r4, Y+WID_OFFS_ABS_X_LO
|
||||
ldd r5, Y+WID_OFFS_ABS_X_HI
|
||||
ldd r6, Y+WID_OFFS_ABS_Y_LO
|
||||
ldd r7, Y+WID_OFFS_ABS_Y_HI
|
||||
ldd r8, Y+WID_OFFS_WIDTH_LO
|
||||
ldd r9, Y+WID_OFFS_WIDTH_HI
|
||||
ldd r10, Y+WID_OFFS_HEIGHT_LO
|
||||
ldd r11, Y+WID_OFFS_HEIGHT_HI
|
||||
bigcall ILI9341_FillRect
|
||||
wDraw_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
widgetLayout:
|
||||
rjmp wVLayout
|
||||
|
||||
|
||||
|
||||
wVLayout:
|
||||
rcall wSetChildrenWidthsFromMinWidths
|
||||
rcall wSetChildrenHeightsFromMinHeights
|
||||
|
||||
; count number of expandable children
|
||||
ldi r16, (1<<WID_OPTIONS1_BIT_STRETCH_Y) ; value
|
||||
ldi r17, (1<<WID_OPTIONS1_BIT_STRETCH_Y) ; mask
|
||||
rcall widgetCountVisibleChildrenWithOptions1 ; r18=number of matching visible children (r24, r25, X)
|
||||
tst r18
|
||||
breq wVLayout_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 wVLayout_heightTooSmall ; jmp if too small
|
||||
ldd r17, Y+WID_OFFS_BORDER_BOT ; subtract bottom border
|
||||
sub r20, r17
|
||||
sbc r21, r16
|
||||
brcs wVLayout_heightTooSmall ; jmp if too small
|
||||
|
||||
sub r20, r18 ; r21:r20 = HEIGHT-SUM_OF_VIS_CHILDREN_HEIGHTS
|
||||
sbc r21, r19
|
||||
brcc wVLayout_heightTooSmall
|
||||
breq wVLayout_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
|
||||
|
||||
wVLayout_yDone:
|
||||
rcall wSetRelYFromHeightInVisibleChildren
|
||||
rcall wAlignChildrenHorizontally
|
||||
; rcall wSetAbsoluteCoords call in GUI loop after calling layout on all widgets
|
||||
wVLayout_heightTooSmall:
|
||||
; TODO: how to handle this case?
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
wSetAbsoluteCoords:
|
||||
push yl
|
||||
push yh
|
||||
wSetAbsoluteCoords_loop:
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq wSetAbsoluteCoords_nextSibling
|
||||
push yl
|
||||
push yh
|
||||
bigcall Tree_GetParentObject
|
||||
clr r18
|
||||
clr r19
|
||||
clr r20
|
||||
clr r21
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wSetAbsoluteCoords_r1820set
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
ldd r18, Y+WID_OFFS_ABS_X_LO
|
||||
ldd r19, Y+WID_OFFS_ABS_X_HI
|
||||
ldd r20, Y+WID_OFFS_ABS_Y_LO
|
||||
ldd r21, Y+WID_OFFS_ABS_Y_HI
|
||||
wSetAbsoluteCoords_r1820set:
|
||||
pop yh
|
||||
pop yl
|
||||
; handle X
|
||||
ldd r16, Y+WID_OFFS_REL_X_LO
|
||||
ldd r17, Y+WID_OFFS_REL_X_HI
|
||||
add r16, r18
|
||||
adc r17, r19
|
||||
std Y+WID_OFFS_ABS_X_LO, r16
|
||||
std Y+WID_OFFS_ABS_X_HI, r17
|
||||
; handle Y
|
||||
ldd r16, Y+WID_OFFS_REL_Y_LO
|
||||
ldd r17, Y+WID_OFFS_REL_Y_HI
|
||||
add r16, r20
|
||||
adc r17, r21
|
||||
std Y+WID_OFFS_ABS_Y_LO, r16
|
||||
std Y+WID_OFFS_ABS_Y_HI, r17
|
||||
bigcall Tree_GetObjectBelow
|
||||
rjmp wSetAbsoluteCoords_loopEnd
|
||||
wSetAbsoluteCoords_nextSibling:
|
||||
bigcall Tree_GetNextSibling
|
||||
wSetAbsoluteCoords_loopEnd:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wSetAbsoluteCoords_end
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
rjmp wSetAbsoluteCoords_loop
|
||||
wSetAbsoluteCoords_end:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wAlignChildrenHorizontally
|
||||
;
|
||||
; Horizontally align children within the width of the parent widget.
|
||||
; Only changes Y+WID_OFFS_REL_X_LO/HI.
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @clobbers r16, r17, r18, r19, r24, r25
|
||||
|
||||
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)
|
||||
wAlignChildrenHorizontally_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wAlignChildrenHorizontally_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
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
|
||||
sbrc r16, WID_OPTIONS1_BIT_STRETCH_X
|
||||
rjmp wAlignHorizontally_stretch
|
||||
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
|
||||
wAlignHorizontally_stretch:
|
||||
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 wSetRelYFromHeightInVisibleChildren_loop
|
||||
wSetRelYFromHeightInVisibleChildren_loopEnd:
|
||||
mov r18, r24
|
||||
mov r19, r25
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @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
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
#ifndef AQH_AVR_WIN_WIDGET_H
|
||||
#define AQH_AVR_WIN_WIDGET_H
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defs
|
||||
|
||||
.equ WID_WIDGET_INTER_BORDER = 2
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
@@ -23,31 +25,41 @@
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine WID_Widget_new @global
|
||||
; @routine Widget_Init @global
|
||||
;
|
||||
; @param Y pointer to window SRAM
|
||||
; @param X pointer to parent
|
||||
; @param r18 WID_OFFS_OPTIONS1
|
||||
; @param r19 WID_OFFS_OPTIONS2
|
||||
; @param r18 OBJ options
|
||||
; @param r19 WID_OFFS_OPTIONS1
|
||||
; @param r20 WID_OFFS_OPTIONS2
|
||||
; @clobbers r16, r17, X, Z
|
||||
|
||||
WID_Widget_Init:
|
||||
push r18
|
||||
push r19
|
||||
Widget_Init:
|
||||
push r19
|
||||
push r20
|
||||
push xl
|
||||
push xh
|
||||
ldi zl, LOW(WID_Widget_Handler)
|
||||
ldi zh, HIGH(WID_Widget_Handler)
|
||||
clr r17
|
||||
rcall OBJ_Init
|
||||
ldi zl, LOW(Widget_Handler) ; handler
|
||||
ldi zh, HIGH(Widget_Handler)
|
||||
rcall OBJ_Init ; (r16, r17, X)
|
||||
pop xh
|
||||
pop xl
|
||||
pop r19
|
||||
pop r18
|
||||
std Y+WID_OFFS_OPTIONS1, r18
|
||||
std Y+WID_OFFS_OPTIONS2, r19
|
||||
pop r20
|
||||
pop r19
|
||||
|
||||
; store options
|
||||
std Y+WID_OFFS_OPTIONS1, r19
|
||||
std Y+WID_OFFS_OPTIONS2, r20
|
||||
|
||||
; set basic handler
|
||||
ldi zl, LOW(Widget_Handler) ; handler
|
||||
ldi zh, HIGH(Widget_Handler)
|
||||
rcall OBJ_SetHandler
|
||||
|
||||
mov r16, xl
|
||||
or r16, xh
|
||||
breq WID_Widget_noParent
|
||||
breq Widget_noParent
|
||||
|
||||
; copy defaults from parent
|
||||
adiw xh:xl, WID_OFFS_BG_COL_LO
|
||||
ld r16, X+ ; WID_OFFS_BG_COL_LO
|
||||
@@ -62,8 +74,9 @@ WID_Widget_Init:
|
||||
std Y+WID_OFFS_FONT_LO, r16
|
||||
ld r16, X+ ; WID_OFFS_FONT_HI
|
||||
std Y+WID_OFFS_FONT_HI, r16
|
||||
rjmp WID_Widget_end
|
||||
WID_Widget_noParent: ; preset without parent
|
||||
rjmp Widget_end
|
||||
|
||||
Widget_noParent: ; preset without parent
|
||||
clr r16
|
||||
std Y+WID_OFFS_FONT_LO, r16
|
||||
std Y+WID_OFFS_FONT_HI, r16
|
||||
@@ -79,55 +92,56 @@ WID_Widget_noParent: ; preset without parent
|
||||
std Y+WID_OFFS_BORDER_BOT, r16
|
||||
std Y+WID_OFFS_BORDER_LEFT, r16
|
||||
std Y+WID_OFFS_BORDER_RIGHT, r16
|
||||
WID_Widget_end:
|
||||
Widget_end:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine WID_Widget_Handler
|
||||
; @routine Widget_Handler @global
|
||||
;
|
||||
; Signal handler for an object. A signal can have up to 3 parameters
|
||||
; conveyed in registers R18, R19 and X.
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @param r16 signal
|
||||
; @param R18 1st param
|
||||
; @param R19 2nd param
|
||||
; @param r18 signal
|
||||
; @param r19 srcIdForTarget
|
||||
; @param R20 1st param
|
||||
; @param R21 2nd param
|
||||
; @param X 3rd param
|
||||
; @clobbers any, !Y
|
||||
|
||||
WID_Widget_Handler:
|
||||
cpi r16, WID_SIGNAL_GETMINWIDTH
|
||||
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
|
||||
cpi r16, WID_SIGNAL_DRAW
|
||||
breq WID_Widget_Handler_draw
|
||||
; for now just forward signal to all children
|
||||
WID_Widget_Handler_forward:
|
||||
rcall OBJ_ForwardSignalToChildren
|
||||
Widget_Handler:
|
||||
cpi r18, OBJ_SIGNAL_DESTROY
|
||||
breq Widget_Handler_destroy
|
||||
cpi r18, WID_SIGNAL_DRAW
|
||||
breq Widget_Handler_draw
|
||||
clc
|
||||
rjmp Widget_Handler_ret
|
||||
Widget_Handler_destroy:
|
||||
; nothing to do here (for HEAP objects we would call Heap_Free)
|
||||
rjmp Widget_Handler_secRet
|
||||
Widget_Handler_draw:
|
||||
rcall Widget_Draw
|
||||
Widget_Handler_secRet:
|
||||
sec
|
||||
Widget_Handler_ret:
|
||||
ret
|
||||
WID_Widget_Handler_getMinWidth:
|
||||
rjmp widgetGetMinWidth
|
||||
WID_Widget_Handler_getMinHeight:
|
||||
rjmp widgetGetMinHeight
|
||||
WID_Widget_Handler_layout:
|
||||
rjmp widgetLayout
|
||||
WID_Widget_Handler_draw:
|
||||
rjmp wDraw
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_Draw @global
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @clobbers
|
||||
|
||||
wDraw:
|
||||
Widget_Draw:
|
||||
ldd r16, Y+OBJ_OFFS_OPTIONS
|
||||
sbrs r16, WID_OPTIONS0_BIT_VISIBLE ; only draw visible widgets
|
||||
rjmp wDraw_ret
|
||||
rjmp widgetDraw_ret
|
||||
cbr r16, (1<<WID_OPTIONS0_BIT_DIRTY)
|
||||
std Y+OBJ_OFFS_OPTIONS, r16
|
||||
|
||||
@@ -142,74 +156,24 @@ wDraw:
|
||||
ldd r9, Y+WID_OFFS_WIDTH_HI
|
||||
ldd r10, Y+WID_OFFS_HEIGHT_LO
|
||||
ldd r11, Y+WID_OFFS_HEIGHT_HI
|
||||
bigcall ILI9341_FillRect
|
||||
wDraw_ret:
|
||||
bigcall Display_FillRect
|
||||
widgetDraw_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Widget_SetAbsoluteCoords @global
|
||||
;
|
||||
|
||||
widgetLayout:
|
||||
rjmp wVLayout
|
||||
|
||||
|
||||
|
||||
wVLayout:
|
||||
rcall wSetChildrenWidthsFromMinWidths
|
||||
rcall wSetChildrenHeightsFromMinHeights
|
||||
|
||||
; count number of expandable children
|
||||
ldi r16, (1<<WID_OPTIONS1_BIT_STRETCH_Y) ; value
|
||||
ldi r17, (1<<WID_OPTIONS1_BIT_STRETCH_Y) ; mask
|
||||
rcall widgetCountVisibleChildrenWithOptions1 ; r18=number of matching visible children (r24, r25, X)
|
||||
tst r18
|
||||
breq wVLayout_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 wVLayout_heightTooSmall ; jmp if too small
|
||||
ldd r17, Y+WID_OFFS_BORDER_BOT ; subtract bottom border
|
||||
sub r20, r17
|
||||
sbc r21, r16
|
||||
brcs wVLayout_heightTooSmall ; jmp if too small
|
||||
|
||||
sub r20, r18 ; r21:r20 = HEIGHT-SUM_OF_VIS_CHILDREN_HEIGHTS
|
||||
sbc r21, r19
|
||||
brcc wVLayout_heightTooSmall
|
||||
breq wVLayout_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
|
||||
|
||||
wVLayout_yDone:
|
||||
rcall wSetRelYFromHeightInVisibleChildren
|
||||
rcall wAlignChildrenHorizontally
|
||||
; rcall wSetAbsoluteCoords call in GUI loop after calling layout on all widgets
|
||||
wVLayout_heightTooSmall:
|
||||
; TODO: how to handle this case?
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
wSetAbsoluteCoords:
|
||||
Widget_SetAbsoluteCoords:
|
||||
push yl
|
||||
push yh
|
||||
wSetAbsoluteCoords_loop:
|
||||
Widget_SetAbsoluteCoords_loop:
|
||||
ldd r18, Y+OBJ_OFFS_OPTIONS
|
||||
andi r18, WID_OPTIONS0_BIT_VISIBLE
|
||||
breq wSetAbsoluteCoords_nextSibling
|
||||
breq Widget_SetAbsoluteCoords_nextSibling
|
||||
push yl
|
||||
push yh
|
||||
bigcall Tree_GetParentObject
|
||||
@@ -219,14 +183,14 @@ wSetAbsoluteCoords_loop:
|
||||
clr r21
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wSetAbsoluteCoords_r1820set
|
||||
breq Widget_SetAbsoluteCoords_r1820set
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
ldd r18, Y+WID_OFFS_ABS_X_LO
|
||||
ldd r19, Y+WID_OFFS_ABS_X_HI
|
||||
ldd r20, Y+WID_OFFS_ABS_Y_LO
|
||||
ldd r21, Y+WID_OFFS_ABS_Y_HI
|
||||
wSetAbsoluteCoords_r1820set:
|
||||
Widget_SetAbsoluteCoords_r1820set:
|
||||
pop yh
|
||||
pop yl
|
||||
; handle X
|
||||
@@ -244,152 +208,17 @@ wSetAbsoluteCoords_r1820set:
|
||||
std Y+WID_OFFS_ABS_Y_LO, r16
|
||||
std Y+WID_OFFS_ABS_Y_HI, r17
|
||||
bigcall Tree_GetObjectBelow
|
||||
rjmp wSetAbsoluteCoords_loopEnd
|
||||
wSetAbsoluteCoords_nextSibling:
|
||||
rjmp Widget_SetAbsoluteCoords_loopEnd
|
||||
Widget_SetAbsoluteCoords_nextSibling:
|
||||
bigcall Tree_GetNextSibling
|
||||
wSetAbsoluteCoords_loopEnd:
|
||||
Widget_SetAbsoluteCoords_loopEnd:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wSetAbsoluteCoords_end
|
||||
breq Widget_SetAbsoluteCoords_end
|
||||
mov yl, xl
|
||||
mov yh, xh
|
||||
rjmp wSetAbsoluteCoords_loop
|
||||
wSetAbsoluteCoords_end:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine wAlignChildrenHorizontally
|
||||
;
|
||||
; Horizontally align children within the width of the parent widget.
|
||||
; Only changes Y+WID_OFFS_REL_X_LO/HI.
|
||||
;
|
||||
; @param Y pointer to object SRAM
|
||||
; @clobbers r16, r17, r18, r19, r24, r25
|
||||
|
||||
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)
|
||||
wAlignChildrenHorizontally_loop:
|
||||
mov r17, xl
|
||||
or r17, xh
|
||||
breq wAlignChildrenHorizontally_loopEnd
|
||||
mov yl, xl
|
||||
mov yh, yl
|
||||
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
|
||||
sbrc r16, WID_OPTIONS1_BIT_STRETCH_X
|
||||
rjmp wAlignHorizontally_stretch
|
||||
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
|
||||
wAlignHorizontally_stretch:
|
||||
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 wSetRelYFromHeightInVisibleChildren_loop
|
||||
wSetRelYFromHeightInVisibleChildren_loopEnd:
|
||||
mov r18, r24
|
||||
mov r19, r25
|
||||
rjmp Widget_SetAbsoluteCoords_loop
|
||||
Widget_SetAbsoluteCoords_end:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
@@ -400,371 +229,6 @@ wSetRelYFromHeightInVisibleChildren_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
|
||||
|
||||
|
||||
#endif ; AQH_AVR_WIN_WIDGET_H
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user