chiark / gitweb /
Create readable text `.bas' for each tokenized BASIC `,ffb' file.
[ssr] / StraySrc / Libraries / Sapphire / sh / _tms / tmsGlobal
1 ;
2 ; tmsWS.sh
3 ;
4 ; Internal workspace layout for tearoff menus
5 ;
6 ; © 1994-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's Sapphire library.
12 ;
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
16 ; any later version.
17 ;
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ; GNU General Public License for more details.
22 ;
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire.  If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
27 ;----- Macros ---------------------------------------------------------------
28
29                 MACRO
30 $label          SKIP    $mask,$size,$reg1,$reg2
31 $label          TST     $reg1,#$mask
32                 ADDNE   $reg2,$reg2,#$size
33                 MEND
34
35                 MACRO
36 $label          SKPITEM $reg1,$reg2
37 $label          SKIP    mFlag_shade,4,$reg1,$reg2
38                 SKIP    mFlag_iShade,4,$reg1,$reg2
39                 SKIP    mFlag_switch,4,$reg1,$reg2
40                 SKIP    mFlag_radio,8,$reg1,$reg2
41                 SKIP    mFlag_sprite,8,$reg1,$reg2
42                 SKIP    mFlag_subMenu,8,$reg1,$reg2
43                 MEND
44
45 ;----- Useful values --------------------------------------------------------
46
47 mFlag_tearoff   EQU     (1<<1)                  ;Menu has a tearoff bar
48 mFlag_makeMe    EQU     (1<<2)                  ;Recreate menu on adjust
49 mFlag_maxHeight EQU     (1<<3)                  ;Menu has a maximum height
50 mFlag_global    EQU     (1<<4)                  ;Menu is `global' for app
51
52 mFlag_indirect  EQU     (1<<0)                  ;Item text is indirected
53 mFlag_shortcut  EQU     (1<<1)                  ;Item has a keyboard shortcut
54 mFlag_iShortcut EQU     (1<<2)                  ;Item has an indirected S/C
55 mFlag_shade     EQU     (1<<3)                  ;Item is shadable
56 mFlag_iShade    EQU     (1<<4)                  ;Item is inverse shadable
57 mFlag_switch    EQU     (1<<5)                  ;Item is a switch
58 mFlag_radio     EQU     (1<<6)                  ;Item is a radio item
59 mFlag_sprite    EQU     (1<<7)                  ;Menu item has a sprite
60 mFlag_halfSize  EQU     (1<<8)                  ;Sprite is halfsize
61 mFlag_subWarn   EQU     (1<<9)                  ;Warn client if submenu warn
62 mFlag_subMenu   EQU     (1<<10)                 ;Item has menu to be opened
63
64 mFlag_R12       EQU     (1<<16)                 ;Use R12 for runtime data
65 mFlag_noWarn    EQU     (1<<17)                 ;Don't warn on shaded items
66 mFlag_ruleOff   EQU     (1<<18)                 ;Put a ruleoff after item
67
68 mFlag_end       EQU     (1<<31)                 ;No more items
69
70 ; --- Event types ---
71
72 mEvent_select   EQU     0                       ;Normal menu selection
73                                                 ;  R1 == index of item
74 mEvent_arrow    EQU     1                       ;Sub menu warning
75                                                 ;  R1 == index of item
76 mEvent_deleted  EQU     2                       ;Menu has been deleted
77 mEvent_help     EQU     3                       ;Menu help requested
78                                                 ;  R1 == ndex of item
79                                                 ;  R2 == ptr to packed itmdef
80
81 ;----- The TWIN global area -------------------------------------------------
82
83                 ^       0
84 twin_flags      #       4                       ;Various useful flags
85 twin_trans      #       4                       ;The current transient window
86 twin_tmsHook    #       4                       ;A hook to the TMS system
87 twin_size       #       0                       ;The size of the global area
88
89 twinFlag_recrt  EQU     (1<<0)                  ;Menu will be recreated
90
91 ;----- Workspace ------------------------------------------------------------
92
93 ; --- Header definition for each menu ---
94
95                 ^       0
96 hText           #       4                       ;Pointer to the text string
97 hMaxHeight      #       4                       ;The maximum height of menu
98 hHandler        #       4                       ;The handler to call
99 hR10            #       4                       ;The R10 value to use
100 hR12            #       4                       ;The R12 value to use
101 hDefinition     #       4                       ;Pointer to packed definition
102 hFlags          #       4                       ;The flags for the menu
103 hHandle         #       4                       ;The window handle of menu
104 hPrevMenu       #       4                       ;Pointer to the previous menu
105 hSprWidth       #       4                       ;The width of widest sprite
106 hTextWidth      #       4                       ;The width of the menu
107 hKeyWidth       #       4                       ;Width of longest keystring
108 hTitleWidth     #       4                       ;Width of the title
109 hTotWidth       #       4                       ;The total width
110 hHeight         #       4                       ;The height of the menu
111 hSelected       #       4                       ;The currently selected item
112 hSubMenu        #       0                       ;Pointer to current submenu
113 hDbox           #       4                       ;Ooooo... a union
114 hNextTorn       #       4                       ;Pointer to the next torn off
115 hFromItem       #       4                       ;The item menu was from
116 hItems          #       4                       ;Pointer to the items
117
118 hSize           #       0                       ;Size of the header defn
119
120 ; --- Header flags ---
121
122 hFlag__tearable EQU     (1<<0)                  ;The menu is tearable
123 hFlag__torn     EQU     (1<<1)                  ;The menu has been torn off
124 hFlag__folded   EQU     (1<<2)                  ;The menu has been folded
125 hFlag__scrBar   EQU     (1<<3)                  ;The menu has a scrollbar
126 hFlag__warned   EQU     (1<<4)                  ;Client's been warned submenu
127 hFlag__tIndir   EQU     (1<<5)                  ;Title data is indirected
128 hFlag__global   EQU     (1<<6)                  ;Menu is `global' for app
129
130 hFlag__dbox     EQU     (1<<15)                 ;There is a dbox
131
132 ; --- The item definition ---
133
134                 ^       0
135 iNumber         #       4                       ;The number of items in group
136 iDefinition     #       4                       ;Pointer to the icon defn
137 iHandler        #       4                       ;Pointer to the event handler
138 iR10            #       4                       ;R10 value to use
139 iR12            #       4                       ;R12 value to use
140 iItems          #       4                       ;Pointer to next grp of items
141 iHdrSize        #       0                       ;Size of this structure
142
143                 ^       0
144 iText           #       4                       ;Pointer to the text string
145 iKeyCode        #       4                       ;Code of keyboard shortcut
146 iFlags          #       4                       ;The item flags
147 iyCoord         #       4                       ;The y coordinate of the item
148 iSubMenu        #       0                       ;Menu handle of sub menu
149 iDbox           #       4                       ;Exciting isn't it!
150 iSprName        #       4                       ;Pointer to sprite name
151 iSprArea        #       4                       ;And its sprite area
152 iSprCsum        #       4                       ;Checksum of sprite name
153 iItemSize       #       0                       ;Size of this structure
154
155 ; --- Item flags ---
156
157 iFlag__shaded   EQU     (1<<0)                  ;The item is shaded
158 iFlag__ticked   EQU     (1<<1)                  ;The item is ticked
159 iFlag__radio    EQU     (1<<2)                  ;The item is splodged
160 iFlag__dotted   EQU     (1<<3)                  ;The item is folled by a line
161 iFlag__arrow    EQU     (1<<4)                  ;The item has an arrow
162 iFlag__sprite   EQU     (1<<5)                  ;The item has a sprite
163 iFlag__halfSize EQU     (1<<6)                  ;Display sprite at half size
164 iFlag__noWarn   EQU     (1<<7)                  ;Don't warn on shaded items
165
166 iFlag__dbox     EQU     (1<<15)                 ;Item has a dialogue box
167
168 iFlag__newTick  EQU     (1<<27)                 ;Need to redraw ticks etc.
169 iFlag__newSpr   EQU     (1<<28)                 ;Need to redraw sprite
170 iFlag__newText  EQU     (1<<29)                 ;Text of item has changed
171 iFlag__newKey   EQU     (1<<30)                 ;Key string has changed
172 iFlag__newArrow EQU     (1<<31)                 ;Need to redraw arrow thingy
173
174 ; --- Miscellaneous values ---
175
176 tms__barHeight  EQU     24                      ;The height of tearoff bar
177
178 ; --- Program workspace ---
179
180                 ^       0,R12
181 tms__wStart     #       0
182
183 tms__flags      #       4                       ;The flags word
184
185 tms__twin       #       4                       ;Address of the TWIN area
186
187 tms__zInit      #       0                       ;Zero-inited part of wspace
188
189 tms__current    #       4                       ;The current transient menu
190 tms__tornoffs   #       4                       ;Pointer to list of torn offs
191 tms__prevLevel  #       4                       ;Previous menu to opened from
192 tms__orgTearoff #       4                       ;The originating tearoff
193 tms__itemOver   #       4                       ;Ptr into packed defn to item
194 tms__itemBlock  #       4                       ;Ptr to item block of item
195 tms__currItem   #       4                       ;Ptr to the current item
196 tms__currDbox   #       4                       ;The current dbox handle
197 tms__dboxPrev   #       4                       ;Menu that dbox came from
198
199 tms__creating   #       4                       ;Ptr to header of new menu
200 tms__lastItems  #       4                       ;Ptr to last item blk created
201 tms__recreating #       4                       ;Ptr to menu being recreated
202
203 tms__coords     #       8                       ;(x,y) for menu
204 tms__oldHandle  #       4                       ;Hnd passed to idle claimer
205 tms__itemIndex  #       4                       ;Index into defn of item
206 tms__alarmMenu  #       4                       ;Menu alarm is for
207 tms__alarmItem  #       4                       ;Item alarm is for
208
209 tms__zSize      EQU     {VAR}-tms__zInit        ;Size of zero-inited bit
210
211 tms__fHandle    #       4                       ;The current wimp font handle
212 tms__R11        #       4                       ;Address of the scratchpad
213
214 tms__wSize      EQU     {VAR}-tms__wStart
215
216 ; --- Program flags ---
217
218 tFlag__inited   EQU     (1<<0)                  ;We are initialised
219 tFlag__iBar     EQU     (1<<1)                  ;The click was on icon bar
220 tFlag__riscos3  EQU     (1<<2)                  ;We are on RISC OS 3
221 tFlag__overArrow EQU    (1<<3)                  ;We are over RHS of a menu
222 tFlag__close    EQU     (1<<4)                  ;Close the transient
223 tFlag__newFont  EQU     (1<<5)                  ;There has been a font change
224 tFlag__nActive  EQU     (1<<6)                  ;Menus are not active
225 tFlag__subWait  EQU     (1<<7)                  ;We're waiting for a submenu
226 tFlag__doFake   EQU     (1<<8)                  ;Fake a NULL event
227 tFlag__faking   EQU     (1<<9)                  ;We are faking a NULL event
228
229 ;----- That's all, folks ----------------------------------------------------
230
231                 END