author | Claus Gittinger <cg@exept.de> |
Mon, 03 Feb 2014 11:26:51 +0100 | |
changeset 6212 | 3c308b5defa7 |
parent 4541 | a2ff52d645ea |
child 6884 | a66985ff01e9 |
permissions | -rw-r--r-- |
1284 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
2840 | 3 |
All Rights Reserved |
1284 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
3285 | 12 |
"{ Package: 'stx:libview' }" |
13 |
||
1284 | 14 |
GraphicsDevice subclass:#HostGraphicsDevice |
2840 | 15 |
instanceVariableNames:'deviceColors deviceFonts deviceViews deviceForms deviceCursors' |
1284 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-Graphics' |
|
19 |
! |
|
20 |
||
21 |
!HostGraphicsDevice class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger |
|
2840 | 26 |
All Rights Reserved |
1284 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
||
36 |
||
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
this abstract class was inserted to provide a home for ST-80 classes |
|
42 |
(previously, DeviceWorkstation was directly under Object). |
|
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
43 |
We will (over time) move common functionality from there into this class. |
1284 | 44 |
|
45 |
In ST/X, this is mostly dummy. |
|
46 |
||
47 |
[see also:] |
|
2840 | 48 |
DeviceWorkstation XWorkstation |
1284 | 49 |
|
50 |
[author:] |
|
2840 | 51 |
Claus Gittinger |
1284 | 52 |
" |
53 |
||
54 |
||
55 |
! ! |
|
56 |
||
3880 | 57 |
!HostGraphicsDevice methodsFor:'Compatibility-Squeak'! |
2961 | 58 |
|
59 |
deferUpdates: aBoolean |
|
60 |
"Set the deferUpdates flag in the virtual machine. |
|
61 |
When this flag is true, BitBlt operations on the Display are not |
|
62 |
automatically propagated to the screen. |
|
63 |
If this underlying platform does not support deferred updates, |
|
64 |
this primitive will fail. |
|
65 |
Answer the receiver if the primitive succeeds, nil if it fails." |
|
66 |
||
67 |
"/ <primitive: 126> |
|
68 |
^ nil "answer nil if primitive fails" |
|
69 |
||
70 |
! |
|
71 |
||
72 |
forceDisplayUpdate |
|
73 |
"On platforms that buffer screen updates, |
|
74 |
force the screen to be updated immediately. |
|
75 |
On other platforms, or if the primitive is not implemented, do nothing." |
|
76 |
||
77 |
"/ <primitive: 231> |
|
78 |
"do nothing if primitive fails" |
|
79 |
! ! |
|
80 |
||
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
81 |
!HostGraphicsDevice methodsFor:'accessing'! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
82 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
83 |
deviceColors |
1371 | 84 |
"return the registry keeping track of colors which were allocated |
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
85 |
on this device." |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
86 |
|
6212 | 87 |
^ deviceColors ? #() |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
88 |
|
6212 | 89 |
"Created: / 24-02-1997 / 18:01:41 / cg" |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
90 |
! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
91 |
|
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
92 |
deviceCursors |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
93 |
"return the registry keeping track of cursors which were allocated |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
94 |
on this device." |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
95 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
96 |
^ deviceCursors |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
97 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
98 |
"Created: 24.2.1997 / 18:01:41 / cg" |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
99 |
! |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
100 |
|
1371 | 101 |
deviceFonts |
102 |
"return the registry keeping track of fonts which were allocated |
|
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
103 |
on this device." |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
104 |
|
4541 | 105 |
^ deviceFonts ? #() |
106 |
||
107 |
"Modified: / 28-07-2006 / 19:48:23 / fm" |
|
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
108 |
! |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
109 |
|
2839 | 110 |
deviceForms |
111 |
"return the registry keeping track of forms which were allocated |
|
112 |
on this device." |
|
113 |
||
114 |
^ deviceForms |
|
115 |
! |
|
116 |
||
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
117 |
deviceViews |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
118 |
"return the registry keeping track of views which were allocated |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
119 |
on this device." |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
120 |
|
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
121 |
^ deviceViews |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
122 |
! ! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
123 |
|
3444 | 124 |
!HostGraphicsDevice methodsFor:'accessing & queries'! |
125 |
||
126 |
defaultExtentForTopViews |
|
3447 | 127 |
|w h| |
128 |
||
129 |
w := self width. |
|
130 |
h := self height. |
|
131 |
||
132 |
self isPDA ifTrue:[ |
|
133 |
^ (w - 16) @ (h - 20) |
|
134 |
]. |
|
135 |
^ (w // 3 * 2) @ (h // 3 * 2) |
|
3444 | 136 |
! ! |
137 |
||
3883 | 138 |
!HostGraphicsDevice methodsFor:'initialization & release'! |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
139 |
|
1367 | 140 |
initializeDeviceResourceTables |
2813
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
141 |
deviceViews := Registry new. |
913aca399962
preps to keep the view & form lobbies on a per-display basis.
Claus Gittinger <cg@exept.de>
parents:
2809
diff
changeset
|
142 |
deviceForms := Registry new. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
143 |
deviceColors := Registry new. |
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
144 |
deviceCursors := Registry new. |
2809
96f6b7b449c7
use a CachingRegistry for fonts.
Claus Gittinger <cg@exept.de>
parents:
1371
diff
changeset
|
145 |
deviceFonts := CachingRegistry new cacheSize:10. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
146 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
147 |
"Created: 24.2.1997 / 18:29:53 / cg" |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
148 |
! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
149 |
|
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
150 |
releaseDeviceColors |
2839 | 151 |
deviceColors do:[:aColor | |
2845 | 152 |
aColor releaseFromDevice |
2839 | 153 |
]. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
154 |
deviceColors := Registry new. |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
155 |
|
4222
4fee2e231633
Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents:
3927
diff
changeset
|
156 |
"TrueColors are not registered. |
4fee2e231633
Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents:
3927
diff
changeset
|
157 |
Release the the hard way" |
4fee2e231633
Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents:
3927
diff
changeset
|
158 |
Color flushDeviceColorsFor:self. |
4fee2e231633
Take care to relases the device of TrueColors.
Stefan Vogel <sv@exept.de>
parents:
3927
diff
changeset
|
159 |
|
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
160 |
"Created: 24.2.1997 / 18:07:49 / cg" |
1371 | 161 |
! |
162 |
||
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
163 |
releaseDeviceCursors |
2847 | 164 |
deviceCursors do:[:aCursor | |
2845 | 165 |
aCursor releaseFromDevice |
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
166 |
]. |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
167 |
deviceCursors := Registry new. |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
168 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
169 |
"Created: 24.2.1997 / 18:07:49 / cg" |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
170 |
|
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
171 |
! |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2840
diff
changeset
|
172 |
|
1371 | 173 |
releaseDeviceFonts |
2846 | 174 |
deviceFonts do:[:aFont | |
175 |
aFont releaseFromDevice. |
|
176 |
]. |
|
2809
96f6b7b449c7
use a CachingRegistry for fonts.
Claus Gittinger <cg@exept.de>
parents:
1371
diff
changeset
|
177 |
deviceFonts := CachingRegistry new cacheSize:10. |
1365
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
178 |
! ! |
37a9e7ac4dbc
moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
179 |
|
3285 | 180 |
!HostGraphicsDevice methodsFor:'misc'! |
181 |
||
182 |
recolorCursorsToFgColor:fgColor defaultBgColor:bgColor |
|
183 |
"change the colors of all existing cursors" |
|
184 |
||
185 |
"/ recolor existing cursors |
|
186 |
deviceCursors do:[:eachCursor | eachCursor foreground:fgColor background:bgColor]. |
|
187 |
||
188 |
" |
|
189 |
Display recolorCursorsToFgColor:(Color red) defaultBgColor:(Color white) |
|
190 |
||
191 |
Display recolorCursorsToFgColor:(Color blue) defaultBgColor:(Color white) |
|
192 |
Display recolorCursorsToFgColor:(Color blue) defaultBgColor:(Color black) |
|
193 |
Display recolorCursorsToFgColor:(Color white) defaultBgColor:(Color black) |
|
194 |
Display recolorCursorsToFgColor:(Color white) defaultBgColor:(Color red) |
|
195 |
" |
|
196 |
! ! |
|
197 |
||
2846 | 198 |
!HostGraphicsDevice methodsFor:'registration'! |
199 |
||
200 |
registerColor:aColor |
|
201 |
deviceColors register:aColor. |
|
202 |
||
203 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
204 |
! |
|
205 |
||
206 |
registerCursor:aCursor |
|
207 |
deviceCursors register:aCursor. |
|
208 |
||
209 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
210 |
! |
|
211 |
||
212 |
registerFont:aFont |
|
213 |
deviceFonts register:aFont. |
|
214 |
||
215 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
216 |
! |
|
217 |
||
218 |
registerForm:aForm |
|
219 |
deviceForms register:aForm. |
|
220 |
||
221 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
222 |
! |
|
223 |
||
224 |
registerView:aView |
|
225 |
deviceViews register:aView. |
|
226 |
||
227 |
"Created: 24.2.1997 / 18:29:10 / cg" |
|
228 |
! |
|
229 |
||
230 |
unregisterColor:aColor |
|
231 |
deviceColors unregister:aColor. |
|
232 |
||
233 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
234 |
! |
|
235 |
||
236 |
unregisterCursor:aCursor |
|
237 |
deviceCursors unregister:aCursor. |
|
238 |
||
239 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
240 |
! |
|
241 |
||
242 |
unregisterFont:aFont |
|
243 |
deviceFonts unregister:aFont. |
|
244 |
||
245 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
246 |
! |
|
247 |
||
248 |
unregisterForm:aForm |
|
249 |
deviceForms unregister:aForm. |
|
250 |
||
251 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
252 |
! |
|
253 |
||
254 |
unregisterView:aView |
|
255 |
deviceViews unregister:aView. |
|
256 |
||
257 |
"Created: 24.2.1997 / 18:29:14 / cg" |
|
258 |
! ! |
|
259 |
||
1284 | 260 |
!HostGraphicsDevice class methodsFor:'documentation'! |
261 |
||
262 |
version |
|
6212 | 263 |
^ '$Header: /cvs/stx/stx/libview/HostGraphicsDevice.st,v 1.25 2014-02-03 10:26:51 cg Exp $' |
1284 | 264 |
! ! |
6212 | 265 |