gui: sorted files. started working on TextSel class.

This commit is contained in:
Martin Preuss
2026-05-23 01:43:04 +02:00
parent 4b13f16e05
commit 710162e242
14 changed files with 864 additions and 7 deletions

View File

@@ -531,18 +531,19 @@ GUI_MODULE_BEGIN:
.include "modules/lcd2/gui/base/hlayout.asm"
.include "modules/lcd2/gui/base/vlayout.asm"
.include "modules/lcd2/gui/base/mclayout.asm"
.include "modules/lcd2/gui/base/hspinner.asm"
.include "modules/lcd2/gui/base/mainwindow.asm"
.include "modules/lcd2/gui/composite/hspinner.asm"
.include "modules/lcd2/gui/composite/mainwindow.asm"
.include "modules/lcd2/gui/base/keypad.asm"
.include "modules/lcd2/gui/base/keypad_num.asm"
.include "modules/lcd2/gui/base/d_numinput.asm"
.include "modules/lcd2/gui/composite/d_numinput.asm"
.include "modules/lcd2/gui/base/cwidget.asm"
.include "modules/lcd2/gui/base/dialog.asm"
.include "modules/lcd2/gui/base/cdialog.asm"
.include "modules/lcd2/gui/composite/dialog.asm"
.include "modules/lcd2/gui/composite/cdialog.asm"
.include "modules/lcd2/gui/aqhome/sensorwatch.asm"
.include "modules/lcd2/gui/aqhome/lightsettings.asm"
.include "modules/lcd2/gui/aqhome/d_light_conns.asm"
.include "modules/lcd2/gui/aqhome/d_nodevalueid.asm"
.include "modules/lcd2/gui/composite/textsel.asm"
.include "modules/lcd2/gui/screensavers/simple.asm"
GUI_MODULE_END:
.equ MODULE_SIZE_GUI = GUI_MODULE_END-GUI_MODULE_BEGIN

View File

@@ -5,6 +5,7 @@
<subdirs>
aqhome
base
composite
screensavers
</subdirs>

View File

@@ -4,19 +4,29 @@
<extradist>
button.asm
buttongroup.asm
checkbox.asm
cwidget.asm
guiapp.asm
hbuttongroup.asm
hlayout.asm
imagebutton.asm
imagelabel.asm
imageview.asm
keypad.asm
keypad_num.asm
label.asm
layout.asm
mainwindow.asm
mclayout.asm
object.asm
rootwindow.asm
textbutton.asm
tile.asm
valuelabel.asm
vlayout.asm
widget.asm
wlist.asm
wlist_elem.asm
</extradist>
</gwbuild>

View File

@@ -156,7 +156,7 @@ OBJ_Fini:
; CAVEAT: Y is invalid after return!
;
; @param Y address of object in SDRAM
; @clobbers none
; @clobbers any, !Y
OBJ_Free:
tst yl
@@ -1111,6 +1111,42 @@ OBJ_CountDirectChildren_done:
; ---------------------------------------------------------------------------
; @routine OBJ_FreeChildren @global
;
; @param Y address of object whose children are to be free'd
; @clobbers any, !Y
OBJ_FreeChildren:
push yl
push yh
clr r16
rcall OBJ_GetFirstChild
brcc OBJ_FreeChildren_done
OBJ_FreeChildren_loop:
mov yl, r18
mov yh, r19
rcall OBJ_GetNext
brcs OBJ_FreeChildren_loopFree
clr r18
clr r19
OBJ_FreeChildren_loopFree:
push r18
push r19
rcall OBJ_Free
pop r19
pop r18
mov r16, r18
or r16, r19
brne OBJ_FreeChildren_loop
OBJ_FreeChildren_done:
pop yh
pop yl
ret
; @end
; ***************************************************************************
; data in FLASH

View File

@@ -1089,6 +1089,7 @@ Widget_DrawCharAt:
; @param R5:R4 X relative to widget
; @param R7:R6 Y relative to widget
; @return Z pointer to next char to write if CFLAG clear
; @return R5:R4 X pos behind last written char
; @clobbers any, !Y
Widget_DrawTextFlash:
@@ -1127,6 +1128,7 @@ Widget_DrawTextRam:
; @param Z byte address pointer to text in flash (for LPM!)
; @return CFLAG set if completely written
; @return Z pointer to next char to write if CFLAG clear
; @return R5:R4 X pos behind last written char
; @clobbers any, !Y
Widget_DrawColoredTextFlash:

