mirror of
https://github.com/blondie7575/WeeGUI.git
synced 2024-06-26 18:29:47 +00:00
- Fixed a bug where mouse wouldn't initialize until a WGPlot was encountered
- Fixed painting routines corrupting PAGE2 switch at random - Fancy views can now detect clicks in their scroll bar areas - Callbacks now used as "re-render" messages in scrollable windows - Scrollbars now automagically functional
This commit is contained in:
parent
ad7309db49
commit
325db1bd10
BIN
guidemo.dsk
BIN
guidemo.dsk
Binary file not shown.
14
guidemo.s
14
guidemo.s
|
@ -56,10 +56,11 @@ main:
|
||||||
jsr WeeGUI
|
jsr WeeGUI
|
||||||
|
|
||||||
WGCALL16 WGCreateView,testView
|
WGCALL16 WGCreateView,testView
|
||||||
WGCALL16 WGViewSetTitle,testTitle0
|
WGCALL16 WGViewSetAction,testPaintContentsClick
|
||||||
WGCALL16 WGCreateCheckbox,testCheck
|
; WGCALL16 WGViewSetTitle,testTitle0
|
||||||
WGCALL16 WGCreateButton,testButton1
|
; WGCALL16 WGCreateCheckbox,testCheck
|
||||||
WGCALL16 WGCreateButton,testButton2
|
; WGCALL16 WGCreateButton,testButton1
|
||||||
|
; WGCALL16 WGCreateButton,testButton2
|
||||||
|
|
||||||
ldx #WGViewPaintAll
|
ldx #WGViewPaintAll
|
||||||
jsr WeeGUI
|
jsr WeeGUI
|
||||||
|
@ -71,6 +72,8 @@ main:
|
||||||
ldx #WGEnableMouse
|
ldx #WGEnableMouse
|
||||||
jsr WeeGUI
|
jsr WeeGUI
|
||||||
|
|
||||||
|
jsr testPaintContents
|
||||||
|
|
||||||
keyLoop:
|
keyLoop:
|
||||||
ldx #WGPendingViewAction
|
ldx #WGPendingViewAction
|
||||||
jsr WeeGUI
|
jsr WeeGUI
|
||||||
|
@ -159,6 +162,9 @@ keyLoop_quit:
|
||||||
jsr WeeGUI
|
jsr WeeGUI
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
testPaintContentsClick:
|
||||||
|
; brk
|
||||||
|
|
||||||
testPaintContents:
|
testPaintContents:
|
||||||
lda #0
|
lda #0
|
||||||
ldx #WGSelectView
|
ldx #WGSelectView
|
||||||
|
|
4
mouse.s
4
mouse.s
|
@ -71,6 +71,8 @@ CH_MOUSEPOINTER = 'B'
|
||||||
WGEnableMouse:
|
WGEnableMouse:
|
||||||
pha
|
pha
|
||||||
|
|
||||||
|
SETSWITCH PAGE2OFF
|
||||||
|
|
||||||
; Find slot number and calculate the various indirections needed
|
; Find slot number and calculate the various indirections needed
|
||||||
jsr WGFindMouse
|
jsr WGFindMouse
|
||||||
bcs WGEnableMouse_Error
|
bcs WGEnableMouse_Error
|
||||||
|
@ -131,6 +133,8 @@ WGEnableMouse_done:
|
||||||
WGDisableMouse:
|
WGDisableMouse:
|
||||||
pha
|
pha
|
||||||
|
|
||||||
|
SETSWITCH PAGE2OFF
|
||||||
|
|
||||||
lda WG_MOUSEACTIVE ; Never activated the mouse
|
lda WG_MOUSEACTIVE ; Never activated the mouse
|
||||||
beq WGDisableMouse_done
|
beq WGDisableMouse_done
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,8 @@ WGDesktop_charLoop:
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
WGTest:
|
||||||
|
rts
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; WGPlot
|
; WGPlot
|
||||||
|
@ -120,6 +121,7 @@ WGPlot_xOdd:
|
||||||
sta (BASL)
|
sta (BASL)
|
||||||
|
|
||||||
WGPlot_done:
|
WGPlot_done:
|
||||||
|
SETSWITCH PAGE2OFF
|
||||||
RESTORE_XY
|
RESTORE_XY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
3
rects.s
3
rects.s
|
@ -129,6 +129,7 @@ WGFillRect_horzLoopOddAlignedEvenWidth:
|
||||||
bcs WGFillRect_vertLoop
|
bcs WGFillRect_vertLoop
|
||||||
|
|
||||||
WGFillRect_done:
|
WGFillRect_done:
|
||||||
|
SETSWITCH PAGE2OFF
|
||||||
RESTORE_AX
|
RESTORE_AX
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -433,6 +434,7 @@ WGStrokeRect_vertLoopJmp:
|
||||||
jmp WGStrokeRect_vertLoop
|
jmp WGStrokeRect_vertLoop
|
||||||
|
|
||||||
WGStrokeRect_done:
|
WGStrokeRect_done:
|
||||||
|
SETSWITCH PAGE2OFF
|
||||||
RESTORE_ZPS
|
RESTORE_ZPS
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
@ -752,6 +754,7 @@ WGFancyRect_corners:
|
||||||
jsr WGPlot
|
jsr WGPlot
|
||||||
|
|
||||||
WGFancyRect_done:
|
WGFancyRect_done:
|
||||||
|
SETSWITCH PAGE2OFF
|
||||||
RESTORE_ZPS
|
RESTORE_ZPS
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
189
views.s
189
views.s
|
@ -7,6 +7,11 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
WG_FEATURE_UP = %00010000
|
||||||
|
WG_FEATURE_DN = %00100000
|
||||||
|
WG_FEATURE_LF = %00110000
|
||||||
|
WG_FEATURE_RT = %01000000
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; WGCreateView
|
; WGCreateView
|
||||||
|
@ -682,10 +687,7 @@ WGViewFocusAction:
|
||||||
|
|
||||||
cmp #VIEW_STYLE_CHECK
|
cmp #VIEW_STYLE_CHECK
|
||||||
beq WGViewFocusAction_toggleCheckbox
|
beq WGViewFocusAction_toggleCheckbox
|
||||||
cmp #VIEW_STYLE_BUTTON
|
bra WGViewFocusAction_buttonClick ; Everything else treated like a button
|
||||||
beq WGViewFocusAction_buttonClick
|
|
||||||
|
|
||||||
bra WGViewFocusAction_done
|
|
||||||
|
|
||||||
WGViewFocusAction_toggleCheckbox:
|
WGViewFocusAction_toggleCheckbox:
|
||||||
lda WG_VIEWRECORDS+9,y ; Change the checkbox's state and redraw
|
lda WG_VIEWRECORDS+9,y ; Change the checkbox's state and redraw
|
||||||
|
@ -748,24 +750,86 @@ WGViewFocusAction_knownRTS:
|
||||||
; Side effects: Changes selected view, Repaints some views
|
; Side effects: Changes selected view, Repaints some views
|
||||||
;
|
;
|
||||||
WGPendingViewAction:
|
WGPendingViewAction:
|
||||||
pha
|
SAVE_AY
|
||||||
|
|
||||||
lda WG_PENDINGACTIONVIEW
|
lda WG_PENDINGACTIONVIEW
|
||||||
bmi WGPendingViewAction_done
|
bmi WGPendingViewAction_done
|
||||||
|
|
||||||
|
and #$f ; Select view in question
|
||||||
jsr WGSelectView
|
jsr WGSelectView
|
||||||
|
LDY_ACTIVEVIEW
|
||||||
|
|
||||||
|
lda WG_VIEWRECORDS+4,y
|
||||||
|
and #$f
|
||||||
|
cmp #VIEW_STYLE_FANCY ; Filter out fancy views with high-nybble of 0
|
||||||
|
bne WGPendingViewAction_chkCallback ; This prevents unnecessary redraws when clicking
|
||||||
|
lda WG_PENDINGACTIONVIEW ; in the content area
|
||||||
|
and #$f0
|
||||||
|
beq WGPendingViewAction_done
|
||||||
|
|
||||||
|
WGPendingViewAction_chkCallback:
|
||||||
|
lda WG_VIEWRECORDS+10,y ; Optimization- only process things that can be clicked
|
||||||
|
bne WGPendingViewAction_hasCallback
|
||||||
|
lda WG_VIEWRECORDS+11,y
|
||||||
|
beq WGPendingViewAction_done
|
||||||
|
|
||||||
|
WGPendingViewAction_hasCallback:
|
||||||
|
lda WG_PENDINGACTIONVIEW
|
||||||
|
and #$f0 ; Check for window features
|
||||||
|
beq WGPendingViewAction_content
|
||||||
|
|
||||||
|
cmp #WG_FEATURE_UP
|
||||||
|
beq WGPendingViewAction_up
|
||||||
|
cmp #WG_FEATURE_DN
|
||||||
|
beq WGPendingViewAction_down
|
||||||
|
cmp #WG_FEATURE_LF
|
||||||
|
beq WGPendingViewAction_left
|
||||||
|
cmp #WG_FEATURE_RT
|
||||||
|
bne WGPendingViewAction_done
|
||||||
|
|
||||||
|
lda #-1 ; Right arrow
|
||||||
|
jsr WGScrollXBy
|
||||||
|
jsr WGViewFocus
|
||||||
|
jsr WGViewFocusAction ; Trigger application to redraw contents
|
||||||
|
|
||||||
|
WGPendingViewAction_done: ; Centralized for branch range
|
||||||
|
lda #$ff
|
||||||
|
sta WG_PENDINGACTIONVIEW
|
||||||
|
|
||||||
|
RESTORE_AY
|
||||||
|
rts
|
||||||
|
|
||||||
|
WGPendingViewAction_up:
|
||||||
|
lda #1 ; Up arrow
|
||||||
|
jsr WGScrollYBy
|
||||||
|
jsr WGViewFocus
|
||||||
|
jsr WGViewFocusAction ; Trigger application to redraw contents
|
||||||
|
bra WGPendingViewAction_done
|
||||||
|
|
||||||
|
WGPendingViewAction_down:
|
||||||
|
lda #-1 ; Down arrow
|
||||||
|
jsr WGScrollYBy
|
||||||
|
jsr WGViewFocus
|
||||||
|
jsr WGViewFocusAction ; Trigger application to redraw contents
|
||||||
|
bra WGPendingViewAction_done
|
||||||
|
|
||||||
|
WGPendingViewAction_left:
|
||||||
|
lda #1 ; Left arrow
|
||||||
|
jsr WGScrollXBy
|
||||||
|
jsr WGViewFocus
|
||||||
|
jsr WGViewFocusAction ; Trigger application to redraw contents
|
||||||
|
bra WGPendingViewAction_done
|
||||||
|
|
||||||
|
WGPendingViewAction_content:
|
||||||
jsr WGViewFocus
|
jsr WGViewFocus
|
||||||
jsr WGViewFocusAction
|
jsr WGViewFocusAction
|
||||||
jsr delayShort
|
jsr delayShort
|
||||||
jsr WGViewUnfocus
|
jsr WGViewUnfocus
|
||||||
|
|
||||||
jsr WGPointerDirty ; If we redrew anything, the pointer BG will be stale
|
jsr WGPointerDirty ; If we redrew anything, the pointer BG will be stale
|
||||||
|
bra WGPendingViewAction_done
|
||||||
|
|
||||||
lda #$ff
|
|
||||||
sta WG_PENDINGACTIONVIEW
|
|
||||||
|
|
||||||
WGPendingViewAction_done:
|
|
||||||
pla
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -1063,9 +1127,16 @@ WGViewPaintAll_done:
|
||||||
; Finds a view containing the given point
|
; Finds a view containing the given point
|
||||||
; PARAM0:X
|
; PARAM0:X
|
||||||
; PARAM1:Y
|
; PARAM1:Y
|
||||||
; OUT A: View ID (or $ff if no match)
|
; OUT A: View ID (or high bit set if no match)
|
||||||
|
; For Fancy Views, Upper nibble returned indicates feature hit:
|
||||||
|
; 0000 : Content region
|
||||||
|
; 0001 : Scroll arrow up
|
||||||
|
; 0010 : Scroll arrow down
|
||||||
|
; 0011 : Scroll arrow left
|
||||||
|
; 0100 : Scroll arrow right
|
||||||
WGViewFromPoint:
|
WGViewFromPoint:
|
||||||
SAVE_XY
|
SAVE_XY
|
||||||
|
SAVE_ZPS
|
||||||
|
|
||||||
ldx #$f ; Scan views backwards, because controls are usually at the end
|
ldx #$f ; Scan views backwards, because controls are usually at the end
|
||||||
|
|
||||||
|
@ -1076,6 +1147,26 @@ WGViewFromPoint_loop:
|
||||||
lda WG_VIEWRECORDS+2,y
|
lda WG_VIEWRECORDS+2,y
|
||||||
beq WGViewFromPoint_loopNext ; Not an allocated view
|
beq WGViewFromPoint_loopNext ; Not an allocated view
|
||||||
|
|
||||||
|
lda WG_VIEWRECORDS+4,y ; Fancy views are handled differently
|
||||||
|
and #$f
|
||||||
|
cmp #VIEW_STYLE_FANCY
|
||||||
|
beq WGViewFromPoint_loopFancy
|
||||||
|
|
||||||
|
lda WG_VIEWRECORDS+2,y
|
||||||
|
sta SCRATCH0
|
||||||
|
lda WG_VIEWRECORDS+3,y
|
||||||
|
sta SCRATCH1
|
||||||
|
bra WGViewFromPoint_loopCheckBounds
|
||||||
|
|
||||||
|
WGViewFromPoint_loopFancy:
|
||||||
|
lda WG_VIEWRECORDS+2,y ; Include scrollbars
|
||||||
|
inc
|
||||||
|
sta SCRATCH0
|
||||||
|
lda WG_VIEWRECORDS+3,y
|
||||||
|
inc
|
||||||
|
sta SCRATCH1
|
||||||
|
|
||||||
|
WGViewFromPoint_loopCheckBounds:
|
||||||
lda PARAM0 ; Check left edge
|
lda PARAM0 ; Check left edge
|
||||||
cmp WG_VIEWRECORDS+0,y
|
cmp WG_VIEWRECORDS+0,y
|
||||||
bcc WGViewFromPoint_loopNext
|
bcc WGViewFromPoint_loopNext
|
||||||
|
@ -1086,28 +1177,92 @@ WGViewFromPoint_loop:
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+0,y ; Check right edge
|
lda WG_VIEWRECORDS+0,y ; Check right edge
|
||||||
clc
|
clc
|
||||||
adc WG_VIEWRECORDS+2,y
|
adc SCRATCH0
|
||||||
cmp PARAM0
|
cmp PARAM0
|
||||||
bcc WGViewFromPoint_loopNext
|
bcc WGViewFromPoint_loopNext
|
||||||
beq WGViewFromPoint_loopNext
|
beq WGViewFromPoint_loopNext
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+1,y ; Check bottom edge
|
lda WG_VIEWRECORDS+1,y ; Check bottom edge
|
||||||
clc
|
clc
|
||||||
adc WG_VIEWRECORDS+3,y
|
adc SCRATCH1
|
||||||
cmp PARAM1
|
cmp PARAM1
|
||||||
bcc WGViewFromPoint_loopNext
|
bcc WGViewFromPoint_loopNext
|
||||||
beq WGViewFromPoint_loopNext
|
beq WGViewFromPoint_loopNext
|
||||||
|
|
||||||
txa ; Found a match
|
; Found a match (in X)
|
||||||
RESTORE_XY
|
lda WG_VIEWRECORDS+4,y
|
||||||
rts
|
and #$f ; Mask off flag bits
|
||||||
|
cmp #VIEW_STYLE_FANCY
|
||||||
|
bne WGViewFromPoint_matchDone
|
||||||
|
|
||||||
WGViewFromPoint_loopNext:
|
; For fancy views, check scrollbars as well
|
||||||
|
lda WG_VIEWRECORDS+0,y ; Right scroll bar?
|
||||||
|
clc
|
||||||
|
adc SCRATCH0
|
||||||
|
dec
|
||||||
|
cmp PARAM0
|
||||||
|
bne WGViewFromPoint_checkBottomScroll
|
||||||
|
|
||||||
|
lda PARAM1 ; Up arrow?
|
||||||
|
cmp WG_VIEWRECORDS+1,y
|
||||||
|
bne WGViewFromPoint_checkDownArrow
|
||||||
|
txa
|
||||||
|
ora #WG_FEATURE_UP
|
||||||
|
bra WGViewFromPoint_matchFancyDone
|
||||||
|
|
||||||
|
WGViewFromPoint_loopNext: ; Inserted here for branch range
|
||||||
dex
|
dex
|
||||||
bmi WGViewFromPoint_noMatch
|
bmi WGViewFromPoint_noMatch
|
||||||
bra WGViewFromPoint_loop
|
bra WGViewFromPoint_loop
|
||||||
|
|
||||||
|
WGViewFromPoint_checkDownArrow:
|
||||||
|
lda WG_VIEWRECORDS+1,y ; Down arrow?
|
||||||
|
clc
|
||||||
|
adc SCRATCH1
|
||||||
|
dec
|
||||||
|
dec
|
||||||
|
cmp PARAM1
|
||||||
|
bne WGViewFromPoint_matchDone
|
||||||
|
txa
|
||||||
|
ora #WG_FEATURE_DN
|
||||||
|
bra WGViewFromPoint_matchFancyDone
|
||||||
|
|
||||||
|
WGViewFromPoint_checkBottomScroll:
|
||||||
|
lda WG_VIEWRECORDS+1,y ; Bottom scroll bar?
|
||||||
|
clc
|
||||||
|
adc SCRATCH1
|
||||||
|
dec
|
||||||
|
cmp PARAM1
|
||||||
|
bne WGViewFromPoint_matchDone
|
||||||
|
lda PARAM0 ; Left arrow?
|
||||||
|
cmp WG_VIEWRECORDS+0,y
|
||||||
|
bne WGViewFromPoint_checkRightArrow
|
||||||
|
txa
|
||||||
|
ora #WG_FEATURE_LF
|
||||||
|
bra WGViewFromPoint_matchFancyDone
|
||||||
|
|
||||||
|
WGViewFromPoint_checkRightArrow:
|
||||||
|
lda WG_VIEWRECORDS+0,y ; Right arrow?
|
||||||
|
clc
|
||||||
|
adc SCRATCH0
|
||||||
|
dec
|
||||||
|
dec
|
||||||
|
cmp PARAM0
|
||||||
|
bne WGViewFromPoint_matchDone
|
||||||
|
txa
|
||||||
|
ora #WG_FEATURE_RT
|
||||||
|
|
||||||
|
WGViewFromPoint_matchFancyDone:
|
||||||
|
tax
|
||||||
|
|
||||||
|
WGViewFromPoint_matchDone:
|
||||||
|
RESTORE_ZPS
|
||||||
|
txa
|
||||||
|
RESTORE_XY
|
||||||
|
rts
|
||||||
|
|
||||||
WGViewFromPoint_noMatch:
|
WGViewFromPoint_noMatch:
|
||||||
|
RESTORE_ZPS
|
||||||
lda #$ff
|
lda #$ff
|
||||||
RESTORE_XY
|
RESTORE_XY
|
||||||
rts
|
rts
|
||||||
|
|
Loading…
Reference in New Issue
Block a user