gui: sorted files. started working on TextSel class.
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
; ***************************************************************************
|
||||
; 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_BASE_CDIALOG_ASM
|
||||
#define AQH_AVR_GUI_BASE_CDIALOG_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
; CDIALOG data
|
||||
.equ CDIALOG_OFFS_BEGIN = DIALOG_SIZE
|
||||
.equ CDIALOG_OFFS_CONFIG_LO = CDIALOG_OFFS_BEGIN+0
|
||||
.equ CDIALOG_OFFS_CONFIG_HI = CDIALOG_OFFS_BEGIN+1
|
||||
.equ CDIALOG_SIZE = CDIALOG_OFFS_BEGIN+2
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine CDialog_Init @global
|
||||
;
|
||||
; @param Y pointer to MainWindow
|
||||
; @param X pointer to root window
|
||||
; @param r16 value for OBJECT_OFFS_OPTS
|
||||
; @param R21:R20 title ressource
|
||||
; @param r23:r22 pointer to settings (byte addr for LPM!)
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @clobbers any, !Y
|
||||
|
||||
CDialog_Init:
|
||||
push r22
|
||||
push r23
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
bigcall Dialog_Init
|
||||
pop r23
|
||||
pop r22
|
||||
brcc CDialog_Init_ret
|
||||
|
||||
; store config
|
||||
std Y+CDIALOG_OFFS_CONFIG_LO, r22
|
||||
std Y+CDIALOG_OFFS_CONFIG_HI, r23
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(CDialog_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(CDialog_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
CDialog_Init_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine CDialog_CreateContent @global
|
||||
;
|
||||
; @param Y pointer to MainWindow
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @clobbers any, !Y
|
||||
|
||||
CDialog_CreateContent:
|
||||
; create content
|
||||
bigcall MainWindow_GetContentWidget ; r19:r18=content window
|
||||
brcc CDialog_CreateContent_ret
|
||||
mov xl, r18 ; use content window as parent
|
||||
mov xh, r19
|
||||
push zl
|
||||
push zh
|
||||
push xl ; content window
|
||||
push xh
|
||||
ldd zl, Y+CDIALOG_OFFS_CONFIG_LO
|
||||
ldd zh, Y+CDIALOG_OFFS_CONFIG_HI
|
||||
push yl ; main window
|
||||
push yh
|
||||
ldi r16, 0
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT)
|
||||
bigcall CWidget_Create
|
||||
pop yh
|
||||
pop yl
|
||||
pop xh
|
||||
pop xl
|
||||
pop zh
|
||||
pop zl
|
||||
CDialog_CreateContent_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine CDialog_GetChildBySelector
|
||||
;
|
||||
; @param Y pointer to MainWindow
|
||||
; @param r16 selector to search for
|
||||
; @return CFLAG set if widget found, cleared otherwise
|
||||
; @return r19:r18 resulting widget
|
||||
; @clobbers R16-R19
|
||||
|
||||
CDialog_GetChildBySelector:
|
||||
push r16
|
||||
bigcall MainWindow_GetFirstChildOfContentWidget ; r19:r18=result (r16)
|
||||
pop r16
|
||||
brcc CDialog_GetChildBySelector_ret
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall OBJ_GetChildBySelector ; (R17, R18, R19)
|
||||
pop yh
|
||||
pop yl
|
||||
CDialog_GetChildBySelector_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine CDialog_SetChildValue
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @param X new value
|
||||
; @param R16 selector of child to set value to
|
||||
; @clobbers any, !Y, !Z
|
||||
|
||||
CDialog_SetChildValue:
|
||||
rcall CDialog_GetChildBySelector ; r19:r18=result (R16-R19)
|
||||
brcc CDialog_SetChildValue_ret
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall Widget_SetCurrentValue
|
||||
pop yh
|
||||
pop yl
|
||||
CDialog_SetChildValue_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine CDialog_GetChildValue
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @param R16 selector of child to set value to
|
||||
; @clobbers any, !Y, !Z
|
||||
|
||||
CDialog_GetChildValue:
|
||||
rcall CDialog_GetChildBySelector ; r19:r18=result (R16-R19)
|
||||
brcc CDialog_GetChildValue_retZero
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall Widget_GetCurrentValue
|
||||
pop yh
|
||||
pop yl
|
||||
brcs CDialog_GetChildValue_ret
|
||||
CDialog_GetChildValue_retZero:
|
||||
clr r18
|
||||
clr r19
|
||||
CDialog_GetChildValue_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_OnMkContent @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
CDialog_OnMkContent:
|
||||
rcall CDialog_CreateContent
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CDialog_DefaultSignalmap:
|
||||
; header
|
||||
.dw Dialog_DefaultSignalmap*2 ; next table to use
|
||||
; entries
|
||||
.db 0, DIALOG_SIGNAL_MKCONTENT, LOW(CDialog_OnMkContent), HIGH(CDialog_OnMkContent)
|
||||
; end of table
|
||||
.db 0, 0, 0, 0
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
; ***************************************************************************
|
||||
; 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_BASE_D_NUMINPUT_ASM
|
||||
#define AQH_AVR_GUI_BASE_D_NUMINPUT_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
.equ DLGNUMINPUT_OFFS_BEGIN = MAINWINDOW_SIZE
|
||||
.equ DLGNUMINPUT_SIZE = DLGNUMINPUT_OFFS_BEGIN+0
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine DlgNumInput_new @global
|
||||
;
|
||||
; @param Y pointer to GUIAPP
|
||||
; @param r21:r20 ressource id for title
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @return Y address of newly created object
|
||||
|
||||
DlgNumInput_new:
|
||||
bigcall GuiApp_GetRootWindow
|
||||
brcc DlgNumInput_new_ret
|
||||
push r20
|
||||
push r21
|
||||
mov xl, r18 ; use root window as parent for main window
|
||||
mov xh, r19
|
||||
ldi r24, LOW(DLGNUMINPUT_SIZE)
|
||||
ldi r25, HIGH(DLGNUMINPUT_SIZE)
|
||||
bigcall Object_Alloc ; Y=space (!r16, !r17, !X)
|
||||
pop r21
|
||||
pop r20
|
||||
brcc DlgNumInput_new_ret
|
||||
rcall DlgNumInput_Init
|
||||
DlgNumInput_new_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine DlgNumInput_Init @global
|
||||
;
|
||||
; @param Y pointer to newly allocated widget data
|
||||
; @param X pointer to root window
|
||||
; @param r21:r20 ressource id for title
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @clobbers any, !Y
|
||||
|
||||
DlgNumInput_Init:
|
||||
ldi r16, 0 ; OPTS
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
bigcall MainWindow_new ; Y=main window
|
||||
brcc DlgNumInput_Init_ret
|
||||
|
||||
bigcall MainWindow_GetContentWidget ; r19:r18=content window
|
||||
brcc DlgNumInput_Init_ret
|
||||
mov xl, r18 ; use content window as parent
|
||||
mov xh, r19
|
||||
|
||||
; Y=MainWindow
|
||||
push yl ; main window
|
||||
push yh
|
||||
push xl ; content window
|
||||
push xh
|
||||
rcall dlgNumInputCreateContent
|
||||
pop xh ; content window
|
||||
pop xl
|
||||
; TODO: create button line (OK, ABORT)
|
||||
bigcall C03App_CreateBackButton
|
||||
pop yh ; main window
|
||||
pop yl
|
||||
DlgNumInput_Init_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine dlgNumInputCreateContent
|
||||
;
|
||||
; @param Y pointer to this main window
|
||||
; @param X pointer to content window of this MainWindow (is a VLayout, becomes parent)
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
|
||||
dlgNumInputCreateContent:
|
||||
; create input field
|
||||
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
|
||||
ldi r17, (WIDGET_PACK_CENTER<<WIDGET_PACK_HSELF0_BIT) | \
|
||||
(WIDGET_PACK_BEGIN <<WIDGET_PACK_VSELF0_BIT) | \
|
||||
(WIDGET_PACK_END <<WIDGET_PACK_HCONTENT0_BIT) | \
|
||||
(WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT) ; PACK
|
||||
clr r20 ; number of postkomma digits
|
||||
ldi r21, 10 ; max number of digits
|
||||
push xl
|
||||
push xh
|
||||
bigcall ValueLabel_new
|
||||
pop xh
|
||||
pop xl
|
||||
brcc dlgNumInputCreateContent_ret
|
||||
|
||||
; create numeric keypad
|
||||
ldi r16, (1<<WIDGET_OPTS_BORDER_BIT)
|
||||
ldi r17, (WIDGET_PACK_CENTER<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) | \
|
||||
(WIDGET_PACK_CENTER <<WIDGET_PACK_HCONTENT0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT)
|
||||
push xl
|
||||
push xh
|
||||
bigcall NumKeyPad_new
|
||||
pop xh
|
||||
pop xl
|
||||
brcc dlgNumInputCreateContent_ret
|
||||
|
||||
sec
|
||||
dlgNumInputCreateContent_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,399 +0,0 @@
|
||||
; ***************************************************************************
|
||||
; 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_BASE_DIALOG_ASM
|
||||
#define AQH_AVR_GUI_BASE_DIALOG_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
; DIALOG data
|
||||
.equ DIALOG_OFFS_BEGIN = MAINWINDOW_SIZE
|
||||
.equ DIALOG_SIZE = DIALOG_OFFS_BEGIN+0
|
||||
|
||||
|
||||
.equ DIALOG_OPTS_STDBTNS_BIT = 0 ; use standard buttons
|
||||
|
||||
|
||||
; signals
|
||||
.equ DIALOG_SIGNAL_TOGUI = WIDGET_SIGNAL_NEXTFREE+0
|
||||
.equ DIALOG_SIGNAL_FROMGUI = WIDGET_SIGNAL_NEXTFREE+1
|
||||
.equ DIALOG_SIGNAL_MKCONTENT = WIDGET_SIGNAL_NEXTFREE+2
|
||||
.equ DIALOG_SIGNAL_RMCONTENT = WIDGET_SIGNAL_NEXTFREE+3
|
||||
.equ DIALOG_SIGNAL_NEXT = WIDGET_SIGNAL_NEXTFREE+4
|
||||
|
||||
; selectors
|
||||
.equ DIALOG_SEL_OKBUTTON = 1
|
||||
.equ DIALOG_SEL_ABORTBUTTON = 2
|
||||
.equ DIALOG_SEL_NEXTFREE = 3
|
||||
|
||||
.equ DIALOG_RESULT_OK = 0
|
||||
.equ DIALOG_RESULT_ABORTED = 1
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_Init @global
|
||||
;
|
||||
; @param Y pointer to MainWindow
|
||||
; @param X pointer to root window
|
||||
; @param r16 value for OBJECT_OFFS_OPTS
|
||||
; @param R21:R20 title ressource
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_Init:
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
bigcall MainWindow_Init
|
||||
brcc Dialog_Init_ret
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(Dialog_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(Dialog_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
Dialog_Init_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_AddDefaultButtons @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_AddDefaultButtons:
|
||||
bigcall MainWindow_GetContentWidget ; r19:r18=content window
|
||||
brcc Dialog_AddDefaultButtons_ret
|
||||
|
||||
mov xl, r18 ; use content window as parent
|
||||
mov xh, r19
|
||||
ldi r16, 0 ; OPTS
|
||||
ldi r17, (WIDGET_PACK_END<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_END<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
push zl
|
||||
push zh
|
||||
ldi zl, LOW(Dialog_ButtonsConfig*2)
|
||||
ldi zh, HIGH(Dialog_ButtonsConfig*2)
|
||||
bigcall CWidget_Create ; (any, !Y)
|
||||
pop zh
|
||||
pop zl
|
||||
Dialog_AddDefaultButtons_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_toGui @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_toGui:
|
||||
ldi r16, DIALOG_SIGNAL_TOGUI
|
||||
clr r17
|
||||
bigjmp OBJ_HandleSignal
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_fromGui @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_fromGui:
|
||||
ldi r16, DIALOG_SIGNAL_FROMGUI
|
||||
clr r17
|
||||
bigjmp OBJ_HandleSignal
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_MkContent @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_MkContent:
|
||||
ldi r16, DIALOG_SIGNAL_MKCONTENT
|
||||
clr r17
|
||||
bigjmp OBJ_HandleSignal
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_RmContent @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_RmContent:
|
||||
ldi r16, DIALOG_SIGNAL_RMCONTENT
|
||||
clr r17
|
||||
bigjmp OBJ_HandleSignal
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; signal handlers
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_OnOk @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_OnOk:
|
||||
rcall Dialog_fromGui
|
||||
ldi r16, WIDGET_SIGNAL_DIALOG_END
|
||||
ldi xl, LOW(DIALOG_RESULT_OK)
|
||||
ldi xh, HIGH(DIALOG_RESULT_OK)
|
||||
bigcall OBJ_EmitSignal
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_OnOAbort @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_OnAbort:
|
||||
ldi r16, WIDGET_SIGNAL_DIALOG_END
|
||||
ldi xl, LOW(DIALOG_RESULT_ABORTED)
|
||||
ldi xh, HIGH(DIALOG_RESULT_ABORTED)
|
||||
bigcall OBJ_EmitSignal
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_OnShow @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_OnShow:
|
||||
; check VISIBLE flag
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
sbrc r16, WIDGET_FLAGS_VISIBLE_BIT
|
||||
rjmp Dialog_OnShow_ret
|
||||
|
||||
; set VISIBLE flag
|
||||
sbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT) | (1<<WIDGET_FLAGS_DIRTY_BIT) | (1<<WIDGET_FLAGS_LAYOUT_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
|
||||
bigcall MainWindow_CreateContentWidget
|
||||
brcc Dialog_OnShow_ret
|
||||
|
||||
rcall Dialog_MkContent
|
||||
|
||||
ldd r16, Y+OBJECT_OFFS_OPTS
|
||||
sbrs r16, DIALOG_OPTS_STDBTNS_BIT
|
||||
rjmp Dialog_OnShow_toGui
|
||||
bigcall Dialog_AddDefaultButtons ; (any, !Y)
|
||||
brcc Dialog_OnShow_ret
|
||||
Dialog_OnShow_toGui:
|
||||
rcall Dialog_toGui
|
||||
|
||||
Dialog_OnShow_ret:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_OnHide @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_OnHide:
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
sbrs r16, WIDGET_FLAGS_VISIBLE_BIT
|
||||
rjmp Dialog_OnHide_ret
|
||||
|
||||
; read data into settings struct
|
||||
rcall Dialog_fromGui
|
||||
; prepare destruction of content
|
||||
rcall Dialog_RmContent
|
||||
|
||||
; clr VISIBLE flag
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
cbr r16, (1<<WIDGET_FLAGS_VISIBLE_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
|
||||
Dialog_OnHide_ret:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_OnFromGui @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_OnFromGui:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_OnToGui @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_OnToGui:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_OnRmContent @global
|
||||
;
|
||||
; @param Y pointer to dialog
|
||||
; @clobbers any, !Y
|
||||
|
||||
Dialog_OnRmContent:
|
||||
; prepare destruction of content
|
||||
bigcall MainWindow_GetContentWidget
|
||||
brcc Dialog_OnHide_ret
|
||||
push yl
|
||||
push yh
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||
sbr r16, (1<<OBJECT_FLAGS_DESTROY_BIT)
|
||||
std Y+OBJECT_OFFS_FLAGS, r16
|
||||
pop yh
|
||||
pop yl
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data in FLASH
|
||||
|
||||
|
||||
|
||||
Dialog_ButtonsConfig:
|
||||
.db CWIDGETCFG_MAINWIDGET_TYPE_HLAYOUT, 0 ; TYPE, FLAGS
|
||||
.dw (Dialog_HLayoutStyle*2) ; STYLE
|
||||
.db HLAYOUT_MODE_EXPAND, 0 ; PARAM1, PARAM2
|
||||
|
||||
; ok button
|
||||
.db CWIDGETCFG_WIDGET_TYPE_TEXTBUTTON, 0 ; TYPE, FLAGS
|
||||
.db DIALOG_SEL_OKBUTTON, 0 ; SELECTOR, RESERVED
|
||||
.db (1<<WIDGET_OPTS_BORDER_BIT), \
|
||||
(WIDGET_PACK_END<<WIDGET_PACK_HSELF0_BIT) | \
|
||||
(WIDGET_PACK_END<<WIDGET_PACK_VSELF0_BIT) | \
|
||||
(WIDGET_PACK_CENTER<<WIDGET_PACK_HCONTENT0_BIT) | \
|
||||
(WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT) ; OPTS, PACK
|
||||
.dw (DefaultStyle_SpacyButton*2) ; STYLE
|
||||
.dw RESSOURCE_TXT_DIALOGOK ; PARAM1, PARAM2 (text ressource)
|
||||
.db DIALOG_SEL_OKBUTTON, BUTTON_MODE_NORMAL ; PARAM3, PARAM4
|
||||
.dw 0, 0 ; MINVAL, MAXVAL
|
||||
|
||||
; abort button
|
||||
.db CWIDGETCFG_WIDGET_TYPE_TEXTBUTTON, 0 ; TYPE, FLAGS
|
||||
.db DIALOG_SEL_ABORTBUTTON, 0 ; SELECTOR, RESERVED
|
||||
.db (1<<WIDGET_OPTS_BORDER_BIT), \
|
||||
(WIDGET_PACK_END<<WIDGET_PACK_HSELF0_BIT) | \
|
||||
(WIDGET_PACK_END<<WIDGET_PACK_VSELF0_BIT) | \
|
||||
(WIDGET_PACK_CENTER<<WIDGET_PACK_HCONTENT0_BIT) | \
|
||||
(WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT) ; OPTS, PACK
|
||||
.dw (DefaultStyle_SpacyButton*2) ; STYLE
|
||||
.dw RESSOURCE_TXT_DIALOGABORT ; PARAM1, PARAM2 (text ressource)
|
||||
.db DIALOG_SEL_ABORTBUTTON, BUTTON_MODE_NORMAL ; PARAM3, PARAM4
|
||||
.dw 0, 0 ; MINVAL, MAXVAL
|
||||
|
||||
; end of configuration
|
||||
.dw 0
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @data Dialog_HLayoutStyle
|
||||
|
||||
Dialog_HLayoutStyle:
|
||||
.dw STYLE_WIN_FGCOL_NORM ; frontCol_norm
|
||||
.dw STYLE_WIN_BGCOL_NORM ; backCol_norm
|
||||
.dw STYLE_WIN_BORDERCOL_NORM ; borderCol_norm
|
||||
.dw STYLE_WIN_SHADOWCOL_NORM ; shadowCol_norm
|
||||
|
||||
.dw STYLE_WIN_FGCOL_ACTIVATED ; frontCol_activated
|
||||
.dw STYLE_WIN_BGCOL_ACTIVATED ; backCol_activated
|
||||
.dw STYLE_WIN_BORDERCOL_ACTIVATED ; borderCol_activated
|
||||
.dw STYLE_WIN_SHADOWCOL_ACTIVATED ; shadowCol_activated
|
||||
|
||||
.db 2, 10 ; outerBorderSize, innerBorderSize
|
||||
.dw (STYLE_WIN_FONT*2) ; font
|
||||
.db STYLE_WIN_FONT_WIDTH, \
|
||||
STYLE_WIN_FONT_HEIGHT ; charWidth, charHeight
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
Dialog_DefaultSignalmap:
|
||||
; header
|
||||
.dw MainWindow_DefaultSignalmap*2 ; next table to use
|
||||
; entries
|
||||
.db DIALOG_SEL_OKBUTTON, WIDGET_SIGNAL_COMMAND, LOW(Dialog_OnOk), HIGH(Dialog_OnOk)
|
||||
.db DIALOG_SEL_ABORTBUTTON, WIDGET_SIGNAL_COMMAND, LOW(Dialog_OnAbort), HIGH(Dialog_OnAbort)
|
||||
.db 0, WIDGET_SIGNAL_SHOW, LOW(Dialog_OnShow), HIGH(Dialog_OnShow)
|
||||
.db 0, WIDGET_SIGNAL_HIDE, LOW(Dialog_OnHide), HIGH(Dialog_OnHide)
|
||||
.db 0, DIALOG_SIGNAL_FROMGUI, LOW(Dialog_OnFromGui), HIGH(Dialog_OnFromGui)
|
||||
.db 0, DIALOG_SIGNAL_TOGUI, LOW(Dialog_OnToGui), HIGH(Dialog_OnToGui)
|
||||
.db 0, DIALOG_SIGNAL_RMCONTENT, LOW(Dialog_OnRmContent), HIGH(Dialog_OnRmContent)
|
||||
; end of table
|
||||
.db 0, 0, 0, 0
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,483 +0,0 @@
|
||||
; ***************************************************************************
|
||||
; 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_HSPINNER_ASM
|
||||
#define AQH_AVR_GUI_HSPINNER_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; ***************************************************************************
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
.equ HSPINNER_OFFS_BEGIN = HLAYOUT_SIZE
|
||||
.equ HSPINNER_OFFS_CURVALUE_LO = HSPINNER_OFFS_BEGIN+0
|
||||
.equ HSPINNER_OFFS_CURVALUE_HI = HSPINNER_OFFS_BEGIN+1
|
||||
.equ HSPINNER_OFFS_MINVALUE_LO = HSPINNER_OFFS_BEGIN+2
|
||||
.equ HSPINNER_OFFS_MINVALUE_HI = HSPINNER_OFFS_BEGIN+3
|
||||
.equ HSPINNER_OFFS_MAXVALUE_LO = HSPINNER_OFFS_BEGIN+4
|
||||
.equ HSPINNER_OFFS_MAXVALUE_HI = HSPINNER_OFFS_BEGIN+5
|
||||
.equ HSPINNER_OFFS_FLAGS = HSPINNER_OFFS_BEGIN+6
|
||||
.equ HSPINNER_SIZE = HSPINNER_OFFS_BEGIN+7
|
||||
|
||||
|
||||
; selectors
|
||||
.equ HSPINNER_SEL_LEFT = 1
|
||||
.equ HSPINNER_SEL_RIGHT = 2
|
||||
|
||||
|
||||
; child widgets
|
||||
.equ HSPINNER_CHILDIDX_LEFT = 0
|
||||
.equ HSPINNER_CHILDIDX_VALUE = 1
|
||||
.equ HSPINNER_CHILDIDX_EIGHT = 2
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine HSpinner_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 r20 number of postkomma digits
|
||||
; @param r21 total number of digits (including komma, if r20>0)
|
||||
; @clobbers any
|
||||
|
||||
HSpinner_new:
|
||||
ldi r24, LOW(HSPINNER_SIZE)
|
||||
ldi r25, HIGH(HSPINNER_SIZE)
|
||||
push r20
|
||||
push r21
|
||||
bigcall Object_Alloc ; (!r16, !r17, !X)
|
||||
pop r21
|
||||
pop r20
|
||||
brcc HSpinner_new_ret
|
||||
rcall HSpinner_Init ; (any, !Y)
|
||||
sec
|
||||
HSpinner_new_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine HSpinner_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 r20 number of postkomma digits
|
||||
; @param r21 total number of digits (including komma, if r20>0)
|
||||
; @clobbers any, !Y
|
||||
|
||||
HSpinner_Init:
|
||||
; call base class
|
||||
push r20
|
||||
push r21
|
||||
ldi r20, HLAYOUT_MODE_EXPAND
|
||||
bigcall HLayout_Init
|
||||
pop r21
|
||||
pop r20
|
||||
brcc HSpinner_Init_ret
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(HSpinner_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(HSpinner_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
rcall hSpinnerCreateChildren ; (any, !Y)
|
||||
HSpinner_Init_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine hSpinnerCreateChildren
|
||||
;
|
||||
; @param Y spinner object
|
||||
; @param r20 number of postkomma digits
|
||||
; @param r21 total number of digits (including komma, if r20>0)
|
||||
; @clobbers any, !Y
|
||||
|
||||
hSpinnerCreateChildren:
|
||||
push yl
|
||||
push yh
|
||||
mov xl, yl ; parent
|
||||
mov xh, yh
|
||||
|
||||
; create left button
|
||||
push r20
|
||||
push r21
|
||||
call hSpinnerCreateLeftButton
|
||||
pop r21
|
||||
pop r20
|
||||
brcc hSpinnerCreateChildren_popRet
|
||||
; create value 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
|
||||
push xl
|
||||
push xh
|
||||
bigcall ValueLabel_new
|
||||
pop xh
|
||||
pop xl
|
||||
brcc hSpinnerCreateChildren_popRet
|
||||
|
||||
; create right button
|
||||
call hSpinnerCreateRightButton
|
||||
hSpinnerCreateChildren_popRet:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
hSpinnerCreateLeftButton:
|
||||
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, HSPINNER_SEL_LEFT ; selector
|
||||
ldi r23, BUTTON_MODE_REPEATED
|
||||
bigcall TextButton_new
|
||||
brcc hSpinnerCreateLeftButton_done
|
||||
|
||||
; set style in Label part of the text button
|
||||
bigcall OBJ_GetFirstChild
|
||||
brcc hSpinnerCreateLeftButton_done
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
ldi r16, LOW(HSpinner_ButtonStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(HSpinner_ButtonStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
hSpinnerCreateLeftButton_done:
|
||||
pop xh
|
||||
pop xl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
hSpinnerCreateRightButton:
|
||||
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, HSPINNER_SEL_RIGHT ; selector
|
||||
ldi r23, BUTTON_MODE_REPEATED
|
||||
bigcall TextButton_new
|
||||
brcc hSpinnerCreateRightButton_done
|
||||
|
||||
; set style in Label part of the text button
|
||||
bigcall OBJ_GetFirstChild
|
||||
brcc hSpinnerCreateRightButton_done
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
ldi r16, LOW(HSpinner_ButtonStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(HSpinner_ButtonStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
hSpinnerCreateRightButton_done:
|
||||
pop xh
|
||||
pop xl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine hSpinnerSetValue
|
||||
;
|
||||
; @param Y widget
|
||||
; @param X new value
|
||||
; @clobbers any, !Y
|
||||
|
||||
hSpinnerSetValue:
|
||||
std Y+HSPINNER_OFFS_CURVALUE_LO, xl
|
||||
std Y+HSPINNER_OFFS_CURVALUE_HI, xh
|
||||
rjmp hSpinnerSendValue
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
hSpinnerSendValue:
|
||||
ldi r16, HSPINNER_CHILDIDX_VALUE
|
||||
bigcall OBJ_GetChildAt ; r19:r18=value label (r16)
|
||||
brcc HSpinner_OnCmdLeft_ret
|
||||
push yl
|
||||
push yh
|
||||
ldd xl, Y+HSPINNER_OFFS_CURVALUE_LO
|
||||
ldd xh, Y+HSPINNER_OFFS_CURVALUE_HI
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall Widget_SetCurrentValue ; (any, !Y)
|
||||
pop yh
|
||||
pop yl
|
||||
|
||||
rcall hSpinnerEmitCmdSignal
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine hSpinnerValidate
|
||||
;
|
||||
; @param Y widget
|
||||
; @return CFLAG set if value changed, cleared otherwise
|
||||
; @clobbers r20, r21, X
|
||||
|
||||
hSpinnerValidate:
|
||||
ldd xl, Y+HSPINNER_OFFS_CURVALUE_LO
|
||||
ldd xh, Y+HSPINNER_OFFS_CURVALUE_HI
|
||||
; compare against minimum
|
||||
ldd r20, Y+HSPINNER_OFFS_MINVALUE_LO
|
||||
ldd r21, Y+HSPINNER_OFFS_MINVALUE_HI
|
||||
cp xl, r20
|
||||
cpc xh, r21
|
||||
brcc hSpinnerValidate_l1
|
||||
mov xl, r20
|
||||
mov xh, r21
|
||||
hSpinnerValidate_l1:
|
||||
; compare against maximum
|
||||
ldd r20, Y+HSPINNER_OFFS_MAXVALUE_LO
|
||||
ldd r21, Y+HSPINNER_OFFS_MAXVALUE_HI
|
||||
cp r20, xl
|
||||
cpc r21, xh
|
||||
brcc hSpinnerValidate_l2
|
||||
mov xl, r20
|
||||
mov xh, r21
|
||||
hSpinnerValidate_l2:
|
||||
; check for change
|
||||
ldd r18, Y+HSPINNER_OFFS_CURVALUE_LO
|
||||
ldd r19, Y+HSPINNER_OFFS_CURVALUE_HI
|
||||
cp r18, xl
|
||||
brne hSpinnerValidate_l3
|
||||
cp r19, xh
|
||||
brne hSpinnerValidate_l3
|
||||
clc
|
||||
rjmp hSpinnerValidate_ret
|
||||
hSpinnerValidate_l3:
|
||||
std Y+HSPINNER_OFFS_CURVALUE_LO, xl
|
||||
std Y+HSPINNER_OFFS_CURVALUE_HI, xh
|
||||
sec
|
||||
hSpinnerValidate_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine hSpinnerEmitCmdSignal
|
||||
;
|
||||
; @param Y widget
|
||||
; @clobbers any, !Y
|
||||
|
||||
hSpinnerEmitCmdSignal:
|
||||
ldi r16, WIDGET_SIGNAL_COMMAND
|
||||
ldd xl, Y+HSPINNER_OFFS_CURVALUE_LO
|
||||
ldd xh, Y+HSPINNER_OFFS_CURVALUE_HI
|
||||
bigjmp OBJ_EmitSignal
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; signal handlers
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine HSpinner_OnCmdLeft @global
|
||||
;
|
||||
; @param Y widget
|
||||
|
||||
HSpinner_OnCmdLeft:
|
||||
ldd xl, Y+HSPINNER_OFFS_CURVALUE_LO
|
||||
ldd xh, Y+HSPINNER_OFFS_CURVALUE_HI
|
||||
ldd r18, Y+HSPINNER_OFFS_MINVALUE_LO
|
||||
ldd r19, Y+HSPINNER_OFFS_MINVALUE_HI
|
||||
|
||||
cp r18, xl ; current value > minimum?
|
||||
cpc r19, xh
|
||||
brcc HSpinner_OnCmdLeft_ret ; no, jmp
|
||||
sbiw xh:xl, 1
|
||||
|
||||
rcall hSpinnerSetValue
|
||||
HSpinner_OnCmdLeft_ret:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine HSpinner_OnCmdRight @global
|
||||
;
|
||||
; @param Y widget
|
||||
|
||||
HSpinner_OnCmdRight:
|
||||
ldd xl, Y+HSPINNER_OFFS_CURVALUE_LO
|
||||
ldd xh, Y+HSPINNER_OFFS_CURVALUE_HI
|
||||
ldd r18, Y+HSPINNER_OFFS_MAXVALUE_LO
|
||||
ldd r19, Y+HSPINNER_OFFS_MAXVALUE_HI
|
||||
|
||||
cp xl, r18 ; max value > current value?
|
||||
cpc xh, r19
|
||||
brcc HSpinner_OnCmdRight_ret ; no, jmp
|
||||
adiw xh:xl, 1
|
||||
|
||||
rcall hSpinnerSetValue
|
||||
HSpinner_OnCmdRight_ret:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine HSpinner_OnSetValue @global
|
||||
;
|
||||
; @param Y widget
|
||||
; @param X new value
|
||||
|
||||
HSpinner_OnSetValue:
|
||||
std Y+HSPINNER_OFFS_CURVALUE_LO, xl
|
||||
std Y+HSPINNER_OFFS_CURVALUE_HI, xh
|
||||
rcall hSpinnerValidate
|
||||
rcall hSpinnerSendValue
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine HSpinner_OnGetValue @global
|
||||
;
|
||||
; @param Y widget
|
||||
; @return r19:r18 value
|
||||
|
||||
HSpinner_OnGetValue:
|
||||
ldd r18, Y+HSPINNER_OFFS_CURVALUE_LO
|
||||
ldd r19, Y+HSPINNER_OFFS_CURVALUE_HI
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine HSpinner_OnSetMinValue @global
|
||||
;
|
||||
; @param Y widget
|
||||
; @param X new value
|
||||
|
||||
HSpinner_OnSetMinValue:
|
||||
std Y+HSPINNER_OFFS_MINVALUE_LO, xl
|
||||
std Y+HSPINNER_OFFS_MINVALUE_HI, xh
|
||||
rcall hSpinnerValidate
|
||||
brcc HSpinner_OnSetMinValue_done
|
||||
rcall hSpinnerSendValue
|
||||
HSpinner_OnSetMinValue_done:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine HSpinner_OnSetMaxValue @global
|
||||
;
|
||||
; @param Y widget
|
||||
; @param X new value
|
||||
|
||||
HSpinner_OnSetMaxValue:
|
||||
std Y+HSPINNER_OFFS_MAXVALUE_LO, xl
|
||||
std Y+HSPINNER_OFFS_MAXVALUE_HI, xh
|
||||
rcall hSpinnerValidate
|
||||
brcc HSpinner_OnSetMaxValue_done
|
||||
rcall hSpinnerSendValue
|
||||
HSpinner_OnSetMaxValue_done:
|
||||
sec
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data in FLASH
|
||||
|
||||
|
||||
HSpinner_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
|
||||
|
||||
|
||||
|
||||
HSpinner_DefaultSignalmap:
|
||||
; header
|
||||
.dw HLayout_DefaultSignalmap*2 ; next table to use
|
||||
; entries
|
||||
|
||||
.db HSPINNER_SEL_LEFT, WIDGET_SIGNAL_COMMAND, LOW(HSpinner_OnCmdLeft), HIGH(HSpinner_OnCmdLeft)
|
||||
.db HSPINNER_SEL_RIGHT, WIDGET_SIGNAL_COMMAND, LOW(HSpinner_OnCmdRight), HIGH(HSpinner_OnCmdRight)
|
||||
.db WIDGET_VALUE_CURRENTVALUE, WIDGET_SIGNAL_SETVALUE, LOW(HSpinner_OnSetValue), HIGH(HSpinner_OnSetValue)
|
||||
.db WIDGET_VALUE_CURRENTVALUE, WIDGET_SIGNAL_GETVALUE, LOW(HSpinner_OnGetValue), HIGH(HSpinner_OnGetValue)
|
||||
.db WIDGET_VALUE_MINVALUE, WIDGET_SIGNAL_SETVALUE, LOW(HSpinner_OnSetMinValue), HIGH(HSpinner_OnSetMinValue)
|
||||
.db WIDGET_VALUE_MAXVALUE, WIDGET_SIGNAL_SETVALUE, LOW(HSpinner_OnSetMaxValue), HIGH(HSpinner_OnSetMaxValue)
|
||||
.db 0, 0, 0, 0 ; end of table
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,310 +0,0 @@
|
||||
; ***************************************************************************
|
||||
; 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_MAINWINDOW_ASM
|
||||
#define AQH_AVR_GUI2_MAINWINDOW_ASM
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defines
|
||||
|
||||
.equ MAINWINDOW_OFFS_BEGIN = VLAYOUT_SIZE
|
||||
.equ MAINWINDOW_OFFS_PREVWIN_LO = MAINWINDOW_OFFS_BEGIN+0
|
||||
.equ MAINWINDOW_OFFS_PREVWIN_HI = MAINWINDOW_OFFS_BEGIN+1
|
||||
.equ MAINWINDOW_SIZE = MAINWINDOW_OFFS_BEGIN+2
|
||||
|
||||
|
||||
; index of sub-windows
|
||||
.equ MAINWINDOW_CHILDIDX_TITLE = 0
|
||||
.equ MAINWINDOW_CHILDIDX_CONTENT = 1
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_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 ressource id for title
|
||||
; @clobbers any
|
||||
|
||||
MainWindow_new:
|
||||
push r20
|
||||
push r21
|
||||
ldi r24, LOW(MAINWINDOW_SIZE)
|
||||
ldi r25, HIGH(MAINWINDOW_SIZE)
|
||||
bigcall Object_Alloc ; (!r16, !r17, !X)
|
||||
pop r21
|
||||
pop r20
|
||||
brcc MainWindow_new_ret
|
||||
rcall MainWindow_Init ; (r16, r17, X)
|
||||
sec
|
||||
MainWindow_new_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_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 ressource id for title
|
||||
; @clobbers r16, r17, X
|
||||
|
||||
MainWindow_Init:
|
||||
push r20
|
||||
push r21
|
||||
; call base class
|
||||
ldi r20, VLAYOUT_MODE_EXPAND
|
||||
bigcall VLayout_Init ; (r16, r17, X)
|
||||
pop r21
|
||||
pop r20
|
||||
|
||||
; set default signal map
|
||||
ldi r16, LOW(MainWindow_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||
ldi r16, HIGH(MainWindow_DefaultSignalmap*2)
|
||||
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||
|
||||
; set style which has no spacing and no borders so needs no drawing because
|
||||
; the children fill the screen completely
|
||||
ldi r16, LOW(MainWindow_DefaultStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(MainWindow_DefaultStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
|
||||
bigcall Widget_SetFullScreen ; (R16)
|
||||
|
||||
; create sub widgets
|
||||
rcall mainWindowCreateTitleWidget
|
||||
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_GetContentWidget @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param X parent widget (if any)
|
||||
; @return CFLAG set, if found, cleared otherwise
|
||||
; @return r19:r18 resulting object
|
||||
; @clobbers r16
|
||||
|
||||
MainWindow_GetContentWidget:
|
||||
ldi r16, MAINWINDOW_CHILDIDX_CONTENT
|
||||
bigcall OBJ_GetChildAt
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_GetContentWidget @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param X parent widget (if any)
|
||||
; @return CFLAG set, if found, cleared otherwise
|
||||
; @return r19:r18 resulting object
|
||||
; @clobbers r16
|
||||
|
||||
MainWindow_GetFirstChildOfContentWidget:
|
||||
push yl
|
||||
push yh
|
||||
bigcall MainWindow_GetContentWidget ; r19:r18=content window (R16)
|
||||
brcc MainWindow_GetFirstChildOfContentWidget_popRet
|
||||
mov yl, r18
|
||||
mov yh, r19
|
||||
bigcall OBJ_GetFirstChild ; get first child
|
||||
MainWindow_GetFirstChildOfContentWidget_popRet:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; signal handlers
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_OnGetDefaultWidth @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param r17 value requested
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @return CFLAG set if signal handled
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
MainWindow_OnGetDefaultWidth:
|
||||
ldi r18, LOW(DISPLAY_WIDTH)
|
||||
ldi r19, HIGH(DISPLAY_WIDTH)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_OnGetDefaultHeight @global
|
||||
;
|
||||
; @param Y address of widget
|
||||
; @param r17 value requested
|
||||
; @param xl param1
|
||||
; @param xh param2
|
||||
; @return CFLAG set if signal handled
|
||||
; @return r19:r18 value
|
||||
; @clobbers any, !Y
|
||||
|
||||
MainWindow_OnGetDefaultHeight:
|
||||
ldi r18, LOW(DISPLAY_HEIGHT)
|
||||
ldi r19, HIGH(DISPLAY_HEIGHT)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine mainWindowCreateTitleWidget
|
||||
;
|
||||
; @param Y address of main window widget
|
||||
; @param r21:r20 ressource id for title
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
|
||||
mainWindowCreateTitleWidget:
|
||||
; create title widget
|
||||
push yl
|
||||
push yh
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
ldi r16, 0
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_BEGIN<<WIDGET_PACK_VSELF0_BIT) | \
|
||||
(WIDGET_PACK_BEGIN <<WIDGET_PACK_HCONTENT0_BIT) | (WIDGET_PACK_CENTER<<WIDGET_PACK_VCONTENT0_BIT)
|
||||
bigcall Label_new
|
||||
brcc mainWindowCreateTitleWidget_done
|
||||
; set style for title widget
|
||||
ldi r16, LOW(MainWindow_TitleStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(MainWindow_TitleStyle*2)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
sec
|
||||
mainWindowCreateTitleWidget_done:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine MainWindow_CreateContentWidget
|
||||
;
|
||||
; @param Y address of main window widget
|
||||
; @return CFLAG set of okay, cleared otherwise
|
||||
; @return r19:r18 pointer to created widget
|
||||
|
||||
MainWindow_CreateContentWidget:
|
||||
; create content widget
|
||||
push yl
|
||||
push yh
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
ldi r16, 0 ; OPTS
|
||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||
ldi r20, VLAYOUT_MODE_EXPAND
|
||||
bigcall VLayout_new
|
||||
brcc MainWindow_CreateContentWidget_done
|
||||
; set style for content widget
|
||||
ldi r16, LOW(DefaultStyle_Window*2)
|
||||
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||
ldi r16, HIGH(DefaultStyle_Window*2)
|
||||
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||
mov r18, yl
|
||||
mov r19, yh
|
||||
MainWindow_CreateContentWidget_done:
|
||||
pop yh
|
||||
pop yl
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; data in FLASH
|
||||
|
||||
MainWindow_DefaultSignalmap:
|
||||
; header
|
||||
.dw VLayout_DefaultSignalmap*2 ; next table to use
|
||||
; entries
|
||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDrawNop), HIGH(Widget_OnDrawNop)
|
||||
.db WIDGET_VALUE_DEFAULT_WIDTH, WIDGET_SIGNAL_GETVALUE, LOW(MainWindow_OnGetDefaultWidth), HIGH(MainWindow_OnGetDefaultWidth)
|
||||
.db WIDGET_VALUE_DEFAULT_HEIGHT, WIDGET_SIGNAL_GETVALUE, LOW(MainWindow_OnGetDefaultHeight), HIGH(MainWindow_OnGetDefaultHeight)
|
||||
|
||||
.db 0, 0, 0, 0 ; end of table
|
||||
|
||||
|
||||
|
||||
MainWindow_DefaultStyle:
|
||||
.dw STYLE_WIN_FGCOL_NORM ; frontCol_norm
|
||||
.dw STYLE_WIN_BGCOL_NORM ; backCol_norm
|
||||
.dw STYLE_WIN_BORDERCOL_NORM ; borderCol_norm
|
||||
.dw STYLE_WIN_SHADOWCOL_NORM ; shadowCol_norm
|
||||
|
||||
.dw STYLE_WIN_FGCOL_ACTIVATED ; frontCol_activated
|
||||
.dw STYLE_WIN_BGCOL_ACTIVATED ; backCol_activated
|
||||
.dw STYLE_WIN_BORDERCOL_ACTIVATED ; borderCol_activated
|
||||
.dw STYLE_WIN_SHADOWCOL_ACTIVATED ; shadowCol_activated
|
||||
|
||||
.db 0, 0 ; outerBorderSize, innerBorderSize
|
||||
.dw (STYLE_WIN_FONT*2) ; font
|
||||
.db STYLE_WIN_FONT_WIDTH, \
|
||||
STYLE_WIN_FONT_HEIGHT ; charWidth, charHeight
|
||||
|
||||
|
||||
|
||||
MainWindow_TitleStyle:
|
||||
.dw STYLE_TITLE_FGCOL ; frontCol_norm
|
||||
.dw STYLE_TITLE_BGCOL ; backCol_norm
|
||||
.dw STYLE_TITLE_BORDERCOL ; borderCol_norm
|
||||
.dw STYLE_TITLE_SHADOWCOL ; shadowCol_norm
|
||||
|
||||
.dw STYLE_TITLE_FGCOL ; frontCol_activated
|
||||
.dw STYLE_TITLE_BGCOL ; backCol_activated
|
||||
.dw STYLE_TITLE_BORDERCOL ; borderCol_activated
|
||||
.dw STYLE_TITLE_SHADOWCOL ; shadowCol_activated
|
||||
|
||||
.db 2, 1 ; outerBorderSize, innerBorderSize
|
||||
.dw (STYLE_TITLE_FONT*2) ; font
|
||||
.db STYLE_TITLE_FONT_WIDTH, \
|
||||
STYLE_TITLE_FONT_HEIGHT ; charWidth, charHeight
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
200
avr/modules/lcd2/gui/base/wlist.asm
Normal file
200
avr/modules/lcd2/gui/base/wlist.asm
Normal 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
|
||||
|
||||
86
avr/modules/lcd2/gui/base/wlist_elem.asm
Normal file
86
avr/modules/lcd2/gui/base/wlist_elem.asm
Normal 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
|
||||
Reference in New Issue
Block a user