- Added support for titles on checkboxes

- Corrected byte ordering of callback and title pointers in views
This commit is contained in:
Quinn Dunki 2014-09-21 13:46:41 -07:00
parent 58deae7241
commit 28adec64ca
5 changed files with 66 additions and 21 deletions

View File

@ -435,6 +435,11 @@ WGAmpersand_CHKBOX:
jsr WGAmpersandIntArgument
sta WGAmpersandCommandBuffer+2
jsr WGAmpersandNextArgument
jsr WGAmpersandStrArgument
stx WGAmpersandCommandBuffer+3
sty WGAmpersandCommandBuffer+4
jsr WGAmpersandEndArguments
@ -492,12 +497,12 @@ WGAmpersand_BUTTN:
ora WG_VIEWRECORDS+4,y
sta WG_VIEWRECORDS+4,y
lda WGAmpersandCommandBuffer+6 ; Set the button text
sta PARAM0
lda WGAmpersandCommandBuffer+7
sta PARAM1
jsr WGViewSetTitle
; lda WGAmpersandCommandBuffer+6 ; Set the button text
; sta PARAM0
; lda WGAmpersandCommandBuffer+7
; sta PARAM1
;
; jsr WGViewSetTitle
jsr WGPaintView
jsr WGBottomCursor

13
gui.s
View File

@ -30,15 +30,9 @@ main:
CALL16 WGCreateView,testView
CALL16 WGViewSetTitle,testTitle0
CALL16 WGCreateCheckbox,testCheck
CALL16 WGCreateButton,testButton1
CALL16 WGViewSetTitle,testTitle1
CALL16 WGViewSetAction,testCallback
CALL16 WGCreateButton,testButton2
CALL16 WGViewSetTitle,testTitle2
jsr WGViewPaintAll
; jsr testPaintContents
@ -253,12 +247,17 @@ testView:
testCheck:
.byte 1,16,4
.addr testTitle3
testButton1:
.byte 2,35,10,15
.addr testCallback
.addr testTitle1
testButton2:
.byte 3,35,13,15
.addr 0
.addr testTitle2
testStr:
; .byte "This is a test of the emergency broadcast system.",0; If this had been a real emergency, you would be dead now.",0 ; 107 chars
@ -274,6 +273,8 @@ testTitle1:
.byte "Okay",0
testTitle2:
.byte "Cancel",0
testTitle3:
.byte "More Magic",0

Binary file not shown.

View File

@ -56,7 +56,7 @@ WG_VIEWCLIP:
WG_VIEWRECORDS:
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13
; X, Y, Screen Width, Screen Height, Style, X Offset, Y Offset, View Width, View Height, State, CallbackH, CallbackL, TitleH, TitleL
; X, Y, Screen Width, Screen Height, Style, X Offset, Y Offset, View Width, View Height, State, CallbackL, CallbackH, TitleL, TitleH
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

55
views.s
View File

@ -113,6 +113,8 @@ WGCreateView_done:
; ID: View ID (0-f)
; XX: Screen X origin
; YY: Screen Y origin
; SL: String pointer (LSB)
; SH: String pointer (MSB)
;
WGCreateCheckbox:
SAVE_AXY
@ -166,6 +168,16 @@ WGCreateCheckbox:
sta WG_VIEWRECORDS,x ; Initialize callback
inx
sta WG_VIEWRECORDS,x
inx
iny
lda (PARAM0),y
sta WG_VIEWRECORDS,x ; Title
inx
iny
lda (PARAM0),y
sta WG_VIEWRECORDS,x
inx
pla
jsr WGSelectView ; Leave this as the active view
@ -190,6 +202,8 @@ WGCreateCheckbox_done:
; BW: Button width
; PL: Action callback (LSB)
; PH: Action callback (MSB)
; SL: Title string pointer (LSB)
; SH: Title string pointer (MSB)
WGCreateButton:
SAVE_AXY
SAVE_ZPS
@ -252,10 +266,14 @@ WGCreateButton:
sta WG_VIEWRECORDS,x
inx
lda #0
sta WG_VIEWRECORDS,x ; Initialize title
iny
lda (PARAM0),y
sta WG_VIEWRECORDS,x ; Title
inx
iny
lda (PARAM0),y
sta WG_VIEWRECORDS,x
inx
sta WG_VIEWRECORDS,x ; Initialize title
pla
jsr WGSelectView ; Leave this as the active view
@ -327,7 +345,7 @@ WGPaintView_done:
; paintCheck
; Paints the contents of a checkbox
; Y: Index into view records of checkbox to paint
; Side effects: Clobbers A, S0
; Side effects: Clobbers S0,P0,P1, all registers
paintCheck:
lda WG_VIEWRECORDS+0,y ; Position cursor
sta WG_CURSORX
@ -362,6 +380,27 @@ paintCheck_selectedUnchecked:
paintCheck_plot: ; Paint our state
jsr WGPlot
inc WG_CURSORX ; Prepare for title
inc WG_CURSORX
jsr WGNormal
lda WG_VIEWRECORDS+12,y
sta PARAM0
lda WG_VIEWRECORDS+13,y
sta PARAM1
ldy #0
paintCheck_titleLoop:
lda (PARAM0),y
beq paintCheck_done
ora #$80
jsr WGPlot
inc WG_CURSORX
iny
bra paintCheck_titleLoop
paintCheck_done:
rts
@ -374,9 +413,9 @@ paintButton:
SAVE_AX
SAVE_ZPS
lda WG_VIEWRECORDS+13,y ; Prep the title string
lda WG_VIEWRECORDS+12,y ; Prep the title string
sta PARAM0
lda WG_VIEWRECORDS+12,y
lda WG_VIEWRECORDS+13,y
sta PARAM1
jsr WGStrLen ; Compute centering offset for title
@ -747,10 +786,10 @@ WGViewFocusAction_buttonClick:
and #VIEW_STYLE_APPLESOFT
bne WGViewFocusAction_buttonClickApplesoft
lda WG_VIEWRECORDS+10,y ; Do we have a callback?
lda WG_VIEWRECORDS+11,y ; Do we have a callback?
beq WGViewFocusAction_done
sta WGViewFocusAction_userJSR+2 ; Modify code below so we can JSR to user's code
lda WG_VIEWRECORDS+11,y
lda WG_VIEWRECORDS+10,y
sta WGViewFocusAction_userJSR+1
WGViewFocusAction_userJSR: