more work on dialogs.
This commit is contained in:
@@ -11,6 +11,17 @@
|
||||
#define AQH_AVR_GUI_DEFS_ASM
|
||||
|
||||
|
||||
.equ WINRECT_OFFS_X_LO = 0
|
||||
.equ WINRECT_OFFS_X_HI = 1
|
||||
.equ WINRECT_OFFS_Y_LO = 2
|
||||
.equ WINRECT_OFFS_Y_HI = 3
|
||||
.equ WINRECT_OFFS_WIDTH_LO = 4
|
||||
.equ WINRECT_OFFS_WIDTH_HI = 5
|
||||
.equ WINRECT_OFFS_HEIGHT_LO = 6
|
||||
.equ WINRECT_OFFS_HEIGHT_HI = 7
|
||||
.equ WINRECT_SIZE = 8
|
||||
|
||||
|
||||
|
||||
.equ WIN_OFFS_X_LO = 0
|
||||
.equ WIN_OFFS_X_HI = 1
|
||||
|
||||
@@ -31,9 +31,8 @@
|
||||
.equ DIALOG_FN_FINI = 1
|
||||
.equ DIALOG_FN_SHOW = 2
|
||||
.equ DIALOG_FN_HIDE = 3
|
||||
.equ DIALOG_FN_DRAW = 4
|
||||
.equ DIALOG_FN_TOUCH = 5
|
||||
.equ DIALOG_FN_TIMER = 6
|
||||
.equ DIALOG_FN_TOUCH = 4
|
||||
.equ DIALOG_FN_TIMER = 5
|
||||
|
||||
|
||||
|
||||
@@ -87,9 +86,20 @@ DialogMgr_Init:
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine DialogMgr_Every100ms @global
|
||||
;
|
||||
; Handle display touch events
|
||||
; Send timer event to every app in the stack (started with last added app).
|
||||
|
||||
DialogMgr_Every100ms:
|
||||
; check for touch input changes
|
||||
rcall Display_InputGetState ; r16=flags, r5:r4=x, r7:r6=y
|
||||
mov r17, r16
|
||||
andi r17, (1<<DISPLAY_IFLAGS_CHGCOORD_BIT) | (1<<DISPLAY_IFLAGS_CHGPRESS_BIT)
|
||||
breq DialogMgr_Every100ms_sendTimer
|
||||
mov r18, r16
|
||||
ldi r23, DIALOG_FN_TOUCH
|
||||
rcall DialogMgr_CallCurrentHandler
|
||||
DialogMgr_Every100ms_sendTimer:
|
||||
; send timer event to all dialogs in stack
|
||||
ldi xl, LOW(dialogStack)
|
||||
ldi xh, HIGH(dialogStack)
|
||||
|
||||
@@ -109,7 +119,7 @@ DialogMgr_Every100ms_loop:
|
||||
push xh
|
||||
push r17
|
||||
ldi r23, DIALOG_FN_TIMER
|
||||
rcall DialogMgr_CallCurrentHandler
|
||||
rcall DialogMgr_CallHandler
|
||||
pop r17
|
||||
pop xh
|
||||
pop xl
|
||||
@@ -129,6 +139,11 @@ DialogMgr_Every100ms_ret:
|
||||
; @clobbers R16, R17, R22, X (any)
|
||||
|
||||
DialogMgr_CallHandler:
|
||||
tst yl
|
||||
brne DialogMgr_CallHandler_go
|
||||
tst yh
|
||||
breq DialogMgr_CallHandler_ret
|
||||
DialogMgr_CallHandler_go:
|
||||
ldi xl, LOW(dialogWindow)
|
||||
ldi xh, HIGH(dialogWindow)
|
||||
ldd r16, Y+DIALOG_OFFS_HANDLER_LO
|
||||
@@ -186,6 +201,7 @@ DialogMgr_PushDialog:
|
||||
|
||||
DialogMgr_PushDialog_push:
|
||||
lds r16, dialogStackPos
|
||||
mov r17, r16
|
||||
add r17, r17 ; *2
|
||||
push xl
|
||||
push xh
|
||||
@@ -200,10 +216,13 @@ DialogMgr_PushDialog_push:
|
||||
pop xl
|
||||
inc r16
|
||||
sts dialogStackPos, r16
|
||||
sts dialogCurrent, yl
|
||||
sts dialogCurrent+1, yh
|
||||
; activate new app
|
||||
ldd r17, Y+DIALOG_OFFS_OPTIONS
|
||||
ori r17, (1<<DIALOG_OPT_ACTIVE_BIT)
|
||||
std Y+DIALOG_OFFS_OPTIONS, r17
|
||||
|
||||
ldi r23, DIALOG_FN_SHOW
|
||||
rcall DialogMgr_CallHandler
|
||||
sec
|
||||
@@ -273,6 +292,23 @@ DialogMgr_PopDialog_ret:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Dialog_Init @global
|
||||
;
|
||||
; @param Y pointer to screen object in SDRAM
|
||||
; @clobbers R16, R17, X
|
||||
|
||||
Dialog_Init:
|
||||
mov xl, yl
|
||||
mov xh, yh
|
||||
ldi r17, DIALOG_SIZE
|
||||
clr r16
|
||||
bigcall Utils_FillSram ; (R17, X)
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
#endif ; AQHOME_AVR_MODS_GUI_DIALOG_ASM
|
||||
|
||||
|
||||
@@ -11,13 +11,19 @@
|
||||
#define AQH_AVR_GUI_STYLE_ASM
|
||||
|
||||
|
||||
.equ STYLE_WIN_TITLE_BACKGROUND = DISPLAY_COLOR_NAVY
|
||||
.equ STYLE_WIN_TITLE_FOREGROUND = DISPLAY_COLOR_WHITE
|
||||
.equ STYLE_WIN_BACKGROUND = DISPLAY_COLOR_LIGHTGREY
|
||||
.equ STYLE_WIN_FOREGROUND = DISPLAY_COLOR_BLACK
|
||||
.equ STYLE_WIN_FONT = ili9341Font12x20_1
|
||||
.equ STYLE_WIN_TITLE_BACKGROUND = DISPLAY_COLOR_NAVY
|
||||
.equ STYLE_WIN_TITLE_FOREGROUND = DISPLAY_COLOR_WHITE
|
||||
.equ STYLE_BUTTON_COL_BORDER = DISPLAY_COLOR_BLACK
|
||||
.equ STYLE_BUTTON_COL_BG_NORM = DISPLAY_COLOR_LIGHTGREY
|
||||
.equ STYLE_BUTTON_COL_BG_PRESSED = DISPLAY_COLOR_NAVY
|
||||
.equ STYLE_BUTTON_COL_FG_NORM = DISPLAY_COLOR_BLACK
|
||||
.equ STYLE_BUTTON_COL_FG_PRESSED = DISPLAY_COLOR_WHITE
|
||||
|
||||
.equ STYLE_WIN_TITLE_HEIGHT = 24
|
||||
.equ STYLE_WIN_BACKGROUND = DISPLAY_COLOR_LIGHTGREY
|
||||
.equ STYLE_WIN_FOREGROUND = DISPLAY_COLOR_BLACK
|
||||
.equ STYLE_WIN_FONT = ili9341Font12x20_1
|
||||
|
||||
.equ STYLE_WIN_TITLE_HEIGHT = 24
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -78,6 +78,51 @@ Window_FillRect:
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Window_IsPointInRect @global
|
||||
;
|
||||
; @param Z pointer WINRECT object in FLASH (see @ref WINRECT_OFFS_X_LO)
|
||||
; @param R5:R4 X (dest)
|
||||
; @param R7:R6 Y (dest)
|
||||
; @clobbers r16, r17, r18, r19, r20, r21, Z
|
||||
|
||||
Window_IsPointInRect:
|
||||
; check X
|
||||
lpm r16, Z+ ; X
|
||||
lpm r17, Z+
|
||||
mov r18, r4 ; X
|
||||
mov r19, r5
|
||||
sub r18, r16
|
||||
sbc r19, r17 ; r19:r18=X pos relative to rectangle
|
||||
brcs Window_IsPointInRect_clcRet
|
||||
; check Y
|
||||
lpm r16, Z+ ; Y
|
||||
lpm r17, Z+
|
||||
mov r20, r6 ; Y
|
||||
mov r21, r7
|
||||
sub r20, r16
|
||||
sbc r21, r17 ; r21:r20=Y pos relative to rectangle
|
||||
brcs Window_IsPointInRect_clcRet
|
||||
; check width
|
||||
lpm r16, Z+ ; width
|
||||
lpm r17, Z+
|
||||
cp r18, r16 ; width > rel X?
|
||||
cpc r19, r17
|
||||
brcc Window_IsPointInRect_ret
|
||||
; check height
|
||||
lpm r16, Z+ ; height
|
||||
lpm r17, Z+
|
||||
cp r20, r16 ; height > rel Y?
|
||||
cpc r21, r17
|
||||
rjmp Window_IsPointInRect_ret ; CF set if inside rect
|
||||
Window_IsPointInRect_clcRet:
|
||||
clc
|
||||
Window_IsPointInRect_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Window_DrawTextFlash @global
|
||||
;
|
||||
@@ -102,7 +147,8 @@ Window_DrawTextFlash:
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine Window_DrawColorTextFlash @global
|
||||
;
|
||||
; @param Y pointer to screen object in SDRAM
|
||||
; @param Y pointer to screen object in SDRAM
|
||||
; @param Z pointer to null-terminated string
|
||||
; @param R1:R0 background color
|
||||
; @param R3:R2 foreground color
|
||||
; @param R5:R4 X (dest)
|
||||
|
||||
Reference in New Issue
Block a user