From 94b54cf04ed383f838ba766395d5b9c149b21013 Mon Sep 17 00:00:00 2001 From: 4am Date: Mon, 2 Apr 2018 15:26:05 -0400 Subject: [PATCH] refactor out SimulateClick --- src/ui.common.a | 29 +++++++++++++++++++++++++---- src/ui.main.keys.a | 9 +-------- src/ui.options.a | 9 +-------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/ui.common.a b/src/ui.common.a index 963ad71..95c658f 100644 --- a/src/ui.common.a +++ b/src/ui.common.a @@ -9,6 +9,7 @@ ; - CreateButton ; - PaintTitleBar ; - PrintAt +; - SimulateClick ; ; Public constants ; - kStringOK @@ -95,18 +96,18 @@ PaintTitleBar ldx #WGSetGlobalCursor jsr WeeGUI ldx #WGPlot - lda .stringTitle,y + lda kStringGlobalTitle,y jsr WeeGUI dey bpl - ldx #WGSyncGlobalCursor jmp WeeGUI -.stringTitle +kStringGlobalTitle !raw " " - !byte 16 + !byte 16 ; inverse P !raw "itch " - !byte 4 + !byte 4 ; inverse D !raw "ark ",0 } @@ -135,3 +136,23 @@ PrintAt ldx #WGPrint jmp WeeGUI } + +;------------------------------------------------------------------------------ +; SimulateClick +; select, focus, activate, and unfocus a WeeGUI view +; +; in: WeeGUI loaded and initialized +; A contains WeeGUI view ID +; out: X clobbered +;------------------------------------------------------------------------------ +!zone { +SimulateClick + ldx #WGSelectView + jsr WeeGUI + ldx #WGViewFocus + jsr WeeGUI + ldx #WGViewFocusAction + jsr WeeGUI + ldx #WGViewUnfocus + jmp WeeGUI +} diff --git a/src/ui.main.keys.a b/src/ui.main.keys.a index 185fb16..b1ceeb8 100644 --- a/src/ui.main.keys.a +++ b/src/ui.main.keys.a @@ -99,15 +99,8 @@ HandleKey tax ldy gViewInUse,x beq .notFound - ldx #WGSelectView - jsr WeeGUI .focusAndDoAction - ldx #WGViewFocus - jsr WeeGUI - ldx #WGViewFocusAction - jsr WeeGUI - ldx #WGViewUnfocus - jmp WeeGUI + jmp SimulateClick .y lda .xyzzy cmp #1 diff --git a/src/ui.options.a b/src/ui.options.a index 28933dc..e233545 100644 --- a/src/ui.options.a +++ b/src/ui.options.a @@ -127,14 +127,7 @@ HandleOptionsKey jmp SoftBell .foundKey lda .keys+1,x - ldx #WGSelectView - jsr WeeGUI - ldx #WGViewFocus - jsr WeeGUI - ldx #WGViewFocusAction - jsr WeeGUI - ldx #WGViewUnfocus - jmp WeeGUI + jmp SimulateClick callback_options_ok jsr SetPrefByCheckbox