View File

@@ -0,0 +1,200 @@
; ***************************************************************************
; copyright : (C) 2026 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. *
; ***************************************************************************
#ifndef AQH_AVR_GUI2_WLIST_ASM
#define AQH_AVR_GUI2_WLIST_ASM
; ***************************************************************************
; defines
.equ WLIST_OFFS_BEGIN = VLAYOUT_SIZE
.equ WLIST_OFFS_ELEMLIST_LO = VLAYOUT_OFFS_BEGIN+0
.equ WLIST_OFFS_ELEMLIST_HI = VLAYOUT_OFFS_BEGIN+1
.equ WLIST_OFFS_ELEMOFFSET = VLAYOUT_OFFS_BEGIN+2
.equ WLIST_OFFS_ELEMNUM = VLAYOUT_OFFS_BEGIN+3
.equ WLIST_SIZE = VLAYOUT_OFFS_BEGIN+4
; signals
.equ WLIST_SIGNAL_MKOBJECT = WIDGET_SIGNAL_NEXTFREE+0
.equ WLIST_SIGNAL_NEXTFREE = WIDGET_SIGNAL_NEXTFREE+1
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine WList_new @global
;
; @return CFLAG set of okay, cleared otherwise
; @return Y address of newly created object
; @param X parent widget
; @param r16 value for OBJECT_OFFS_OPTS
; @param r17 value for WIDGET_OFFS_PACK
; @clobbers any
WList_new:
ldi r24, LOW(VLAYOUT_SIZE)
ldi r25, HIGH(VLAYOUT_SIZE)
bigcall Object_Alloc ; (!r16, !r17, !X)
brcc WList_new_ret
rcall WList_Init ; (r16, r17, X)
sec
WList_new_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine WList_Init @global
;
; @param Y address of widget
; @param X parent widget (if any)
; @param r16 value for OBJECT_OFFS_OPTS
; @param r17 value for WIDGET_OFFS_PACK
; @clobbers r16, r17, X
WList_Init:
; call base class
ldi r20, VLAYOUT_MODE_EXPAND
bigcall VLayout_Init ; (r16, r17, X)
; set widget-specific data
; set default signal map
ldi r16, LOW(WList_DefaultSignalmap*2)
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
ldi r16, HIGH(WList_DefaultSignalmap*2)
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
ret
; @end
wListRebuild:
; release current widgets
bigcall OBJ_FreeChildren ; (any, !Y)
rcall wListGetStartElement
brcc wListRebuild_ret
; get startY and height
bigcall Widget_GetBorderAndSpacing
mov r6, r23 ; YPOS (start after border)
clr r7
ldd r10, Y+WIDGET_OFFS_HEIGHT_LO
ldd r11, Y+WIDGET_OFFS_HEIGHT_HI
sub r10, r23
sbc r11, r23
add r11, r23
wListRebuild_loop:
; check height (does element fit?)
adiw xh:xl, WLIST_ELEM_OFFS_HEIGHT_LO
ld r18, X+
ld r19, X
sbiw xh:xl, (WLIST_ELEM_OFFS_HEIGHT_LO+1)
add r18, r6 ; height+currentY
adc r19, r7
cp r18, r10
cpc r19, r11
brcc wListRebuild_ret ; outside window, done
; create child widget for item
push r6
push r7
push r10
push r11
push r22
push xl
push xh
ldi r16, WLIST_SIGNAL_MKOBJECT ; in: list element
clr r17
bigcall OBJ_HandleSignal ; out: r19:r18=result (if CFLAG set)
pop xh
pop xl
pop r22
pop r11
pop r10
pop r7
pop r6
brcc wListRebuild_ret
; increment Y
adiw xh:xl, WLIST_ELEM_OFFS_HEIGHT_LO
ld r18, X+
ld r19, X
sbiw xh:xl, (WLIST_ELEM_OFFS_HEIGHT_LO+1)
add r6, r18 ; add item height
adc r7, r19
add r6, r22 ; add spacing
adc r7, r22
sub r7, r22
; next element
ld r16, X+
ld r17, X
mov xl, r16
mov xh, r17
or r16, r17
brne wListRebuild_loop
wListRebuild_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine wListGetStartElement @global
;
; @param Y address of widget
; @return CFLAG set if start element found, cleared otherwise
; @return X pointer to start element
wListGetStartElement:
push yl
push yh
ldd r16, Y+WLIST_OFFS_ELEMOFFSET
ldd r17, Y+WLIST_OFFS_ELEMLIST_LO
ldd yh, Y+WLIST_OFFS_ELEMLIST_HI
mov yl, r17
bigcall List_GetItemAt ; X=element at (r16, r17)
pop yh
pop yl
ret
; @end
; ***************************************************************************
; data in FLASH
WList_DefaultSignalmap:
; header
.dw VLayout_DefaultSignalmap*2 ; next table to use
; entries
.db 0, 0, 0, 0 ; end of table
#endif

