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