mirror of
https://github.com/blondie7575/WeeGUI.git
synced 2025-01-08 14:29:46 +00:00
Support for removing views
- Added WGDeleteView and &KILL - Added WGEraseView and &WIPE - Fixed focus iteration code to handle unallocated views in the middle of the list
This commit is contained in:
parent
4e286870da
commit
0fe5765c45
@ -272,11 +272,23 @@ A View is a rectangle inside which content is displayed. Content exists in a spe
|
||||
|
||||
Many API calls rely on the concept of a "selected" view. One view at a time can be "selected", and subsequent view-related operations will apply to that view. There is no visual effect to "selecting" a view. It's simply a way to tell WeeGUI which view you are currently interested in.
|
||||
|
||||
**IMPORTANT:** The visual border around a view (a one-character-thick outline) is drawn *outside* the bounds of the view. This means *you need to allow room around your views*. Don't attempt to place a view in columns 0 or 79, or in rows 0 or 23. *In order to maximize rendering speed, WeeGUI takes only minimal precautions to prevent rendering outside the visible screen area.*
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
|
||||
View Styles
|
||||
-----------
|
||||
|
||||
Views in WeeGUI can be drawn with two different types of frame: Plain and Fancy. Examples of each are shown below.
|
||||
|
||||
|
||||
**IMPORTANT:** The visual border around a view (a one-character-thick outline) is drawn *outside* the bounds of the view. This means *you need to allow room around your views*. Don't attempt to place a view in columns 0 or 79, or in rows 0 or 23. *In order to maximize rendering speed, WeeGUI takes only minimal precautions to prevent rendering outside the visible screen area.* Rendering outside the screen area will almost certainly cause crashes and other Very Bad Things™ on your Apple II.
|
||||
|
||||
Because view frames are rendered with Mousetext characters, views have limits on how close they can be placed together, and overlapping views may not always look perfect. WeeGUI views are drawn with a modern display-list rendering strategy, which means it combines information about all views to make the result look as good as possible within the constraints of the Apple II character set. For example, you *can* have Plain views that are separated by only one row, because there is a "double-horizontal-line" character in Mousetext that WeeGUI can use to render horizontal borders close together. However, no such character exists for verticals, thus adjacent views must be separated by at least two columns. You'll need to experiment a bit to get a sense of what will render well and what won't.
|
||||
|
||||
<br>
|
||||
|
||||
|
||||
Cursors
|
||||
-------
|
||||
|
||||
@ -314,7 +326,7 @@ These routines are used for creating, modifying, and working with views.
|
||||
|
||||
|
||||
####WGCreateView
|
||||
Creates a new WeeGUI view. Up to 16 are allowed in one program. If a view is created with the same ID as a previous view, the previous view is destroyed. Views are not shown when created. Call *WGPaintView* to display it.
|
||||
Creates a new WeeGUI view. Up to 16 are allowed in one program. If a view is created with the same ID as a previous view, the previous view is destroyed and replaced with the new one. Views are not shown when created. Call *WGPaintView* to display it.
|
||||
|
||||
|
||||
<table width="100%">
|
||||
@ -399,6 +411,18 @@ Configuration block consists of eight bytes:
|
||||
</table>
|
||||
|
||||
|
||||
####WGDeleteView
|
||||
Deletes the selected view. The view is erased from the screen, and the ID is now available for use by a new view.
|
||||
|
||||
<table width="100%">
|
||||
<tr><th>Assembly</th><th>Applesoft</th></tr><tr><td><pre>
|
||||
X: WGDeleteView
|
||||
</pre></td><td><pre>
|
||||
&KILL
|
||||
</pre></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
####WGSelectView
|
||||
Selects a view. Subsequent view-related operations will apply to this view. Does not affect visual appearance of view.
|
||||
|
||||
@ -522,6 +546,30 @@ X: WGViewPaintAll
|
||||
</table>
|
||||
|
||||
|
||||
####WGEraseViewContents
|
||||
Erases the content area of the selected view. The frame is not touched.
|
||||
|
||||
<table width="100%">
|
||||
<tr><th>Assembly</th><th>Applesoft</th></tr><tr><td><pre>
|
||||
X: WGEraseViewContents
|
||||
</pre></td><td><pre>
|
||||
&ERASE
|
||||
</pre></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
####WGEraseView
|
||||
Erases the content area and frame of the selected view.
|
||||
|
||||
<table width="100%">
|
||||
<tr><th>Assembly</th><th>Applesoft</th></tr><tr><td><pre>
|
||||
X: WGEraseView
|
||||
</pre></td><td><pre>
|
||||
&WIPE
|
||||
</pre></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
####WGViewSetTitle
|
||||
Changes the title of the selected view. Titles are only visible in the "fancy" style of view border. In Applesoft, the view is automatically redrawn to reflect the change. In assembly, you must call WGPaintView manually to see the change.
|
||||
|
||||
|
@ -3,6 +3,7 @@ Known issues
|
||||
------------
|
||||
|
||||
- Hitting Reset during a WeeGUI application will leave your Apple II in an unsafe state
|
||||
- Calling WGEraseView on a view that shares border rendering with other views will require manually redrawing those views.
|
||||
|
||||
|
||||
To Do:
|
||||
|
@ -63,5 +63,7 @@ WGScrollY = 58
|
||||
WGScrollYBy = 60
|
||||
WGEnableMouse = 62
|
||||
WGDisableMouse = 64
|
||||
WGExit = 66
|
||||
WGDeleteView = 66
|
||||
WGEraseView = 68
|
||||
WGExit = 70
|
||||
|
||||
|
26
applesoft.s
26
applesoft.s
@ -901,6 +901,26 @@ WGAmpersand_GETstore:
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGAmpersand_KILL
|
||||
; Deletes the selected view
|
||||
; &KILL
|
||||
WGAmpersand_KILL:
|
||||
jsr WGDeleteView
|
||||
jsr WGBottomCursor
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGAmpersand_WIPE
|
||||
; Erases all of the selected view
|
||||
; &WIPE
|
||||
WGAmpersand_WIPE:
|
||||
jsr WGEraseView
|
||||
jsr WGBottomCursor
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGAmpersand_EXIT
|
||||
; Shuts down WeeGUI
|
||||
@ -1088,6 +1108,12 @@ WGAmpersandCommandTable:
|
||||
.byte TOKEN_GET,0,0,0,0,0
|
||||
.addr WGAmpersand_GET
|
||||
|
||||
.byte "KILL",0,0
|
||||
.addr WGAmpersand_KILL
|
||||
|
||||
.byte "WIPE",0,0
|
||||
.addr WGAmpersand_WIPE
|
||||
|
||||
.byte "EXIT",0,0
|
||||
.addr WGAmpersand_EXIT
|
||||
|
||||
|
103
views.s
103
views.s
@ -232,6 +232,26 @@ WGCreateButton_done:
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGDeleteView
|
||||
; Deletes the current view and removes it from the screen
|
||||
;
|
||||
WGDeleteView:
|
||||
SAVE_AY
|
||||
|
||||
jsr WGEraseView
|
||||
|
||||
LDY_ACTIVEVIEW
|
||||
|
||||
lda #0
|
||||
sta WG_VIEWRECORDS+2,y ; 0 width indicates unused view
|
||||
jsr WGViewPaintAll
|
||||
|
||||
RESTORE_AY
|
||||
rts
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGPaintView
|
||||
; Paints the current view
|
||||
@ -464,6 +484,43 @@ paintWindowTitle_done:
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGEraseView
|
||||
; Erases the current view (including decoration)
|
||||
;
|
||||
WGEraseView:
|
||||
SAVE_AXY
|
||||
SAVE_ZPP
|
||||
|
||||
LDY_ACTIVEVIEW
|
||||
|
||||
lda WG_VIEWRECORDS+0,y
|
||||
dec
|
||||
sta PARAM0
|
||||
|
||||
lda WG_VIEWRECORDS+1,y
|
||||
dec
|
||||
sta PARAM1
|
||||
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
inc
|
||||
inc
|
||||
sta PARAM2
|
||||
|
||||
lda WG_VIEWRECORDS+3,y
|
||||
inc
|
||||
inc
|
||||
sta PARAM3
|
||||
|
||||
ldy #' '+$80
|
||||
jsr WGFillRect
|
||||
|
||||
WGEraseView_done:
|
||||
RESTORE_ZPP
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGEraseViewContents
|
||||
; Erases the contents of the current view (interior contents only)
|
||||
@ -564,12 +621,15 @@ WGViewFocusNext:
|
||||
jsr unfocusCurrent
|
||||
|
||||
WGViewFocusNext_loop:
|
||||
inc WG_FOCUSVIEW ; Increment and wrap
|
||||
lda WG_FOCUSVIEW ; Increment and wrap
|
||||
inc
|
||||
cmp #16
|
||||
beq WGViewFocusNext_wrap
|
||||
sta WG_FOCUSVIEW
|
||||
|
||||
LDY_FOCUSVIEW
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
bne WGViewFocusNext_wantFocus
|
||||
lda #0
|
||||
sta WG_FOCUSVIEW
|
||||
beq WGViewFocusNext_loop
|
||||
|
||||
WGViewFocusNext_wantFocus: ; Does this view accept focus?
|
||||
LDY_FOCUSVIEW
|
||||
@ -584,6 +644,10 @@ WGViewFocusNext_focus:
|
||||
RESTORE_AY
|
||||
rts
|
||||
|
||||
WGViewFocusNext_wrap:
|
||||
stz WG_FOCUSVIEW
|
||||
bra WGViewFocusNext_loop
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGViewFocusPrev
|
||||
@ -596,18 +660,15 @@ WGViewFocusPrev:
|
||||
jsr unfocusCurrent
|
||||
|
||||
WGViewFocusPrev_loop:
|
||||
dec WG_FOCUSVIEW ; Decrement and wrap
|
||||
bpl WGViewFocusPrev_wantFocus
|
||||
ldx WG_FOCUSVIEW ; Decrement and wrap
|
||||
dex
|
||||
bmi WGViewFocusPrev_wrap
|
||||
|
||||
WGViewFocusPrev_hadNone:
|
||||
ldx #$f
|
||||
WGViewFocusPrev_findEndLoop:
|
||||
WGViewFocusPrev_findLoop:
|
||||
stx WG_FOCUSVIEW
|
||||
LDY_FOCUSVIEW
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
bne WGViewFocusPrev_wantFocus
|
||||
dex
|
||||
bra WGViewFocusPrev_findEndLoop
|
||||
beq WGViewFocusPrev_loop
|
||||
|
||||
WGViewFocusPrev_wantFocus: ; Does this view accept focus?
|
||||
LDY_FOCUSVIEW
|
||||
@ -622,6 +683,10 @@ WGViewFocusPrev_focus:
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
WGViewFocusPrev_wrap:
|
||||
ldx #$f
|
||||
bra WGViewFocusPrev_findLoop
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; unfocusCurrent
|
||||
@ -1124,18 +1189,24 @@ WGViewPaintAll:
|
||||
|
||||
WGViewPaintAll_loop:
|
||||
txa
|
||||
jsr WGSelectView
|
||||
sta WG_ACTIVEVIEW
|
||||
|
||||
LDY_ACTIVEVIEW
|
||||
lda WG_VIEWRECORDS+2,y ; Last view?
|
||||
beq WGViewPaintAll_done
|
||||
lda WG_VIEWRECORDS+2,y ; Valid view?
|
||||
beq WGViewPaintAll_next
|
||||
|
||||
jsr WGEraseViewContents
|
||||
jsr WGPaintView
|
||||
|
||||
WGViewPaintAll_next:
|
||||
inx
|
||||
bra WGViewPaintAll_loop
|
||||
cpx #16
|
||||
bne WGViewPaintAll_loop
|
||||
|
||||
WGViewPaintAll_done:
|
||||
lda #-1
|
||||
jsr WGSelectView
|
||||
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
|
BIN
weegui.dsk
BIN
weegui.dsk
Binary file not shown.
Loading…
Reference in New Issue
Block a user