View File

@@ -0,0 +1,86 @@
; ***************************************************************************
; copyright : (C) 2026 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. *
; ***************************************************************************
#ifndef AQH_AVR_GUI_WLIST_ELEM_ASM
#define AQH_AVR_GUI_WLIST_ELEM_ASM
; ***************************************************************************
; defines
.equ WLIST_ELEM_OFFS_BEGIN = LIST_SIZE
.equ WLIST_ELEM_OFFS_IMGRES_LO = WLIST_ELEM_OFFS_BEGIN+0
.equ WLIST_ELEM_OFFS_IMGRES_HI = WLIST_ELEM_OFFS_BEGIN+1
.equ WLIST_ELEM_OFFS_TXTRES_LO = WLIST_ELEM_OFFS_BEGIN+2
.equ WLIST_ELEM_OFFS_TXTRES_HI = WLIST_ELEM_OFFS_BEGIN+3
.equ WLIST_ELEM_OFFS_USER_LO = WLIST_ELEM_OFFS_BEGIN+4
.equ WLIST_ELEM_OFFS_USER_HI = WLIST_ELEM_OFFS_BEGIN+5
.equ WLIST_ELEM_OFFS_HEIGHT_LO = WLIST_ELEM_OFFS_BEGIN+6
.equ WLIST_ELEM_OFFS_HEIGHT_HI = WLIST_ELEM_OFFS_BEGIN+7
.equ WLIST_ELEM_SIZE = WLIST_ELEM_OFFS_BEGIN+8
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine WidgetListElem_new @global
;
; @return Y address of created object
WidgetListElem_new:
ldi r24, LOW(WLIST_ELEM_SIZE)
ldi r25, HIGH(WLIST_ELEM_SIZE)
bigcall Heap_AllocAndZero
brcc WidgetListElem_new_ret
mov yl, xl
mov yh, xh
bigcall List_InitObject ; (r16)
sec
ret
WidgetListElem_new_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine WidgetListElem_free @global
;
; @param Y address of object
; @clobbers r16, r17, r24, r25, X
WidgetListElem_free:
tst yl
brne WidgetListElem_free_notNull
tst yh
brne WidgetListElem_free_notNull
rjmp WidgetListElem_free_ret
WidgetListElem_free_notNull:
bigcall List_FiniObject ; (r16)
mov xl, yl
mov xh, yh
bigcall Heap_Free ; (r16, r17, r24, r25, X)
WidgetListElem_free_ret:
ret
; @end
#endif

View File

@@ -0,0 +1,15 @@
<?xml?>
<gwbuild>
<extradist>
cdialog.asm
d_numinput.asm
dialog.asm
hspinner.asm
mainwindow.asm
</extradist>
</gwbuild>

View File

