Initial revision
[ssr] / StraySrc / Libraries / Steel / s / wimpExt
1 ;
2 ; WimpExt.s
3 ;
4 ; WimpExtension I interface
5 ;
6 ; © 1993-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's Steel library.
12 ;
13 ; Steel 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 ; Steel 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 Steel. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
27 ;----- Notes ----------------------------------------------------------------
28 ;
29 ; Not all of the calls are done yet (understatement of the year!). I won't
30 ; bother with all of them until WimpExtension II is done. It just isn't
31 ; worth the bother, because most of the others are doable using standard
32 ; RISC_OSlib or Steel features anyway.
33 ;
34 ; Straylight
35 ;
36
37 ;----- SWI names and numbers ------------------------------------------------
38
39 XWimpExt_Initialise EQU &65780
40 XWimpExt_CloseDown EQU &65781
41 XWimpExt_SlabIcon EQU &65782
42 XWimpExt_Redraw EQU &65783
43 XWimpExt_Action EQU &65784
44 XWimpExt_IconBarSprite EQU &65785
45 XWimpExt_IconBarText EQU &65786
46 XWimpExt_LinkWindows EQU &65787
47 XWimpExt_OpenLinked EQU &65788
48 XWimpExt_CloseLinked EQU &65789
49 XWimpExt_UnLinkWindows EQU &6578A
50 XWimpExt_CurrentTask EQU &6578B
51 XWimpExt_LoadTemplates EQU &6578C
52 XWimpExt_SetIconString EQU &6578D
53 XWimpExt_OpenWindowTop EQU &6578E
54 XWimpExt_SetIcon EQU &6578F
55 XWimpExt_GetIcon EQU &65790
56 XWimpExt_GetNumberIcon EQU &65791
57 XWimpExt_SetNumberIcon EQU &65792
58 XWimpExt_IncNumberIcon EQU &65793
59 XWimpExt_DecNumberIcon EQU &65794
60 XWimpExt_SetPointer EQU &65795
61 XWimpExt_Divide EQU &65796
62 XWimpExt_ColoursMenu EQU &65797
63 XWimpExt_AutoRedraw EQU &65798
64 XWimpExt_CentreWindow EQU &65799
65 XWimpExt_DragIcon EQU &6579A
66 XWimpExt_PutCaretIcon EQU &6579B
67 XWimpExt_OpenDialogue EQU &6579C
68 XWimpExt_CheckWindowOpen EQU &6579D
69 XWimpExt_CopyString EQU &6579E
70 XWimpExt_SetWindowTitle EQU &6579F
71 XWimpExt_SetIconStringN EQU &657A0
72 XWimpExt_FindLeaf EQU &657A1
73 XWimpExt_LimitPointer EQU &657A2
74 XWimpExt_ReleasePointer EQU &657A3
75 XWimpExt_OpenFullSize EQU &657A4
76 XWimpExt_LoadRAMTemplate EQU &657A5
77 XWimpExt_OpenRequester EQU &657A6
78 XWimpExt_CloseRequester EQU &657A7
79 XWimpExt_HideLink EQU &657A8
80 XWimpExt_UnHideLink EQU &657A9
81 XWimpExt_SendHelp EQU &657AA
82 XWimpExt_SendWimpHelp EQU &657AB
83 XWimpExt_CreateMenu EQU &657AC
84 XWimpExt_ReCreateMenu EQU &657AD
85 XWimpExt_ShadeEntry EQU &657AE
86 XWimpExt_TickEntry EQU &657AF
87 XWimpExt_SetIconColour EQU &657B0
88 XWimpExt_ShadeIcon EQU &657B1
89 XWimpExt_PlotSprite EQU &657B2
90 XWimpExt_RedrawDraw EQU &657B3
91 XWimpExt_PrePoll EQU &657B4
92 XWimpExt_SetExtent EQU &657B5
93 XWimpExt_MoveCaret EQU &657B6
94 XWimpExt_GetFontMenu EQU &657B7
95 XWimpExt_DecodeFontMenu EQU &657B8
96 XWimpExt_ControlImmediate EQU &657B9
97 XWimpExt_Heap EQU &657BA
98 XWimpExt_MemCopy EQU &657BB
99 XWimpExt_DataSave EQU &657BC
100 XWimpExt_PlotBorder EQU &657BD
101 XWimpExt_CentreWindowV EQU &657BE
102 XWimpExt_Sort EQU &66380
103 XWimpExt_MemMove EQU &66381
104 XWimpExt_MenuWidth EQU &66382
105 XWimpExt_DataLoad EQU &66383
106 XWimpExt_MoveCaretIcon EQU &66384
107 XWimpExt_DrawOp EQU &66385
108 XWimpExt_SpriteOp EQU &66386
109 XWimpExt_Intersect EQU &66387
110 XWimpExt_BorderOp EQU &66388
111 XWimpExt_ManualLink EQU &66389
112 XWimpExt_MiscOp EQU &6638A
113 XWimpExt_ViewIcon EQU &6638B
114 XWimpExt_SubstituteArgs EQU &6638C
115 XWimpExt_CreateDraw EQU &6638D
116 XWimpExt_RedirectSprites EQU &6638E
117
118 ;----- External dependencies ------------------------------------------------
119
120 IMPORT |x$stack_overflow|
121 IMPORT wimpt_task
122 IMPORT atexit
123
124 ;----- Constants and macros -------------------------------------------------
125
126 wimpExt__ver EQU 16 ;WimpExt version for Steel
127
128 ;----- Main code ------------------------------------------------------------
129
130 AREA |C$$Code|,CODE,READONLY
131
132 EXPORT wimpExt_initialise
133
134 wimpExt_initialise
135 MOV ip,sp
136 STMFD sp!,{v1,fp,ip,lr,pc}
137 SUB fp,ip,#4
138 CMP sp,sl
139 BLLT |x$stack_overflow|
140 MOV v1,a1 ;Keep hold of flags word
141 BL wimpt_task ;Get the task handle
142 MOV R2,v1 ;Get features word back
143 MOV R1,a1 ;Get task handle again
144 MOV R0,#wimpExt__ver ;Latest version I know of
145 SWI XWimpExt_Initialise ;Initialise the module
146 LDMVSDB fp,{v1,fp,sp,pc}^ ;If there's an error, leave
147 ADR a1,wimpExt_quit ;Point to closedown routine
148 BL atexit ;Shut down the module nicely
149 MOV a1,#0 ;The SWI worked -- no error
150 LDMDB fp,{v1,fp,sp,pc}^ ;Return to sender...
151
152 wimpExt_quit MOV ip,sp
153 STMFD sp!,{fp,ip,lr,pc}
154 SUB fp,ip,#4
155 CMP sp,sl
156 BLLT |x$stack_overflow|
157 BL wimpt_task ;Get the task handle
158 SWI XWimpExt_CloseDown ;Inform WimpExt we're dead
159 MOVVC R0,#0 ;If no error, return NULL
160 LDMDB fp,{v1,fp,sp,pc}^ ;Return to sender...
161
162 EXPORT wimpExt_slabIcon
163
164 wimpExt_slabIcon
165 STMFD sp!,{v1} ;We're going to corrupt this
166 MOV R4,a3 ;To slab or not to slab...
167 MOV R3,a2 ;Icon to slab or unslab
168 MOV R2,a1 ;Window handle of icon
169 SWI XWimpExt_SlabIcon ;Do the job
170 MOVVC a1,#0 ;If no error, return NULL
171 LDMFD sp!,{v1}
172 MOVS pc,lr
173
174 EXPORT wimpExt_redraw
175
176 wimpExt_redraw
177 MOV R1,a1 ;Point to redraw block
178 SWI XWimpExt_Redraw ;Redraw the icons
179 MOVVC a1,#0 ;If no error, return NULL
180 MOVS pc,lr
181
182 EXPORT wimpExt_action
183
184 wimpExt_action
185 MOV ip,sp
186 STMFD sp!,{v1,fp,ip,lr,pc}
187 SUB fp,ip,#4
188 CMP sp,sl
189 BLLT |x$stack_overflow|
190 MOV v1,a1 ;Remember wimp_eventstr ptr
191 BL wimpt_task ;Get my task handle
192 LDR R2,[v1] ;Get the reason code out
193 ADD R1,v1,#4 ;Point to main block
194 SWI XWimpExt_Action ;Do the job
195 LDMVSDB fp,{v1,fp,sp,pc}^ ;Quit now if it failed
196 STR R0,[v1] ;Store (altered) reason code
197 MOV a1,#0 ;SWI was successful
198 LDMDB fp,{v1,fp,sp,pc}^ ;Return to caller
199
200 EXPORT wimpExt_iconBarSprite
201
202 wimpExt_iconBarSprite
203