gui2: new layout modules basically work now.
This commit is contained in:
@@ -348,7 +348,7 @@ C03App_CreateButton:
|
|||||||
push r21
|
push r21
|
||||||
push r22
|
push r22
|
||||||
ldi r20, BUTTON_MODE_NORMAL
|
ldi r20, BUTTON_MODE_NORMAL
|
||||||
rcall Button_new
|
bigcall Button_new
|
||||||
pop r22
|
pop r22
|
||||||
pop r21
|
pop r21
|
||||||
pop r20
|
pop r20
|
||||||
|
|||||||
@@ -359,6 +359,15 @@ DEBUG_DUMPWDG:
|
|||||||
clr r6
|
clr r6
|
||||||
clr r7
|
clr r7
|
||||||
|
|
||||||
|
ldi r16, 3
|
||||||
|
add r4, r16
|
||||||
|
adc r5, r17
|
||||||
|
rcall DEBUG_DUMPCWDG
|
||||||
|
ldi r16, 20
|
||||||
|
clr r17
|
||||||
|
add r6, r16
|
||||||
|
adc r7, r17
|
||||||
|
|
||||||
push yl
|
push yl
|
||||||
push yh
|
push yh
|
||||||
mov yl, zl
|
mov yl, zl
|
||||||
@@ -520,22 +529,23 @@ Debug_Style:
|
|||||||
GUI2_MODULE_BEGIN:
|
GUI2_MODULE_BEGIN:
|
||||||
.include "modules/lcd2/gui2/base/object.asm"
|
.include "modules/lcd2/gui2/base/object.asm"
|
||||||
.include "modules/lcd2/gui2/base/widget.asm"
|
.include "modules/lcd2/gui2/base/widget.asm"
|
||||||
.include "modules/lcd2/gui2/base/layout.asm"
|
;.include "modules/lcd2/gui2/base/layout.asm"
|
||||||
.include "modules/lcd2/gui2/base/hlayout.asm"
|
;.include "modules/lcd2/gui2/base/hlayout.asm"
|
||||||
.include "modules/lcd2/gui2/base/vlayout.asm"
|
;.include "modules/lcd2/gui2/base/vlayout.asm"
|
||||||
.include "modules/lcd2/gui2/base/mlayout.asm"
|
;.include "modules/lcd2/gui2/base/mlayout.asm"
|
||||||
.include "modules/lcd2/gui2/base/mlayout_column.asm"
|
;.include "modules/lcd2/gui2/base/mlayout_column.asm"
|
||||||
.include "modules/lcd2/gui2/base/guiapp.asm"
|
.include "modules/lcd2/gui2/base/guiapp.asm"
|
||||||
.include "modules/lcd2/gui2/base/mainwindow.asm"
|
|
||||||
.include "modules/lcd2/gui2/base/rootwindow.asm"
|
.include "modules/lcd2/gui2/base/rootwindow.asm"
|
||||||
.include "modules/lcd2/gui2/base/label.asm"
|
.include "modules/lcd2/gui2/base/label.asm"
|
||||||
.include "modules/lcd2/gui2/base/button.asm"
|
.include "modules/lcd2/gui2/base/button.asm"
|
||||||
.include "modules/lcd2/gui2/base/imageview.asm"
|
.include "modules/lcd2/gui2/base/imageview.asm"
|
||||||
.include "modules/lcd2/gui2/base/valuelabel.asm"
|
.include "modules/lcd2/gui2/base/valuelabel.asm"
|
||||||
.include "modules/lcd2/gui2/aqhome/sensorwatch.asm"
|
|
||||||
.include "modules/lcd2/gui2/base/layout2.asm"
|
.include "modules/lcd2/gui2/base/layout2.asm"
|
||||||
.include "modules/lcd2/gui2/base/hlayout2.asm"
|
.include "modules/lcd2/gui2/base/hlayout2.asm"
|
||||||
|
.include "modules/lcd2/gui2/base/vlayout2.asm"
|
||||||
.include "modules/lcd2/gui2/base/mclayout.asm"
|
.include "modules/lcd2/gui2/base/mclayout.asm"
|
||||||
|
.include "modules/lcd2/gui2/base/mainwindow.asm"
|
||||||
|
.include "modules/lcd2/gui2/aqhome/sensorwatch.asm"
|
||||||
GUI2_MODULE_END:
|
GUI2_MODULE_END:
|
||||||
.equ MODULE_SIZE_GUI2 = GUI2_MODULE_END-GUI2_MODULE_BEGIN
|
.equ MODULE_SIZE_GUI2 = GUI2_MODULE_END-GUI2_MODULE_BEGIN
|
||||||
|
|
||||||
|
|||||||
@@ -96,11 +96,16 @@ ClimateWin_Init_ret:
|
|||||||
climateWinCreateSensorWatches:
|
climateWinCreateSensorWatches:
|
||||||
ldi r16, 0 ; OPTS
|
ldi r16, 0 ; OPTS
|
||||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||||
; ldi r20, HLAYOUT2_MODE_SPREAD
|
ldi r20, HLAYOUT2_MODE_SPREAD
|
||||||
ldi r20, HLAYOUT2_MODE_EXPAND
|
; ldi r20, HLAYOUT2_MODE_EXPAND
|
||||||
bigcall HLayout2_new
|
bigcall HLayout2_new
|
||||||
brcc climateWinCreateSensorWatches_ret
|
brcc climateWinCreateSensorWatches_ret
|
||||||
|
|
||||||
|
ldi r16, LOW(ClimateWindow_HLayoutStyle*2)
|
||||||
|
std Y+WIDGET_OFFS_STYLE_LO, r16
|
||||||
|
ldi r16, HIGH(ClimateWindow_HLayoutStyle*2)
|
||||||
|
std Y+WIDGET_OFFS_STYLE_HI, r16
|
||||||
|
|
||||||
mov xl, yl ; use HLayout as parent
|
mov xl, yl ; use HLayout as parent
|
||||||
mov xh, yh
|
mov xh, yh
|
||||||
|
|
||||||
@@ -157,5 +162,28 @@ climateWinCreateSensorWatches_ret:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; data in FLASH
|
||||||
|
|
||||||
|
|
||||||
|
ClimateWindow_HLayoutStyle:
|
||||||
|
.dw DISPLAY_COLOR_BLACK ; frontCol_norm
|
||||||
|
.dw DISPLAY_COLOR_LIGHTGREY ; 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 0, 1 ; outerBorderSize, innerBorderSize
|
||||||
|
.dw ili9341Font12x16_1*2 ; font
|
||||||
|
.db 12, 16 ; charWidth, charHeight
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
; defines
|
; defines
|
||||||
|
|
||||||
.equ SENSORWATCH_OFFS_BEGIN = VLAYOUT_SIZE
|
.equ SENSORWATCH_OFFS_BEGIN = VLAYOUT2_SIZE
|
||||||
.equ SENSORWATCH_OFFS_BASEVALUEID = SENSORWATCH_OFFS_BEGIN+0
|
.equ SENSORWATCH_OFFS_BASEVALUEID = SENSORWATCH_OFFS_BEGIN+0
|
||||||
.equ SENSORWATCH_OFFS_EEPROMID = SENSORWATCH_OFFS_BEGIN+1
|
.equ SENSORWATCH_OFFS_EEPROMID = SENSORWATCH_OFFS_BEGIN+1
|
||||||
.equ SENSORWATCH_OFFS_NODEADDR = SENSORWATCH_OFFS_BEGIN+2
|
.equ SENSORWATCH_OFFS_NODEADDR = SENSORWATCH_OFFS_BEGIN+2
|
||||||
@@ -123,8 +123,8 @@ SensorWatch_Init:
|
|||||||
push r21
|
push r21
|
||||||
push r22
|
push r22
|
||||||
; call base class
|
; call base class
|
||||||
ldi r20, VLAYOUT_MODE_EXPAND
|
ldi r20, VLAYOUT2_MODE_EXPAND
|
||||||
bigcall VLayout_Init
|
bigcall VLayout2_Init
|
||||||
pop r22
|
pop r22
|
||||||
pop r21
|
pop r21
|
||||||
pop r20
|
pop r20
|
||||||
@@ -641,7 +641,7 @@ sensorWatchReadFromEeprom_ret:
|
|||||||
|
|
||||||
SensorWatch_DefaultSignalmap:
|
SensorWatch_DefaultSignalmap:
|
||||||
; header
|
; header
|
||||||
.dw VLayout_DefaultSignalmap*2 ; next table to use
|
.dw VLayout2_DefaultSignalmap*2 ; next table to use
|
||||||
; entries
|
; entries
|
||||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDraw), HIGH(Widget_OnDraw)
|
||||||
.db NETMSG_CMD_VALUE_REPORT, OBJECT_SIGNAL_RECVMSG, LOW(SensorWatch_OnRecvReport), HIGH(SensorWatch_OnRecvReport)
|
.db NETMSG_CMD_VALUE_REPORT, OBJECT_SIGNAL_RECVMSG, LOW(SensorWatch_OnRecvReport), HIGH(SensorWatch_OnRecvReport)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ HLayout2_new_ret:
|
|||||||
; @param X parent widget (if any)
|
; @param X parent widget (if any)
|
||||||
; @param r16 value for OBJECT_OFFS_OPTS
|
; @param r16 value for OBJECT_OFFS_OPTS
|
||||||
; @param r17 value for WIDGET_OFFS_PACK
|
; @param r17 value for WIDGET_OFFS_PACK
|
||||||
; @param r20 layout mode (HLAYOUT_MODE_EXPAND, HLAYOUT_MODE_SPREAD)
|
; @param r20 layout mode (HLAYOUT2_MODE_EXPAND, HLAYOUT2_MODE_SPREAD)
|
||||||
; @clobbers r16, r17, X
|
; @clobbers r16, r17, X
|
||||||
|
|
||||||
HLayout2_Init:
|
HLayout2_Init:
|
||||||
@@ -209,6 +209,53 @@ hLayout2PrepareVertical:
|
|||||||
; @clobbers r16-r24
|
; @clobbers r16-r24
|
||||||
|
|
||||||
hLayout2ReadLayoutWriteVertical:
|
hLayout2ReadLayoutWriteVertical:
|
||||||
|
; read positions and flags into new layout context
|
||||||
|
bigcall LayoutCtx_ReadYDimsContiguous ; (R16, r18, r19, Z)
|
||||||
|
|
||||||
|
; layout
|
||||||
|
adiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
|
||||||
|
ld r18, X
|
||||||
|
clr r19
|
||||||
|
sbiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
|
||||||
|
bigcall LayoutCtx_SetFixedPos ; (r24)
|
||||||
|
mov r22, r18 ; save border
|
||||||
|
|
||||||
|
bigcall LayoutCtx_GetMaxSize ; r19:r18=max default size (r18, r19, r20, r21, r24)
|
||||||
|
ldd r16, Y+WIDGET_OFFS_PACK
|
||||||
|
andi r16, (1<<WIDGET_PACK_VSELF1_BIT) | (1<<WIDGET_PACK_VSELF0_BIT)
|
||||||
|
cpi r16, (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT)
|
||||||
|
brne vLayout2ReadLayoutWriteVertical_setSize
|
||||||
|
; use full possible width
|
||||||
|
adiw xh:xl, LAYOUT_CTX_OFFS_TOTALSIZE_LO
|
||||||
|
ld r18, X+
|
||||||
|
ld r19, X
|
||||||
|
sbiw xh:xl, (LAYOUT_CTX_OFFS_TOTALSIZE_LO+1)
|
||||||
|
clr r23
|
||||||
|
lsl r22
|
||||||
|
rol r23
|
||||||
|
sub r18, r22
|
||||||
|
sbc r19, r23
|
||||||
|
vLayout2ReadLayoutWriteVertical_setSize:
|
||||||
|
bigcall LayoutCtx_SetFixedSize ; (r24)
|
||||||
|
|
||||||
|
; pack
|
||||||
|
bigcall LayoutCtx_PackYContiguous ; (R16, r18, r19, Z)
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; read positions and flags into new layout context
|
; read positions and flags into new layout context
|
||||||
bigcall LayoutCtx_ReadYDimsContiguous ; (R16, r18, r19, Z)
|
bigcall LayoutCtx_ReadYDimsContiguous ; (R16, r18, r19, Z)
|
||||||
|
|
||||||
@@ -225,7 +272,7 @@ hLayout2ReadLayoutWriteVertical:
|
|||||||
bigcall LayoutCtx_PackYContiguous ; (R16, r18, r19, Z)
|
bigcall LayoutCtx_PackYContiguous ; (R16, r18, r19, Z)
|
||||||
|
|
||||||
; write back dims
|
; write back dims
|
||||||
bigcall LayoutCtx_WriteYDimsContiguous ; (R16, r18, r19, Z)
|
; bigcall LayoutCtx_WriteYDimsContiguous ; (R16, r18, r19, Z)
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
@@ -289,14 +336,13 @@ hLayout2PrepareHorizontal:
|
|||||||
; @clobbers r16-r24
|
; @clobbers r16-r24
|
||||||
|
|
||||||
hLayout2ReadLayoutWriteHorizontal:
|
hLayout2ReadLayoutWriteHorizontal:
|
||||||
; layout
|
|
||||||
ldd r24, Y+HLAYOUT2_OFFS_MODE
|
|
||||||
; read X positions and flags into new layout context
|
; read X positions and flags into new layout context
|
||||||
bigcall LayoutCtx_ReadXDimsContiguous ; (R16, r18, r19, Z)
|
bigcall LayoutCtx_ReadXDimsContiguous ; (R16, r18, r19, Z)
|
||||||
|
|
||||||
; layout
|
; layout
|
||||||
push r25
|
push r25
|
||||||
cpi r24, HLAYOUT_MODE_SPREAD
|
ldd r24, Y+HLAYOUT2_OFFS_MODE
|
||||||
|
cpi r24, HLAYOUT2_MODE_SPREAD
|
||||||
breq hLayout2ReadLayoutWriteHorizontal_spread
|
breq hLayout2ReadLayoutWriteHorizontal_spread
|
||||||
bigcall LayoutCtx_LayoutExpand ; (r16-r25)
|
bigcall LayoutCtx_LayoutExpand ; (r16-r25)
|
||||||
rjmp hLayout2ReadLayoutWriteHorizontal_pack
|
rjmp hLayout2ReadLayoutWriteHorizontal_pack
|
||||||
@@ -311,7 +357,7 @@ hLayout2ReadLayoutWriteHorizontal_pack:
|
|||||||
pop r25
|
pop r25
|
||||||
|
|
||||||
; write back dims
|
; write back dims
|
||||||
bigcall LayoutCtx_WriteXDimsContiguous ; (r16, r18, r19, r24)
|
; bigcall LayoutCtx_WriteXDimsContiguous ; (r16, r18, r19, r24)
|
||||||
ret
|
ret
|
||||||
; @end
|
; @end
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ LayoutCtx_LayoutExpand:
|
|||||||
; @clobbers r16-r25
|
; @clobbers r16-r25
|
||||||
|
|
||||||
LayoutCtx_LayoutSpread:
|
LayoutCtx_LayoutSpread:
|
||||||
rcall layoutCtxCalcExpandPerExpandableItem ; r17:r16=space to add to expandable items (r16-r25)
|
; rcall layoutCtxCalcExpandPerExpandableItem ; r17:r16=space to add to expandable items (r16-r25)
|
||||||
rcall layoutCtxCalcSpreadValue ; r17:r16=space to add to expandable items and between (r16-r25)
|
rcall layoutCtxCalcSpreadValue ; r17:r16=space to add to expandable items and between (r16-r25)
|
||||||
push r16
|
push r16
|
||||||
push r17
|
push r17
|
||||||
@@ -483,10 +483,55 @@ layoutCtxPack_done:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine layout2Pack
|
||||||
|
;
|
||||||
|
; @param X pointer to current item
|
||||||
|
; @param Y current widget
|
||||||
|
; @param r17:r16 space available to the child widget
|
||||||
|
; @param r21:r20 default size of the child widget
|
||||||
|
; @param r19:r18 pos
|
||||||
|
; @param r25 pack flags
|
||||||
|
; @clobbers r16-r19, r25
|
||||||
|
|
||||||
|
layout2Pack:
|
||||||
|
sub r16, r20 ; r17:r16=(size-defaultSize)
|
||||||
|
sbc r17, r21
|
||||||
|
brcs layout2Pack_done
|
||||||
|
andi r25, 3
|
||||||
|
cpi r25, WIDGET_PACK_END
|
||||||
|
breq layout2Pack_end
|
||||||
|
cpi r25, WIDGET_PACK_CENTER
|
||||||
|
breq layout2Pack_center
|
||||||
|
cpi r25, WIDGET_PACK_FILLED
|
||||||
|
breq layout2Pack_filled
|
||||||
|
rjmp layout2Pack_done
|
||||||
|
layout2Pack_end:
|
||||||
|
add r18, r16 ; just add difference to pos
|
||||||
|
adc r19, r17
|
||||||
|
rjmp layout2Pack_done
|
||||||
|
layout2Pack_center:
|
||||||
|
lsr r17
|
||||||
|
ror r16
|
||||||
|
add r18, r16 ; just add half difference to pos
|
||||||
|
adc r19, r17
|
||||||
|
rjmp layout2Pack_done
|
||||||
|
layout2Pack_filled:
|
||||||
|
add r16, r20 ; get total size back
|
||||||
|
adc r17, r21
|
||||||
|
mov r20, r16
|
||||||
|
mov r21, r17
|
||||||
|
layout2Pack_done:
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; @routine layoutCtxCalcExpandPerExpandableItem
|
; @routine layoutCtxCalcExpandPerExpandableItem
|
||||||
;
|
;
|
||||||
; @param X pointer to layout context
|
; @param X pointer to layout context
|
||||||
|
; @return r17:r16 space per expandable item
|
||||||
; @clobbers r16-r25
|
; @clobbers r16-r25
|
||||||
|
|
||||||
layoutCtxCalcExpandPerExpandableItem:
|
layoutCtxCalcExpandPerExpandableItem:
|
||||||
@@ -527,7 +572,9 @@ layoutCtxCalcSpreadValue:
|
|||||||
tst r16
|
tst r16
|
||||||
breq layoutCtxCalcSpreadValue_none ; no expandable item, nothing to expand
|
breq layoutCtxCalcSpreadValue_none ; no expandable item, nothing to expand
|
||||||
|
|
||||||
rcall layoutCtxCalcAvailableExtraSpace ; r21:r20=available extra space (r16-r24)
|
push r16
|
||||||
|
rcall layoutCtxCalcAvailableExtraSpace ; r21:r20=available extra space (r16-r24)
|
||||||
|
pop r16
|
||||||
brcc layoutCtxCalcExpandPerExpandableItem_none ; jmp if no extra space
|
brcc layoutCtxCalcExpandPerExpandableItem_none ; jmp if no extra space
|
||||||
mov r22, r16
|
mov r22, r16
|
||||||
clr r23
|
clr r23
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
; defines
|
; defines
|
||||||
|
|
||||||
.equ MAINWINDOW_OFFS_BEGIN = VLAYOUT_SIZE
|
.equ MAINWINDOW_OFFS_BEGIN = VLAYOUT2_SIZE
|
||||||
; no data for now
|
; no data for now
|
||||||
.equ MAINWINDOW_SIZE = MAINWINDOW_OFFS_BEGIN+0
|
.equ MAINWINDOW_SIZE = MAINWINDOW_OFFS_BEGIN+0
|
||||||
|
|
||||||
@@ -74,8 +74,8 @@ MainWindow_Init:
|
|||||||
push r20
|
push r20
|
||||||
push r21
|
push r21
|
||||||
; call base class
|
; call base class
|
||||||
ldi r20, VLAYOUT_MODE_EXPAND
|
ldi r20, VLAYOUT2_MODE_EXPAND
|
||||||
bigcall VLayout_Init ; (r16, r17, X)
|
bigcall VLayout2_Init ; (r16, r17, X)
|
||||||
pop r21
|
pop r21
|
||||||
pop r20
|
pop r20
|
||||||
|
|
||||||
@@ -235,8 +235,8 @@ mainWindowCreateContentWidget:
|
|||||||
mov xh, yh
|
mov xh, yh
|
||||||
ldi r16, 0 ; OPTS
|
ldi r16, 0 ; OPTS
|
||||||
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
ldi r17, (WIDGET_PACK_FILLED<<WIDGET_PACK_HSELF0_BIT) | (WIDGET_PACK_FILLED<<WIDGET_PACK_VSELF0_BIT) ; PACK
|
||||||
ldi r20, VLAYOUT_MODE_EXPAND
|
ldi r20, VLAYOUT2_MODE_EXPAND
|
||||||
bigcall VLayout_new
|
bigcall VLayout2_new
|
||||||
brcc mainWindowCreateContentWidget_done
|
brcc mainWindowCreateContentWidget_done
|
||||||
; set style for title widget
|
; set style for title widget
|
||||||
ldi r16, LOW(MainWindow_ContentStyle*2)
|
ldi r16, LOW(MainWindow_ContentStyle*2)
|
||||||
@@ -258,7 +258,7 @@ mainWindowCreateContentWidget_done:
|
|||||||
|
|
||||||
MainWindow_DefaultSignalmap:
|
MainWindow_DefaultSignalmap:
|
||||||
; header
|
; header
|
||||||
.dw VLayout_DefaultSignalmap*2 ; next table to use
|
.dw VLayout2_DefaultSignalmap*2 ; next table to use
|
||||||
; entries
|
; entries
|
||||||
.db 0, WIDGET_SIGNAL_DRAW, LOW(Widget_OnDrawNop), HIGH(Widget_OnDrawNop)
|
.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_WIDTH, WIDGET_SIGNAL_GETVALUE, LOW(MainWindow_OnGetDefaultWidth), HIGH(MainWindow_OnGetDefaultWidth)
|
||||||
|
|||||||
357
avr/modules/lcd2/gui2/base/vlayout2.asm
Normal file
357
avr/modules/lcd2/gui2/base/vlayout2.asm
Normal file
@@ -0,0 +1,357 @@
|
|||||||
|
; ***************************************************************************
|
||||||
|
; 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_VLAYOUT2_ASM
|
||||||
|
#define AQH_AVR_GUI2_VLAYOUT2_ASM
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; defines
|
||||||
|
|
||||||
|
.equ VLAYOUT2_OFFS_BEGIN = WIDGET_SIZE
|
||||||
|
.equ VLAYOUT2_OFFS_MODE = VLAYOUT2_OFFS_BEGIN+0
|
||||||
|
.equ VLAYOUT2_SIZE = VLAYOUT2_OFFS_BEGIN+1
|
||||||
|
|
||||||
|
|
||||||
|
; values for VLAYOUT_OFFS_MODE
|
||||||
|
.equ VLAYOUT2_MODE_EXPAND = 0
|
||||||
|
.equ VLAYOUT2_MODE_SPREAD = 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; code
|
||||||
|
|
||||||
|
.cseg
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine VLayout_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 layout mode (VLAYOUT_MODE_EXPAND, VLAYOUT_MODE_SPREAD)
|
||||||
|
; @clobbers any
|
||||||
|
|
||||||
|
VLayout2_new:
|
||||||
|
push r20
|
||||||
|
ldi r24, LOW(VLAYOUT2_SIZE)
|
||||||
|
ldi r25, HIGH(VLAYOUT2_SIZE)
|
||||||
|
bigcall Object_Alloc ; (!r16, !r17, !X)
|
||||||
|
pop r20
|
||||||
|
brcc VLayout2_new_ret
|
||||||
|
rcall VLayout2_Init ; (r16, r17, X)
|
||||||
|
sec
|
||||||
|
VLayout2_new_ret:
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine VLayout2_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 layout mode (VLAYOUT_MODE_EXPAND, VLAYOUT_MODE_SPREAD)
|
||||||
|
; @clobbers r16, r17, X
|
||||||
|
|
||||||
|
VLayout2_Init:
|
||||||
|
push r20
|
||||||
|
; call base class
|
||||||
|
bigcall Widget_Init ; (r16, r17, X)
|
||||||
|
pop r20
|
||||||
|
|
||||||
|
; set widget-specific data
|
||||||
|
std Y+VLAYOUT2_OFFS_MODE, r20
|
||||||
|
|
||||||
|
; set default signal map
|
||||||
|
ldi r16, LOW(VLayout2_DefaultSignalmap*2)
|
||||||
|
std Y+OBJECT_OFFS_SIGNALMAP_LO, r16
|
||||||
|
ldi r16, HIGH(VLayout2_DefaultSignalmap*2)
|
||||||
|
std Y+OBJECT_OFFS_SIGNALMAP_HI, r16
|
||||||
|
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine VLayout2_OnLayout
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @clobbers any, !Y
|
||||||
|
|
||||||
|
VLayout2_OnLayout:
|
||||||
|
; create and preset context
|
||||||
|
rcall LayoutCtx_CreateContextFor1D ; X=ctx, r16=num of children
|
||||||
|
brcc VLayout2_OnLayout_ret
|
||||||
|
; do layout
|
||||||
|
mov r25, r16
|
||||||
|
rcall vLayout2Horizontally
|
||||||
|
rcall vLayout2Vertically
|
||||||
|
|
||||||
|
; release layout context
|
||||||
|
bigcall LayoutCtx_free
|
||||||
|
; force re-drawing of this widget, clear layout bit
|
||||||
|
ldd r16, Y+OBJECT_OFFS_FLAGS
|
||||||
|
sbr r16, (1<<WIDGET_FLAGS_DIRTY_BIT)
|
||||||
|
cbr r16, (1<<WIDGET_FLAGS_LAYOUT_BIT)
|
||||||
|
std Y+OBJECT_OFFS_FLAGS, r16
|
||||||
|
VLayout2_OnLayout_ret:
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine VLayout2_OnGetDefaultHeight
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @return r19:r18 value
|
||||||
|
; @clobbers any, !Y
|
||||||
|
|
||||||
|
VLayout2_OnGetDefaultHeight:
|
||||||
|
rcall Layout2_SetDefaultHeights
|
||||||
|
rcall Layout2_SumTmpValues ; r19:r18=default width
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine VLayout2_OnGetDefaultWidth
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @return r19:r18 value
|
||||||
|
; @clobbers any, !Y
|
||||||
|
|
||||||
|
VLayout2_OnGetDefaultWidth:
|
||||||
|
rcall Layout2_SetDefaultWidths
|
||||||
|
rcall Layout2_GetMaxTmp
|
||||||
|
bigcall Widget_AddOuterStyleBorders ; (r20, r21)
|
||||||
|
|
||||||
|
sec
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine vLayout2Horizontally
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @param X layout context
|
||||||
|
; @param r25 number of children
|
||||||
|
; @clobbers any, !Y
|
||||||
|
|
||||||
|
vLayout2Horizontally:
|
||||||
|
rcall vLayout2PrepareHorizontal ; (any, !R25, !X, !Y)
|
||||||
|
rcall vLayout2ReadLayoutWriteHorizontal ; (r16-r24)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine vLayout2PrepareHorizontal
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @param X layout context
|
||||||
|
; @param r25 number of children
|
||||||
|
; @clobbers any, !R25, !X, !Y,
|
||||||
|
|
||||||
|
vLayout2PrepareHorizontal:
|
||||||
|
push xl
|
||||||
|
push xh
|
||||||
|
push yl
|
||||||
|
push yh
|
||||||
|
push r25
|
||||||
|
rcall Layout2_SetDefaultWidths
|
||||||
|
pop r25
|
||||||
|
pop yh
|
||||||
|
pop yl
|
||||||
|
pop xh
|
||||||
|
pop xl
|
||||||
|
|
||||||
|
ldd r20, Y+WIDGET_OFFS_WIDTH_LO
|
||||||
|
ldd r21, Y+WIDGET_OFFS_WIDTH_HI
|
||||||
|
adiw xh:xl, LAYOUT_CTX_OFFS_TOTALSIZE_LO
|
||||||
|
st X+, r20
|
||||||
|
st X, r21
|
||||||
|
sbiw xh:xl, (LAYOUT_CTX_OFFS_TOTALSIZE_LO+1)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine vLayout2ReadLayoutWriteHorizontal
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @param X layout context
|
||||||
|
; @param r25 number of children
|
||||||
|
; @clobbers r16-r24
|
||||||
|
|
||||||
|
vLayout2ReadLayoutWriteHorizontal:
|
||||||
|
; read positions and flags into new layout context
|
||||||
|
bigcall LayoutCtx_ReadXDimsContiguous ; (R16, r18, r19, Z)
|
||||||
|
|
||||||
|
; layout
|
||||||
|
adiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
|
||||||
|
ld r18, X
|
||||||
|
clr r19
|
||||||
|
sbiw xh:xl, LAYOUT_CTX_OFFS_BORDERS
|
||||||
|
bigcall LayoutCtx_SetFixedPos ; (r24)
|
||||||
|
mov r22, r18 ; save border
|
||||||
|
|
||||||
|
bigcall LayoutCtx_GetMaxSize ; r19:r18=max default size (r18, r19, r20, r21, r24)
|
||||||
|
ldd r16, Y+WIDGET_OFFS_PACK
|
||||||
|
andi r16, (1<<WIDGET_PACK_HSELF1_BIT) | (1<<WIDGET_PACK_HSELF0_BIT)
|
||||||
|
cpi r16, WIDGET_PACK_FILLED
|
||||||
|
brne vLayout2ReadLayoutWriteHorizontal_setSize
|
||||||
|
; use full possible width
|
||||||
|
adiw xh:xl, LAYOUT_CTX_OFFS_TOTALSIZE_LO
|
||||||
|
ld r18, X+
|
||||||
|
ld r19, X
|
||||||
|
sbiw xh:xl, (LAYOUT_CTX_OFFS_TOTALSIZE_LO+1)
|
||||||
|
clr r23
|
||||||
|
lsl r22
|
||||||
|
rol r23
|
||||||
|
sub r18, r22
|
||||||
|
sbc r19, r23
|
||||||
|
vLayout2ReadLayoutWriteHorizontal_setSize:
|
||||||
|
bigcall LayoutCtx_SetFixedSize ; (r24)
|
||||||
|
|
||||||
|
; pack
|
||||||
|
bigcall LayoutCtx_PackXContiguous ; (R16, r18, r19, Z)
|
||||||
|
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine vLayout2Vertically
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @param X layout context
|
||||||
|
; @param r25 number of children
|
||||||
|
; @clobbers any, !X, !Y
|
||||||
|
|
||||||
|
vLayout2Vertically:
|
||||||
|
rcall vLayout2PrepareVertical ; (any, !R25, !X, !Y)
|
||||||
|
rcall vLayout2ReadLayoutWriteVertical ; (r16-r24)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine vLayout2PrepareVertical
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @param X layout context
|
||||||
|
; @param r25 number of children
|
||||||
|
; @clobbers any, !R25, !X, !Y,
|
||||||
|
|
||||||
|
vLayout2PrepareVertical:
|
||||||
|
push xl
|
||||||
|
push xh
|
||||||
|
push yl
|
||||||
|
push yh
|
||||||
|
push r25
|
||||||
|
rcall Layout2_SetDefaultHeights ; (any, !Y)
|
||||||
|
pop r25
|
||||||
|
pop yh
|
||||||
|
pop yl
|
||||||
|
pop xh
|
||||||
|
pop xl
|
||||||
|
|
||||||
|
; setup layout context for horizontal operations
|
||||||
|
ldd r20, Y+WIDGET_OFFS_HEIGHT_LO
|
||||||
|
ldd r21, Y+WIDGET_OFFS_HEIGHT_HI
|
||||||
|
adiw xh:xl, LAYOUT_CTX_OFFS_TOTALSIZE_LO
|
||||||
|
st X+, r20
|
||||||
|
st X, r21
|
||||||
|
sbiw xh:xl, (LAYOUT_CTX_OFFS_TOTALSIZE_LO+1)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine vLayout2ReadLayoutWriteVertical
|
||||||
|
;
|
||||||
|
; @param Y pointer to widget
|
||||||
|
; @param X layout context
|
||||||
|
; @param r25 number of children
|
||||||
|
; @clobbers r16-r24
|
||||||
|
|
||||||
|
vLayout2ReadLayoutWriteVertical:
|
||||||
|
; read X positions and flags into new layout context
|
||||||
|
bigcall LayoutCtx_ReadYDimsContiguous ; (R16, r18, r19, Z)
|
||||||
|
|
||||||
|
; layout
|
||||||
|
push r25
|
||||||
|
ldd r24, Y+VLAYOUT2_OFFS_MODE
|
||||||
|
cpi r24, VLAYOUT2_MODE_SPREAD
|
||||||
|
breq vLayout2ReadLayoutWriteVertical_spread
|
||||||
|
bigcall LayoutCtx_LayoutExpand ; (r16-r25)
|
||||||
|
rjmp vLayout2ReadLayoutWriteVertical_pack
|
||||||
|
vLayout2ReadLayoutWriteVertical_spread:
|
||||||
|
bigcall LayoutCtx_LayoutSpread ; (r16-r25)
|
||||||
|
vLayout2ReadLayoutWriteVertical_pack:
|
||||||
|
pop r25
|
||||||
|
|
||||||
|
; pack
|
||||||
|
push r25
|
||||||
|
bigcall LayoutCtx_PackYContiguous ; (r16-r21, r24, r25)
|
||||||
|
pop r25
|
||||||
|
|
||||||
|
; write back dims
|
||||||
|
; bigcall LayoutCtx_WriteYDimsContiguous ; (r16, r18, r19, r24)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ***************************************************************************
|
||||||
|
; data in FLASH
|
||||||
|
|
||||||
|
VLayout2_DefaultSignalmap:
|
||||||
|
; header
|
||||||
|
.dw Widget_DefaultSignalmap*2 ; next table to use
|
||||||
|
; entries
|
||||||
|
.db 0, WIDGET_SIGNAL_LAYOUT, LOW(VLayout2_OnLayout), HIGH(VLayout2_OnLayout)
|
||||||
|
.db WIDGET_VALUE_DEFAULT_WIDTH, WIDGET_SIGNAL_GETVALUE, LOW(VLayout2_OnGetDefaultWidth), HIGH(VLayout2_OnGetDefaultWidth)
|
||||||
|
.db WIDGET_VALUE_DEFAULT_HEIGHT, WIDGET_SIGNAL_GETVALUE, LOW(VLayout2_OnGetDefaultHeight), HIGH(VLayout2_OnGetDefaultHeight)
|
||||||
|
|
||||||
|
.db 0, 0, 0, 0 ; end of table
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
Reference in New Issue
Block a user