@@ -0,0 +1,506 @@
; ***************************************************************************
; copyright : (C) 2026 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. *
; ***************************************************************************
#ifndef AQH_AVR_GUI_TEXTSEL_ASM
#define AQH_AVR_GUI_TEXTSEL_ASM
; ***************************************************************************
; ***************************************************************************
; ***************************************************************************
; defines
.equ TEXTSEL_OFFS_BEGIN = HLAYOUT_SIZE
.equ TEXTSEL_OFFS_CURVALUE_LO = TEXTSEL_OFFS_BEGIN+0
.equ TEXTSEL_OFFS_CURVALUE_HI = TEXTSEL_OFFS_BEGIN+1
.equ TEXTSEL_OFFS_TEXTLIST_LO = TEXTSEL_OFFS_BEGIN+2
.equ TEXTSEL_OFFS_TEXTLIST_HI = TEXTSEL_OFFS_BEGIN+3
.equ TEXTSEL_OFFS_CURRIDX = TEXTSEL_OFFS_BEGIN+4
.equ TEXTSEL_OFFS_COUNT = TEXTSEL_OFFS_BEGIN+5
.equ TEXTSEL_SIZE = TEXTSEL_OFFS_BEGIN+6
; selectors
.equ TEXTSEL_SEL_LEFT = 1
.equ TEXTSEL_SEL_RIGHT = 2
; child widgets
.equ TEXTSEL_CHILDIDX_LEFT = 0
.equ TEXTSEL_CHILDIDX_VALUE = 1
.equ TEXTSEL_CHILDIDX_EIGHT = 2
; ***************************************************************************
; code
.cseg
; ---------------------------------------------------------------------------
; @routine TextSel_new @global
;
; @return CFLAG set of okay, cleared otherwise
; @return Y address of newly created object
; @param X parent widget
; @param r16 value for OBJECT_OFFS_OPTS
; @param r17 value for WIDGET_OFFS_PACK
; @param r21:r20 pointer to null-terminated list of text ressources in FLASH (byte address for LPM!)
; @clobbers any
TextSel_new:
ldi r24, LOW(TEXTSEL_SIZE)
ldi r25, HIGH(TEXTSEL_SIZE)
push r20
push r21
bigcall Object_Alloc ; (!r16, !r17, !X)
pop r21
pop r20
brcc TextSel_new_ret
rcall TextSel_Init ; (any, !Y)
sec
TextSel_new_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine TextSel_Init @global
;
; @param Y address of widget
; @param X parent widget (if any)
; @param r16 value for OBJECT_OFFS_OPTS
; @param r17 value for WIDGET_OFFS_PACK
; @param r21:r20 pointer to null-terminated list of text ressources in FLASH (byte address for LPM!)
; @clobbers any, !Y
TextSel_Init:
; call base class
push r20
push r21
ldi r20, HLAYOUT_MODE_EXPAND
bigcall HLayout_Init
pop r21
pop r20
brcc TextSel_Init_ret
; set values
std Y+TEXTSEL_OFFS_TEXTLIST_LO, r20
std Y+TEXTSEL_OFFS_TEXTLIST_HI, r21
; set default signal map
ldi r16, LOW(TextSel_DefaultSignalmap*2)
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
ldi r16, HIGH(TextSel_DefaultSignalmap*2)
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
rcall textSelCreateChildren ; (any, !Y)
TextSel_Init_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine textSelCreateChildren
;
; @param Y spinner object
; @clobbers any, !Y
textSelCreateChildren:
push yl
push yh
mov xl, yl ; parent
mov xh, yh
; create left button
call textSelCreateLeftButton
brcc textSelCreateChildren_popRet
; create label
ldi r16, 0 ; OPTS
ldi r17, (WIDGET_PACK_END<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VSELF0_BIT) | \
(WIDGET_PACK_END<<WIDGET_PACK_HCONTENT0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT) ; PACK
clr r20
clr r21
push xl
push xh
bigcall Label_new
pop xh
pop xl
brcc textSelCreateChildren_popRet
; create right button
call textSelCreateRightButton
textSelCreateChildren_popRet:
pop yh
pop yl
ret
; @end
textSelCreateLeftButton:
push xl
push xh
; create button
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT) ; OPTS
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSOURCE_TXT_LESSERTHAN_C) ; text ressource
ldi r21, HIGH(RESSOURCE_TXT_LESSERTHAN_C)
ldi r22, TEXTSEL_SEL_LEFT ; selector
ldi r23, BUTTON_MODE_REPEATED
bigcall TextButton_new
brcc textSelCreateLeftButton_done
; set style in Label part of the text button
bigcall OBJ_GetFirstChild
brcc textSelCreateLeftButton_done
mov yl, r18
mov yh, r19
ldi r16, LOW(TextSel_ButtonStyle*2)
std Y+WIDGET_OFFS_STYLE_LO, r16
ldi r16, HIGH(TextSel_ButtonStyle*2)
std Y+WIDGET_OFFS_STYLE_HI, r16
textSelCreateLeftButton_done:
pop xh
pop xl
ret
; @end
textSelCreateRightButton:
push xl
push xh
; create button
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT) ; OPTS
ldi r17, (WIDGET_PACK_BEGIN<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VSELF0_BIT) ; PACK
ldi r20, LOW(RESSOURCE_TXT_GREATERTHAN_C) ; text ressource
ldi r21, HIGH(RESSOURCE_TXT_GREATERTHAN_C)
ldi r22, TEXTSEL_SEL_RIGHT ; selector
ldi r23, BUTTON_MODE_REPEATED
bigcall TextButton_new
brcc textSelCreateRightButton_done
; set style in Label part of the text button
bigcall OBJ_GetFirstChild
brcc textSelCreateRightButton_done
mov yl, r18
mov yh, r19
ldi r16, LOW(TextSel_ButtonStyle*2)
std Y+WIDGET_OFFS_STYLE_LO, r16
ldi r16, HIGH(TextSel_ButtonStyle*2)
std Y+WIDGET_OFFS_STYLE_HI, r16
textSelCreateRightButton_done:
pop xh
pop xl
ret
; @end
; ---------------------------------------------------------------------------
; @routine textSelSetValue
;
; @param Y widget
; @param X new value
; @clobbers any, !Y
textSelSetValue:
std Y+TEXTSEL_OFFS_CURVALUE_LO, xl
std Y+TEXTSEL_OFFS_CURVALUE_HI, xh
rjmp textSelSendValue
; @end
textSelSendValue:
ldi r16, TEXTSEL_CHILDIDX_VALUE
bigcall OBJ_GetChildAt ; r19:r18=value label (r16)
brcc textSelSendValue_ret
push yl
push yh
ldd xl, Y+TEXTSEL_OFFS_CURVALUE_LO
ldd xh, Y+TEXTSEL_OFFS_CURVALUE_HI
mov yl, r18
mov yh, r19
ldi r17, LABEL_VALUE_TEXTRES
bigcall Widget_SetValue ; (any, !Y)
pop yh
pop yl
rcall textSelEmitCmdSignal
textSelSendValue_ret:
ret
; @end
; ---------------------------------------------------------------------------
; @routine textSelEmitCmdSignal
;
; @param Y widget
; @clobbers any, !Y
textSelEmitCmdSignal:
ldi r16, WIDGET_SIGNAL_COMMAND
ldd xl, Y+TEXTSEL_OFFS_CURVALUE_LO
ldd xh, Y+TEXTSEL_OFFS_CURVALUE_HI
bigjmp OBJ_EmitSignal
; @end
; ---------------------------------------------------------------------------
; @routine textCountRessources
;
; @param Y widget
; @clobbers r16-r19
textCountRessources:
push zl
push zh
ldd zl, Y+TEXTSEL_OFFS_TEXTLIST_LO
ldd zh, Y+TEXTSEL_OFFS_TEXTLIST_HI
mov r16, zl
or r16, zh
breq textCountRessources_done
clr r17
textCountRessources_loop:
lpm r18, Z+
lpm r19, Z+
mov r16, r18
or r16, r19
breq textCountRessources_done
inc r17
rjmp textCountRessources_loop
textCountRessources_done:
pop zh
pop zl
std Y+TEXTSEL_OFFS_COUNT, r17
ret
; @end
; ---------------------------------------------------------------------------
; @routine textSelGetRessIdAt
;
; @param Y widget
; @param r16 idx
; @return CFLAG set if ressource id found
; @return X ressource id (if CFLAG set)
; @clobbers r16, r17
textSelGetRessIdAt:
push zl
push zh
ldd r17, Y+TEXTSEL_OFFS_COUNT
cp r16, r17
brcc textSelGetRessIdAt_done
add r16, r16
ldd zl, Y+TEXTSEL_OFFS_TEXTLIST_LO
ldd zh, Y+TEXTSEL_OFFS_TEXTLIST_HI
mov r17, zl
or r17, zh
clc
breq textSelGetRessIdAt_done
add zl, r16
adc zh, r16
sub zh, r16
lpm xl, Z+
lpm xh, Z
mov r17, xl
or r17, xh
clc
breq textSelGetRessIdAt_done
sec
textSelGetRessIdAt_done:
pop zh
pop zl
ret
; @end
; ---------------------------------------------------------------------------
; @routine textGetIdxForRessource
;
; @param Y widget
; @param X ressource id to look for
; @return CFLAG set if found, cleared otherwise
; @return r16 idx
textGetIdxForRessource:
push zl
push zh
ldd zl, Y+TEXTSEL_OFFS_TEXTLIST_LO
ldd zh, Y+TEXTSEL_OFFS_TEXTLIST_HI
mov r16, zl
or r16, zh
breq textGetIdxForRessource_done
clr r16
textGetIdxForRessource_loop:
lpm r18, Z+
lpm r19, Z+
mov r17, r18
or r17, r19
clc
breq textGetIdxForRessource_done
cp r18, xl
brne textGetIdxForRessource_next
cp r19, xh
brne textGetIdxForRessource_next
sec
rjmp textGetIdxForRessource_done
textGetIdxForRessource_next:
inc r16
rjmp textGetIdxForRessource_loop
textGetIdxForRessource_done:
pop zh
pop zl
ret
; @end
; ***************************************************************************
; signal handlers
; ---------------------------------------------------------------------------
; @routine TextSel_OnCmdLeft @global
;
; @param Y widget
TextSel_OnCmdLeft:
ldd r16, Y+TEXTSEL_OFFS_CURRIDX
tst r16
breq TextSel_OnCmdLeft_ret
dec r16
std Y+TEXTSEL_OFFS_CURRIDX, r16
rcall textSelGetRessIdAt ; X=ressource id (r16, r17)
brcc TextSel_OnCmdLeft_ret
std Y+TEXTSEL_OFFS_CURVALUE_LO, xl
std Y+TEXTSEL_OFFS_CURVALUE_HI, xh
rcall textSelSetValue
TextSel_OnCmdLeft_ret:
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine TextSel_OnCmdRight @global
;
; @param Y widget
TextSel_OnCmdRight:
ldd r16, Y+TEXTSEL_OFFS_CURRIDX
ldd r17, Y+TEXTSEL_OFFS_COUNT
inc r16
cp r16, r17
brcc TextSel_OnCmdRight_ret
std Y+TEXTSEL_OFFS_CURRIDX, r16
rcall textSelGetRessIdAt ; X=ressource id (r16, r17)
brcc TextSel_OnCmdRight_ret
std Y+TEXTSEL_OFFS_CURVALUE_LO, xl
std Y+TEXTSEL_OFFS_CURVALUE_HI, xh
rcall textSelSetValue
TextSel_OnCmdRight_ret:
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine TextSel_OnSetValue @global
;
; @param Y widget
; @param X new value (selected text ressource id)
TextSel_OnSetValue:
rcall textGetIdxForRessource
brcc TextSel_OnSetValue_ret
std Y+TEXTSEL_OFFS_CURRIDX, r16
std Y+TEXTSEL_OFFS_CURVALUE_LO, xl
std Y+TEXTSEL_OFFS_CURVALUE_HI, xh
rcall textSelSendValue
TextSel_OnSetValue_ret:
sec
ret
; @end
; ---------------------------------------------------------------------------
; @routine TextSel_OnGetValue @global
;
; @param Y widget
; @return r19:r18 value
TextSel_OnGetValue:
ldd r18, Y+TEXTSEL_OFFS_CURVALUE_LO
ldd r19, Y+TEXTSEL_OFFS_CURVALUE_HI
sec
ret
; @end
; ***************************************************************************
; data in FLASH
TextSel_ButtonStyle:
.dw DISPLAY_COLOR_BLACK ; frontCol_norm
.dw DISPLAY_COLOR_WHITE ; backCol_norm
.dw DISPLAY_COLOR_BLACK ; borderCol_norm
.dw DISPLAY_COLOR_WHITE ; shadowCol_norm
.dw DISPLAY_COLOR_WHITE ; frontCol_activated
.dw DISPLAY_COLOR_NAVY ; backCol_activated
.dw DISPLAY_COLOR_BLACK ; borderCol_activated
.dw DISPLAY_COLOR_WHITE ; shadowCol_activated
.db 6, 0 ; outerBorderSize, innerBorderSize
.dw ili9341Font12x16_1*2 ; font
.db 12, 16 ; charWidth, charHeight
; @end
TextSel_DefaultSignalmap:
; header
.dw HLayout_DefaultSignalmap*2 ; next table to use
; entries
.db TEXTSEL_SEL_LEFT, WIDGET_SIGNAL_COMMAND, LOW(TextSel_OnCmdLeft), HIGH(TextSel_OnCmdLeft)
.db TEXTSEL_SEL_RIGHT, WIDGET_SIGNAL_COMMAND, LOW(TextSel_OnCmdRight), HIGH(TextSel_OnCmdRight)
.db WIDGET_VALUE_CURRENTVALUE, WIDGET_SIGNAL_SETVALUE, LOW(TextSel_OnSetValue), HIGH(TextSel_OnSetValue)
.db WIDGET_VALUE_CURRENTVALUE, WIDGET_SIGNAL_GETVALUE, LOW(TextSel_OnGetValue), HIGH(TextSel_OnGetValue)
.db 0, 0, 0, 0 ; end of table
#endif