author | Claus Gittinger <cg@exept.de> |
Tue, 27 Feb 1996 02:09:35 +0100 | |
changeset 465 | 731d2d077883 |
parent 439 | 9948e62438f1 |
child 473 | e954ce348a47 |
permissions | -rw-r--r-- |
0 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
71 | 3 |
All Rights Reserved |
0 | 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 |
" |
|
12 |
||
13 |
Object subclass:#DeviceWorkstation |
|
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
14 |
instanceVariableNames:'displayId visualType monitorType depth ncells bitsPerRGB bitsRed |
310 | 15 |
bitsGreen bitsBlue redMask greenMask blueMask redShift greenShift |
16 |
blueShift hasColors hasGreyscales width height widthMM heightMM |
|
17 |
resolutionHor resolutionVer idToViewMapping knownViews knownIds |
|
18 |
knownBitmaps knownBitmapIds dispatching dispatchProcess ctrlDown |
|
19 |
shiftDown metaDown altDown motionEventCompression lastId lastView |
|
20 |
keyboardMap rootView isSlow activeKeyboardGrab activePointerGrab |
|
21 |
buttonTranslation multiClickTimeDelta altModifiers metaModifiers |
|
22 |
ctrlModifiers shiftModifiers' |
|
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
23 |
classVariableNames:'ButtonTranslation MultiClickTimeDelta DeviceErrorSignal |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
24 |
ErrorPrinting DefaultScreen AllScreens ExitOnLastClose' |
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
25 |
poolDictionaries:'' |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
26 |
category:'Interface-Graphics' |
0 | 27 |
! |
28 |
||
46 | 29 |
!DeviceWorkstation class methodsFor:'documentation'! |
30 |
||
31 |
copyright |
|
32 |
" |
|
0 | 33 |
COPYRIGHT (c) 1993 by Claus Gittinger |
71 | 34 |
All Rights Reserved |
0 | 35 |
|
46 | 36 |
This software is furnished under a license and may be used |
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
0 | 44 |
|
45 |
documentation |
|
46 |
" |
|
38 | 47 |
this abstract class defines common protocol to all Display types. |
151 | 48 |
For compatibility with ST-80, this class (or a subclass) is also |
49 |
bound to the global Screen. |
|
50 |
||
0 | 51 |
|
38 | 52 |
instance variables: |
0 | 53 |
|
134 | 54 |
displayId <Number> the device id of the display |
55 |
visualType <Symbol> one of #StaticGray, #PseudoColor, ... #TrueColor |
|
56 |
monitorType <Symbol> one of #monochrome, #color, #unknown |
|
57 |
||
193 | 58 |
depth <SmallInteger> bits per color |
59 |
ncells <SmallInteger> number of colors (i.e. colormap size; not always == 2^depth) |
|
60 |
bitsPerRGB <SmallInteger> number of valid bits per rgb component |
|
134 | 61 |
(actual number taken in A/D converter; not all devices report the true value) |
193 | 62 |
bitsRed <SmallInteger> number of red bits (only valid for TrueColor displays) |
63 |
bitsGreen <SmallInteger> number of green bits (only valid for TrueColor displays) |
|
64 |
bitsBlue <SmallInteger> number of blue bits (only valid for TrueColor displays) |
|
65 |
redMask <SmallInteger> shifted red mask (only useful for TrueColor displays) |
|
66 |
greenMask <SmallInteger> shifted green mask (only useful for TrueColor displays) |
|
67 |
blueMask <SmallInteger> shifted blue mask (only useful for TrueColor displays) |
|
68 |
shiftRed <SmallInteger> number of bits to shift red bits (only valid for TrueColor displays) |
|
69 |
shiftGreen <SmallInteger> number of bits to shift green bits (only valid for TrueColor displays) |
|
70 |
shiftBlue <SmallInteger> number of bits to shift blue bits (only valid for TrueColor displays) |
|
71 |
||
134 | 72 |
hasColors <Boolean> true, if display supports colors |
73 |
hasGreyscales <Boolean> true, if display supports grey-scales (i.e is not b/w display) |
|
193 | 74 |
width <SmallInteger> number of horizontal pixels |
75 |
height <SmallInteger> number of vertical pixels |
|
134 | 76 |
heightMM <Number> screen height in millimeter |
77 |
widthMM <Number> screen width in millimeter |
|
78 |
resolutionHor <Number> pixels per horizontal millimeter |
|
79 |
resolutionVer <Number> pixels per vertical millimeter |
|
80 |
||
81 |
idToViewMapping <Dictionary> maps view-ids to views |
|
82 |
knownViews <Collection> all views known |
|
83 |
knownIds <Collection> corresponding device-view ids |
|
84 |
knownBitmaps <Collection> all known device bitmaps |
|
85 |
knownBitmapIds <Collection> corresponding device-bitmap ids |
|
86 |
||
87 |
dispatching <Boolean> true, if currently in dispatch loop |
|
88 |
||
151 | 89 |
ctrlDown <Boolean> true, if control key currently pressed |
134 | 90 |
shiftDown <Boolean> true, if shift key currently pressed |
91 |
metaDown <Boolean> true, if meta key (cmd-key) is currently pressed |
|
92 |
altDown <Boolean> true, if alt key is currently pressed |
|
93 |
||
94 |
motionEventCompression |
|
95 |
<Boolean> if true motion events are compressed |
|
96 |
(obsolete: now done in sensor) |
|
97 |
||
98 |
lastId <Number> the id of the last events view (internal) |
|
99 |
lastView <View> the last events view (internal, for faster id->view mapping) |
|
100 |
||
101 |
keyboardMap <KeyBdMap> mapping for keys |
|
102 |
rootView <DisplayRootView> this displays root window |
|
103 |
isSlow <Boolean> set/cleared from startup - used to turn off |
|
104 |
things like popup-shadows etc. |
|
0 | 105 |
" |
151 | 106 |
! |
107 |
||
293 | 108 |
events |
109 |
" |
|
110 |
All events are processed in a workstations dispatchEvent method. |
|
111 |
There, incoming events are first sent to itself, for a first (view independent) |
|
112 |
preprocessing. For example, the devices state of the shift-, alt-, control and |
|
113 |
meta keys are updated there. After that, the event is forwarded either to |
|
114 |
the views sensor or to the view directly (if it has no sensor). |
|
115 |
(Sensorless views are a leftover from ancient times and will sooner or |
|
116 |
later vanish - simplifying things a bit. Do not depend on views without |
|
117 |
sensors to work correctly in future versions.) |
|
118 |
||
119 |
This event processing is done by the event dispatcher process, which is |
|
120 |
launched in ST/X's startup sequence (see Smalltalk>>start). |
|
121 |
Event processing is done at a high priority, to allow keyboad processing |
|
122 |
and CTRL-C handling to be performed even while other processes are running. |
|
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
123 |
The code executed by the event process is found in startDispatch. |
293 | 124 |
|
125 |
Individual events can be enabled or disabled. The ones that are enabled |
|
126 |
by default are: |
|
127 |
keypress / keyRelease |
|
128 |
buttonPress / buttonRelease / buttonMotion (i.e. motion with button pressed) |
|
129 |
pointerEnter / pointerLeave |
|
130 |
||
131 |
other events have to be enabled by sending a corresponding #enableXXXEvent |
|
132 |
message to the view which shall receive those events. |
|
133 |
For example, pointerMotion events (i.e. motion without button being pressed) |
|
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
134 |
are enabled by: 'aView enableMotionEvent' |
293 | 135 |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
136 |
The above is only of interest, if you write your own widget classes, |
293 | 137 |
existing widgets set things as required in their #initEvents method. |
138 |
" |
|
139 |
! |
|
140 |
||
151 | 141 |
workstationDevices |
142 |
" |
|
143 |
In ST/X, all interaction with the graphics device is done through |
|
144 |
an instance of (a subclass) of DeviceWorkstation. |
|
145 |
Every view has a reference to the device it has been created on in |
|
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
146 |
its 'device' instance variable. |
151 | 147 |
|
148 |
One particular device instance is bound to the global variable Display: |
|
149 |
this is the default graphics display, on which new views are created |
|
150 |
(however, provisions exist for multi-display operation) |
|
151 |
||
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
152 |
Currently, there is are only two concrete display classes (released to the public): |
151 | 153 |
|
154 |
XWorkstation - a plain X window interface |
|
155 |
||
156 |
GLXWorkstation - an X window interface with a GL (3D graphic library) |
|
157 |
extension; either simulated (VGL) or a real GL |
|
158 |
(real GL is only available on SGI machines) |
|
159 |
||
160 |
An experimental version for a NeXTStep interface exists, but is currently |
|
161 |
no longer maintained and not released. |
|
162 |
Also, interfaces for other graphic systems (i.e. OS/2 and Windows) are |
|
163 |
planned for and will be available (hopefully) in late 95. |
|
164 |
||
165 |
DeviceWorkstation itself is an abstract class; the methods as defined |
|
166 |
here perform things which are common to all graphic devices or block |
|
167 |
methods and raise a subclassResponsibilty error condition. |
|
168 |
To create a new graphic interface, at least the subclassResponsibilty-methods |
|
169 |
have to be reimplemented in a concrete subclass. |
|
170 |
||
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
171 |
ST/X is designed to allow the use of multiple workstation devices in parallel, if |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
172 |
the underlying window system supports this. |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
173 |
For example, in X, it is possible to create another instance of XWorkstation, |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
174 |
start a dispatch process for it, and to create and open views on this display. |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
175 |
This does not work with other devices (i.e. Windows). |
151 | 176 |
|
177 |
If you want to experiment with multi-display applications, |
|
178 |
you have to: |
|
179 |
||
180 |
- create a new instance of XWorkstation: |
|
181 |
||
182 |
Smalltalk at:#Display2 put:(XWorkstation new). |
|
183 |
||
405 | 184 |
|
151 | 185 |
- have it connect to the display (i.e. the xServer): |
186 |
(replace 'porty' below with the name of your display) |
|
187 |
||
188 |
Display2 := Display2 initializeFor:'porty:0.0' |
|
189 |
||
190 |
returns nil, if connection is refused |
|
191 |
- leaving you with Display2==nil in this case. |
|
192 |
||
405 | 193 |
|
151 | 194 |
- start an event dispatcher process for it: |
405 | 195 |
(this is now no longer needed - the first opened view will do it for you) |
151 | 196 |
|
197 |
Display2 startDispatch |
|
198 |
||
405 | 199 |
|
151 | 200 |
- optionally set its keyboard map |
201 |
(since this is usually done for Display in the startup-file, |
|
202 |
the new display does not have all your added key bindings) |
|
203 |
||
204 |
Display2 keyboardMap:(Display keyboardMap) |
|
205 |
||
405 | 206 |
|
151 | 207 |
- create a view for it: |
208 |
||
209 |
(FileBrowser onDevice:Display2) open |
|
210 |
||
211 |
(Workspace onDevice:Display2) open |
|
212 |
||
213 |
(Launcher onDevice:Display2) open |
|
214 |
||
215 |
NewLauncher openOnDevice:Display2 |
|
216 |
--> does not work, since ApplicationModel is not prepared |
|
217 |
to open views on other devices. (and may never be, since |
|
218 |
it was written for ST-80 compatibility, which seems not to |
|
219 |
support this.) |
|
220 |
To do the above, try: |
|
221 |
||
222 |
Smalltalk at:#OldDisplay put:Display. |
|
223 |
Display := Display2. |
|
224 |
NewLauncher open. |
|
225 |
Display := OldDisplay. |
|
226 |
||
227 |
Consider this is an ugly kludge ... |
|
228 |
||
229 |
However, as mentioned above, there are a few places, where the default |
|
230 |
display 'Display' is still hard-coded. But, beside from this (little bug ;-), |
|
231 |
remote display operation works pretty well. If you write your application to |
|
232 |
work around those (to-be-fixed) bugs, multi-display applications are |
|
233 |
even possible in the current release. (avoid popUps and use simple buttons |
|
234 |
only). |
|
235 |
||
236 |
Things are being changed to introduce the concept of a 'current' display, |
|
237 |
which is the device on which the current windowGroup has its topView. |
|
238 |
All places in the system whit explicit accesses to Display will be changed |
|
239 |
to use 'Screen current' instead. Especially, this will create popups and |
|
240 |
modalBoxes on the display of the active windowGroup. |
|
241 |
||
242 |
There is no easy solution for things like Notifiers, WarnBoxes or |
|
243 |
Debuggers when opened from some background or non-view process. |
|
244 |
These will come up one the default Display, as returned by 'Screen default'. |
|
245 |
||
246 |
Late note: the above has been mostly fixed, multidisplay applications |
|
247 |
work pretty well. However, there are still some problems to be expected, |
|
248 |
if the screens have different display capabilities (b&w vs. greyscale vs. |
|
249 |
color display). The current styleSheet approach keeps default values |
|
250 |
only once (it should do so per display ...) For now, expect ugly looking |
|
251 |
views in this case - or set your styleSheet for the smallest common |
|
252 |
capabilities (i.e. for b&w). |
|
253 |
" |
|
0 | 254 |
! ! |
255 |
||
256 |
!DeviceWorkstation class methodsFor:'initialization'! |
|
257 |
||
2 | 258 |
initialize |
259 |
DeviceErrorSignal isNil ifTrue:[ |
|
71 | 260 |
DeviceErrorSignal := (Signal new) mayProceed:true. |
261 |
DeviceErrorSignal notifierString:'device error'. |
|
2 | 262 |
]. |
218
10072d9beba5
can now turn off Xlib error messages from the errorHandler
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
263 |
ErrorPrinting := true. |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
264 |
ExitOnLastClose := false. |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
265 |
|
134 | 266 |
self initializeConstants. |
2 | 267 |
! |
268 |
||
0 | 269 |
initializeConstants |
270 |
"initialize some (soft) constants" |
|
271 |
||
51 | 272 |
MultiClickTimeDelta := 300. "a click within 300ms is considered a double one" |
0 | 273 |
ButtonTranslation := #(1 2 3) "identity translation" |
274 |
! ! |
|
275 |
||
144 | 276 |
!DeviceWorkstation class methodsFor:'Signal constants'! |
2 | 277 |
|
278 |
deviceErrorSignal |
|
279 |
"return the signal used for device error reporting" |
|
280 |
||
281 |
^ DeviceErrorSignal |
|
282 |
! ! |
|
283 |
||
0 | 284 |
!DeviceWorkstation class methodsFor:'accessing'! |
285 |
||
286 |
buttonTranslation:anArray |
|
287 |
"set the button translation, #(1 2 3) is no-translation, |
|
288 |
#(3 2 1) is ok for left-handers" |
|
289 |
||
75 | 290 |
ButtonTranslation := anArray. |
291 |
Display notNil ifTrue:[ |
|
292 |
Display buttonTranslation:anArray |
|
293 |
]. |
|
0 | 294 |
! ! |
295 |
||
293 | 296 |
!DeviceWorkstation class methodsFor:'error handling'! |
297 |
||
298 |
errorInterrupt:errID with:aParameter |
|
299 |
"DisplayError interrupt. |
|
300 |
This is invoked via |
|
301 |
XError->errorInterrupt:#DisplayError->registeredErrorInterruptHandlers |
|
302 |
||
303 |
looks if a signal handler for DeviceErrorSignal is present, |
|
304 |
and - if so raises the signal. If the signal not handled, simply output a |
|
305 |
message and continue. |
|
306 |
This allows for non disrupted error reporting OR to catch and |
|
307 |
investigate errors as required." |
|
308 |
||
309 |
|badId badResource msg| |
|
310 |
||
311 |
badId := self resourceIdOfLastError. |
|
312 |
badId ~~ 0 ifTrue:[ |
|
313 |
badResource := self resourceOfId:badId. |
|
314 |
]. |
|
315 |
msg := 'Display error: ' , (self lastErrorString). |
|
316 |
||
317 |
DeviceErrorSignal isHandled ifFalse:[ |
|
318 |
ErrorPrinting ifTrue:[msg errorPrintNL]. |
|
319 |
^ self |
|
320 |
]. |
|
321 |
||
322 |
^ DeviceErrorSignal |
|
323 |
raiseRequestWith:badResource |
|
324 |
errorString:msg |
|
325 |
! |
|
326 |
||
327 |
errorPrinting |
|
328 |
ErrorPrinting isNil ifTrue:[^ false]. |
|
329 |
^ ErrorPrinting |
|
330 |
! |
|
331 |
||
332 |
errorPrinting:aBoolean |
|
333 |
ErrorPrinting := aBoolean |
|
334 |
! |
|
335 |
||
336 |
lastErrorString |
|
337 |
"return a string describing the last error" |
|
338 |
||
339 |
^ self subclassResponsibility |
|
340 |
! |
|
341 |
||
342 |
resourceIdOfLastError |
|
343 |
"return the resource id responsible for the last error" |
|
344 |
||
345 |
^ self subclassResponsibility |
|
346 |
! |
|
347 |
||
348 |
resourceOfId:id |
|
349 |
"search thru all device stuff for a resource. |
|
350 |
Needed for error handling" |
|
351 |
||
352 |
Form allInstances do:[:f | |
|
353 |
f id == id ifTrue:[^ f] |
|
354 |
]. |
|
355 |
||
356 |
self allInstances do:[:aDisplay | |
|
357 |
aDisplay allViewsDo:[:aView | |
|
358 |
aView id == id ifTrue:[^ aView]. |
|
359 |
aView gcId == id ifTrue:[^ aView] |
|
360 |
]. |
|
361 |
||
362 |
"/ |views| |
|
363 |
"/ views := aDisplay knownViews. |
|
364 |
"/ views notNil ifTrue:[ |
|
365 |
"/ views do:[:v | |
|
366 |
"/ v id == id ifTrue:[^ v]. |
|
367 |
"/ v gcId == id ifTrue:[^ v] |
|
368 |
"/ ]. |
|
369 |
"/ ]. |
|
370 |
]. |
|
371 |
||
372 |
Color allInstances do:[:c | |
|
373 |
c colorId == id ifTrue:[^ c] |
|
374 |
]. |
|
375 |
||
376 |
Font allInstances do:[:f | |
|
377 |
f fontId == id ifTrue:[^ f] |
|
378 |
]. |
|
379 |
^ nil |
|
380 |
! ! |
|
381 |
||
382 |
!DeviceWorkstation class methodsFor:'queries'! |
|
383 |
||
384 |
allScreens |
|
385 |
"EXPERIMENTAL: return a collection of active display devices. |
|
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
386 |
Typically, there is only one: Display or Screen current." |
293 | 387 |
|
388 |
^ AllScreens |
|
389 |
||
390 |
" |
|
391 |
Screen allScreens |
|
392 |
" |
|
393 |
||
394 |
"Modified: 1.9.1995 / 13:38:35 / claus" |
|
395 |
! |
|
396 |
||
397 |
current |
|
398 |
"EXPERIMENTAL: this should return the currently active screen, |
|
399 |
that is, the device of the currently executing windowGroup. |
|
400 |
It will be used in multi-display operation, to launch views on |
|
401 |
the correct device - even if not specified explicitely. |
|
402 |
This does not yet work fully satisfying ..." |
|
403 |
||
404 |
|wg tops v dev| |
|
405 |
||
347 | 406 |
AllScreens isNil ifTrue:[ |
407 |
^ Display |
|
408 |
]. |
|
293 | 409 |
AllScreens size == 1 ifTrue:[ |
410 |
^ AllScreens anElement |
|
411 |
]. |
|
412 |
||
413 |
" |
|
414 |
mhmh - multiple screens are active. |
|
415 |
be careful, to not run into an error in case |
|
416 |
the current windowGroup got corrupted somehow ... |
|
417 |
" |
|
418 |
(wg := WindowGroup activeGroup) notNil ifTrue:[ |
|
419 |
" |
|
420 |
ok, not a background process or scheduler ... |
|
421 |
" |
|
422 |
(tops := wg topViews) notNil ifTrue:[ |
|
423 |
tops isEmpty ifFalse:[ |
|
424 |
(v := tops first) notNil ifTrue:[ |
|
425 |
" |
|
426 |
ok, it has a view ... |
|
427 |
" |
|
428 |
(dev := v device) notNil ifTrue:[ |
|
429 |
^ dev |
|
430 |
] |
|
431 |
] |
|
432 |
] |
|
433 |
] |
|
434 |
]. |
|
435 |
" |
|
436 |
in all other cases, return the default display |
|
437 |
" |
|
438 |
^ Display |
|
439 |
||
440 |
" |
|
441 |
Screen current |
|
442 |
" |
|
443 |
||
444 |
"Modified: 1.9.1995 / 13:40:05 / claus" |
|
445 |
! |
|
446 |
||
447 |
default |
|
448 |
"ST-80 compatibility. |
|
449 |
Return the default screen. This is typically the first opened |
|
450 |
Display screen in a session. Use of the global variable Display |
|
451 |
should vanish over time - replace it by Screen default." |
|
452 |
||
453 |
^ DefaultScreen |
|
454 |
||
455 |
" |
|
456 |
Screen default |
|
457 |
" |
|
458 |
! |
|
459 |
||
460 |
default:aDevice |
|
461 |
"Set the default screen. This is sent very early during startup, |
|
462 |
and assigns the first opened screenDevice to both Display and the default |
|
463 |
screen." |
|
464 |
||
465 |
DefaultScreen := aDevice |
|
466 |
! |
|
467 |
||
468 |
platformName |
|
469 |
"ST-80 compatibility. |
|
470 |
Return a string describing the display systems platform. |
|
471 |
Returns a dummy here. This must be redefined in concrete |
|
472 |
Workstation classes, to return somthing like 'X', 'MSWindows', 'OS/2' etc." |
|
473 |
||
474 |
^ 'unknown' |
|
475 |
! ! |
|
476 |
||
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
477 |
!DeviceWorkstation class methodsFor:'standalone setup'! |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
478 |
|
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
479 |
exitOnLastClose:aBoolean |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
480 |
ExitOnLastClose := aBoolean |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
481 |
! ! |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
482 |
|
293 | 483 |
!DeviceWorkstation methodsFor:'accessing & queries'! |
484 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
485 |
buttonMotionMask:aMask includesButton:aButton |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
486 |
"given a device button mask, return true if a logical button |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
487 |
(1 .. 3 for left .. right) is included." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
488 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
489 |
|buttonNr| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
490 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
491 |
"reverse buttonTranslation" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
492 |
buttonTranslation notNil ifTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
493 |
buttonNr := buttonTranslation indexOf:aButton ifAbsent:[1]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
494 |
] ifFalse:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
495 |
buttonNr := aButton. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
496 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
497 |
^ (aMask bitTest:(self buttonMotionMask:buttonNr)) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
498 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
499 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
500 |
dispatchProcess |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
501 |
^ dispatchProcess |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
502 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
503 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
504 |
displayFileDescriptor |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
505 |
"return the file descriptor associated with the display |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
506 |
if any. If there is no underlying filedescriptor, return nil. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
507 |
(used for event select/polling)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
508 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
509 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
510 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
511 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
512 |
id |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
513 |
"return the displayId" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
514 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
515 |
^ displayId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
516 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
517 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
518 |
knownViews |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
519 |
"return a collection of all known views" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
520 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
521 |
^ knownViews |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
522 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
523 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
524 |
knownViews:aCollection |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
525 |
"set the collection of all known views - take care, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
526 |
bad use of this will create funny results; use only for snapshot support" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
527 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
528 |
knownViews := aCollection |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
529 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
530 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
531 |
multiClickTimeDelta |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
532 |
^ multiClickTimeDelta |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
533 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
534 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
535 |
multiClickTimeDelta:milliseconds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
536 |
multiClickTimeDelta := milliseconds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
537 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
538 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
539 |
translatePoint:aPoint from:windowId1 to:windowId2 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
540 |
"given a point in window1 (defined by its id), return the coordinate of |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
541 |
aPoint in window2 (defined by its id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
542 |
Use to xlate points from a window to rootwindow, mainly for rubber-line |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
543 |
drawing on the displays root window." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
544 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
545 |
"This method has to be reimplemented in concrete display classes." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
546 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
547 |
^ self subclassResponsibility |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
548 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
549 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
550 |
|v p root| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
551 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
552 |
v := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
553 |
v openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
554 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
555 |
root := v device rootView. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
556 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
557 |
p := v device translatePoint:10@10 from:(v id) to:(root id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
558 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
559 |
root clippedByChildren:false. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
560 |
root displayLineFrom:0@0 to:p. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
561 |
root clippedByChildren:true. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
562 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
563 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
564 |
|v1 v2 p1 p2 root| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
565 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
566 |
v1 := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
567 |
v1 openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
568 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
569 |
v2 := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
570 |
v2 openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
571 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
572 |
root := v1 device rootView. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
573 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
574 |
p1 := v1 device translatePoint:10@10 from:(v1 id) to:(root id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
575 |
p2 := v1 device translatePoint:10@10 from:(v2 id) to:(root id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
576 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
577 |
root clippedByChildren:false. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
578 |
root displayLineFrom:p1 to:p2. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
579 |
root clippedByChildren:true. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
580 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
581 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
582 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
583 |
viewFromPoint:aPoint |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
584 |
"given a point on the screen, return the ST/X view in which that |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
585 |
point is (this may be a subview). Return nil, if its not an ST/X view |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
586 |
or if the point is on the background" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
587 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
588 |
|view id| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
589 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
590 |
id := self viewIdFromPoint:aPoint. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
591 |
view := self viewFromId:id. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
592 |
^ view |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
593 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
594 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
595 |
viewIdFromPoint:aPoint |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
596 |
"given a point on the screen, return the id of the ST/X view in which that |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
597 |
point is (this may be a subview). Return nil, if its not an ST/X view |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
598 |
or if the point is on the background" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
599 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
600 |
|id searchId foundId| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
601 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
602 |
searchId := self rootWindowId. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
603 |
[searchId notNil] whileTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
604 |
id := self viewIdFromPoint:aPoint in:searchId. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
605 |
foundId := searchId. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
606 |
searchId := id |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
607 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
608 |
^ foundId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
609 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
610 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
611 |
viewIdFromPoint:aPoint in:windowId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
612 |
"given a point in rootWindow, return the viewId of the subview of windowId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
613 |
hit by this coordinate. Return nil if no view was hit. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
614 |
- use to find window to drop objects after a cross-view drag" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
615 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
616 |
"returning nil here actually makes drag&drop impossible |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
617 |
- could also be reimplemented to make a search over all knownViews here. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
618 |
This method has to be reimplemented in concrete display classes." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
619 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
620 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
621 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
622 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
623 |
windowAt:aPoint |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
624 |
"given a point on the screen, return the ST/X topview in which that |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
625 |
point is. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
626 |
Return nil, if its not an ST/X view or if the point is on the background. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
627 |
Alias for viewFromPoint: - ST-80 compatibility" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
628 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
629 |
^ self viewFromPoint:aPoint |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
630 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
631 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
632 |
!DeviceWorkstation methodsFor:'accessing display attributes'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
633 |
|
293 | 634 |
bitsBlue |
635 |
"return the number of valid bits in the red component." |
|
636 |
||
637 |
bitsBlue isNil ifTrue:[ |
|
638 |
"/ not a truecolor display |
|
639 |
^ bitsPerRGB |
|
640 |
]. |
|
641 |
^ bitsBlue |
|
642 |
||
643 |
" |
|
644 |
Display bitsBlue |
|
645 |
" |
|
646 |
||
647 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
648 |
! |
|
649 |
||
650 |
bitsGreen |
|
651 |
"return the number of valid bits in the red component." |
|
652 |
||
653 |
bitsGreen isNil ifTrue:[ |
|
654 |
"/ not a truecolor display |
|
655 |
^ bitsPerRGB |
|
656 |
]. |
|
657 |
^ bitsGreen |
|
658 |
||
659 |
" |
|
660 |
Display bitsGreen |
|
661 |
" |
|
662 |
||
663 |
"Created: 21.10.1995 / 00:45:11 / cg" |
|
664 |
! |
|
665 |
||
666 |
bitsPerRGB |
|
667 |
"return the number of valid bits per rgb component; |
|
668 |
Currently, assume that r/g/b all have the same precision, |
|
669 |
which is a stupid assumption (there may be some, where less |
|
670 |
resolution is available in the blue component). |
|
671 |
Therefore, this may be changed to return a 3-element vector. |
|
672 |
In the meantime, use bitsRed/bitsGreen/bitsBlue to get this information." |
|
673 |
||
674 |
^ bitsPerRGB |
|
675 |
||
676 |
" |
|
677 |
Display bitsPerRGB |
|
678 |
" |
|
679 |
||
680 |
"Modified: 21.10.1995 / 00:46:27 / cg" |
|
681 |
! |
|
682 |
||
683 |
bitsRed |
|
684 |
"return the number of valid bits in the red component." |
|
685 |
||
686 |
bitsRed isNil ifTrue:[ |
|
687 |
"/ not a truecolor display |
|
688 |
^ bitsPerRGB |
|
689 |
]. |
|
690 |
^ bitsRed |
|
691 |
||
692 |
" |
|
693 |
Display bitsRed |
|
694 |
" |
|
695 |
||
696 |
"Created: 21.10.1995 / 00:44:55 / cg" |
|
697 |
! |
|
698 |
||
699 |
blackpixel |
|
700 |
"return the colorId of black" |
|
701 |
||
702 |
^ self subclassResponsibility |
|
703 |
! |
|
704 |
||
705 |
depth |
|
706 |
"return the depth in pixels of the display" |
|
707 |
||
708 |
^ depth |
|
709 |
||
710 |
" |
|
711 |
Display depth |
|
712 |
" |
|
713 |
! |
|
714 |
||
715 |
hasColors |
|
716 |
"return true, if its a color display" |
|
717 |
||
718 |
^ hasColors |
|
719 |
||
720 |
" |
|
721 |
Display hasColors |
|
722 |
" |
|
723 |
! |
|
724 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
725 |
hasGreyscales |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
726 |
"return true, if this workstation supports greyscales |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
727 |
(also true for color displays)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
728 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
729 |
^ hasGreyscales |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
730 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
731 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
732 |
Display hasGreyscales |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
733 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
734 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
735 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
736 |
shiftBlue |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
737 |
"return the count by which the blue bits are to be shifted |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
738 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
739 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
740 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
741 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
742 |
^ blueShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
743 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
744 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
745 |
Display shiftBlue |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
746 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
747 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
748 |
"Created: 21.10.1995 / 00:45:27 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
749 |
"Modified: 21.10.1995 / 00:47:58 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
750 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
751 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
752 |
shiftGreen |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
753 |
"return the count by which the red bits are to be shifted |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
754 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
755 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
756 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
757 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
758 |
^ greenShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
759 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
760 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
761 |
Display shiftGreen |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
762 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
763 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
764 |
"Created: 21.10.1995 / 00:45:27 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
765 |
"Modified: 21.10.1995 / 00:48:28 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
766 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
767 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
768 |
shiftRed |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
769 |
"return the count by which the red bits are to be shifted |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
770 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
771 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
772 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
773 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
774 |
^ redShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
775 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
776 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
777 |
Display shiftRed |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
778 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
779 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
780 |
"Created: 21.10.1995 / 00:45:27 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
781 |
"Modified: 21.10.1995 / 00:48:10 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
782 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
783 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
784 |
visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
785 |
"return a symbol representing the visual type of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
786 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
787 |
^ visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
788 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
789 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
790 |
Display visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
791 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
792 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
793 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
794 |
visualType:aSymbol |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
795 |
"set the visual type. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
796 |
The only situation, where setting the visual makes sense, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
797 |
is with my plasma-display, which ignores the palette and spits out |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
798 |
grey scales, independent of color LUT definitions. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
799 |
(of which the server knows nothing). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
800 |
So, this should be used from a display-specific startup file only." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
801 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
802 |
visualType := aSymbol. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
803 |
(visualType == #StaticGray or:[visualType == #GrayScale]) ifTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
804 |
hasColors := false |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
805 |
] ifFalse:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
806 |
hasColors := true |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
807 |
] |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
808 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
809 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
810 |
whitepixel |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
811 |
"return the colorId of white" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
812 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
813 |
^ self subclassResponsibility |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
814 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
815 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
816 |
!DeviceWorkstation methodsFor:'accessing display capabilities'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
817 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
818 |
hasColors:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
819 |
"set the hasColors flag - needed since some servers dont tell the |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
820 |
truth if a monochrome monitor is connected to a color server. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
821 |
Clearing the hasColors flag in the rc file will force use of grey |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
822 |
colors (which might make a difference, since some colors are hard to |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
823 |
distinguish on a greyscale monitor)." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
824 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
825 |
hasColors := aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
826 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
827 |
|
293 | 828 |
hasDPS |
829 |
"return true, if this workstation supports postscript output into views. |
|
830 |
Should be reimplemented in concrete classes which do support this." |
|
831 |
||
832 |
^ false |
|
833 |
||
834 |
" |
|
835 |
Display hasDPS |
|
836 |
" |
|
837 |
! |
|
838 |
||
839 |
hasExtension:extensionString |
|
840 |
"query for an X extension. The method here is provide for XWorkstation |
|
841 |
protocol compatibility only." |
|
842 |
||
843 |
^ false |
|
844 |
||
845 |
" |
|
846 |
Display hasExtension:'XVideo' |
|
847 |
Display hasExtension:'Input' |
|
848 |
Display hasExtension:'GLX' |
|
849 |
Display hasExtension:'X3D-PEX' |
|
850 |
Display hasExtension:'XInputExtension' |
|
851 |
Display hasExtension:'SHAPE' |
|
852 |
Display hasExtension:'MIT-SHM' |
|
853 |
Display hasExtension:'SGIFullScreenStereo' |
|
854 |
" |
|
855 |
! |
|
856 |
||
857 |
hasFax |
|
858 |
"return true, if this workstation supports decompression of fax images. |
|
859 |
Should be reimplemented in concrete classes which do support this." |
|
860 |
||
861 |
^ false |
|
862 |
||
863 |
" |
|
864 |
Display hasFax |
|
865 |
" |
|
866 |
! |
|
867 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
868 |
hasGreyscales:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
869 |
"set the hasGreyscales flag - can be used to simulate b&w behavior |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
870 |
on greyScale and color monitors. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
871 |
(You may want to check if your application looks ok if displayed on |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
872 |
a b&w monitor - even if you have a color display. To do so, clear |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
873 |
the hasGreyscales flag from your .rc file)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
874 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
875 |
hasGreyscales := aBoolean |
293 | 876 |
! |
877 |
||
878 |
hasImageExtension |
|
879 |
"return true, if this workstation supports the X Image extension" |
|
880 |
||
881 |
^ false |
|
882 |
||
883 |
" |
|
884 |
Display hasImageExtension |
|
885 |
" |
|
886 |
! |
|
887 |
||
888 |
hasInputExtension |
|
889 |
"return true, if this workstation supports the X Input extension" |
|
890 |
||
891 |
^ false |
|
892 |
||
893 |
" |
|
894 |
Display hasInputExtension |
|
895 |
" |
|
896 |
! |
|
897 |
||
898 |
hasMultibuffer |
|
899 |
"return true, if this workstation supports the X multibuffer extension" |
|
900 |
||
901 |
^ false |
|
902 |
||
903 |
" |
|
904 |
Display hasMultibuffer |
|
905 |
" |
|
906 |
! |
|
907 |
||
908 |
hasPEX |
|
909 |
"return true, if this workstation supports PEX graphics. |
|
910 |
Should be reimplemented in concrete classes which do support this." |
|
911 |
||
912 |
^ false |
|
913 |
||
914 |
" |
|
915 |
Display hasPEX |
|
916 |
" |
|
917 |
! |
|
918 |
||
919 |
hasShape |
|
920 |
"return true, if this workstation supports non-rectangular windows. |
|
921 |
Should be reimplemented in concrete classes which do support this." |
|
922 |
||
923 |
^ false |
|
924 |
||
925 |
" |
|
926 |
Display hasShape |
|
927 |
" |
|
928 |
! |
|
929 |
||
930 |
hasShm |
|
931 |
"return true, if this workstation supports shared memory pixmaps. |
|
932 |
Should be reimplemented in concrete classes which do support this." |
|
933 |
||
934 |
^ false |
|
935 |
||
936 |
" |
|
937 |
Display hasShm |
|
938 |
" |
|
939 |
! |
|
940 |
||
941 |
hasStereoExtension |
|
942 |
"return true, if this workstation supports stereo GL drawing. |
|
943 |
Both the server must support it, and the feature must have been |
|
944 |
enabled in the smalltalk system, for true to be returned." |
|
945 |
||
946 |
^ false |
|
947 |
||
948 |
" |
|
949 |
Display hasStereoExtension |
|
950 |
" |
|
951 |
! |
|
952 |
||
953 |
hasXVideo |
|
954 |
"return true, if this workstation supports the XVideo extension" |
|
955 |
||
956 |
^ false |
|
957 |
||
958 |
" |
|
959 |
Display hasXVideo |
|
960 |
" |
|
961 |
! |
|
962 |
||
340 | 963 |
iconSizes |
964 |
"Get the preferrer icon sizes. These are typically set by the window manager. |
|
965 |
We return nil here (as if there are no special size preferences)." |
|
966 |
||
967 |
^ nil |
|
968 |
||
969 |
"Created: 2.1.1996 / 15:08:16 / cg" |
|
970 |
"Modified: 2.1.1996 / 15:09:06 / cg" |
|
971 |
! |
|
972 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
973 |
ignoreBackingStore:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
974 |
"if the argument is true, the views backingStore setting will be ignored, and |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
975 |
no backing store used - this can be used on servers where backing store is |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
976 |
very slow (from rc-file)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
977 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
978 |
^ self |
293 | 979 |
! |
980 |
||
981 |
isSlow |
|
982 |
"return true, if this is a relatively slow device - |
|
983 |
used to turn off things like popup-shadows" |
|
984 |
||
985 |
^ isSlow |
|
986 |
! |
|
987 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
988 |
isSlow:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
989 |
"set/clear the slow flag. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
990 |
The slow-flag has no semantic meaning by itself; |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
991 |
however, it can be set via the display.rc file and tested at various |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
992 |
other places to turn off some bells&whistles which might slow down |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
993 |
the drawing. For example, shadows under popUps are suppressed if isSlow |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
994 |
is set." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
995 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
996 |
isSlow := aBoolean |
293 | 997 |
! |
998 |
||
999 |
monitorType |
|
1000 |
"return a symbol representing the monitor type of the display. |
|
1001 |
It is usually set to #unknown, #color or #monochrome. |
|
1002 |
But it can be set to any value from the startup file, for later |
|
1003 |
testing from anywhere. For example the startup for plasma-displays |
|
1004 |
can set it to #plasma to later influence the colors used in widgets |
|
1005 |
(indirectly through the resource file)." |
|
1006 |
||
1007 |
^ monitorType |
|
1008 |
||
1009 |
" |
|
1010 |
Display monitorType |
|
1011 |
" |
|
1012 |
! |
|
1013 |
||
1014 |
monitorType:aSymbol |
|
1015 |
"set the monitorType - see comment in DeviceWorkstation>>montorType" |
|
1016 |
||
1017 |
monitorType := aSymbol |
|
1018 |
! |
|
1019 |
||
1020 |
ncells |
|
1021 |
"return the number of usable color cells, the display has |
|
1022 |
- this is not always 2 to the power of depth |
|
1023 |
(for example, on 6bit displays, ncells is 64 while depth is 8)" |
|
1024 |
||
1025 |
^ ncells |
|
1026 |
||
1027 |
" |
|
1028 |
Display ncells |
|
1029 |
" |
|
1030 |
! |
|
1031 |
||
1032 |
supportedImageFormats |
|
1033 |
"return an array with supported image formats; each array entry |
|
1034 |
is another array, consisting of depth and bitsPerPixel values. |
|
1035 |
Here, we return a single format only; every graphics device must |
|
1036 |
support b&w single bit images." |
|
1037 |
||
1038 |
|info| |
|
1039 |
||
1040 |
info := IdentityDictionary new. |
|
1041 |
info at:#depth put:1. |
|
1042 |
info at:#bitsPerPixel put:1. |
|
1043 |
info at:#padding put:32. |
|
1044 |
^ Array with:info |
|
1045 |
! |
|
1046 |
||
1047 |
supportsDeepIcons |
|
1048 |
"return true, if this device supports non b&w (i.e. greyScale |
|
1049 |
or colored icons). We really dont know here." |
|
1050 |
||
1051 |
"This method has to be reimplemented in concrete display classes." |
|
1052 |
^ self subclassResponsibility |
|
1053 |
||
1054 |
" |
|
1055 |
Display supportsDeepIcons |
|
1056 |
" |
|
1057 |
! |
|
1058 |
||
1059 |
supportsGLDrawing |
|
1060 |
"return true, if this device supports 3D GL drawing. |
|
1061 |
We do not depend on that being implemented." |
|
1062 |
||
1063 |
"This method should to be reimplemented in concrete display classes." |
|
1064 |
^ false |
|
1065 |
||
1066 |
" |
|
1067 |
Display supportsGLDrawing |
|
1068 |
" |
|
1069 |
! |
|
1070 |
||
1071 |
supportsViewGravity |
|
1072 |
"return true, if this device supports gravity attributes. |
|
1073 |
We do not depend on the being implemented, but some resizing operations |
|
1074 |
are faster, it is is." |
|
1075 |
||
1076 |
"This method should to be reimplemented in concrete display classes." |
|
1077 |
^ false |
|
1078 |
||
1079 |
" |
|
1080 |
Display supportsViewGravity |
|
1081 |
" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1082 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1083 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1084 |
!DeviceWorkstation methodsFor:'accessing display geometry'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1085 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1086 |
boundingBox |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1087 |
"return a rectangle representing the displays bounding box. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1088 |
For Smalltalk-80 2.x compatibility" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1089 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1090 |
^ self bounds |
293 | 1091 |
! |
1092 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1093 |
bounds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1094 |
"return a rectangle representing the displays bounding box. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1095 |
For Smalltalk-80 4.x compatibility" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1096 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1097 |
^ Rectangle origin:(0 @ 0) extent:(width @ height) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1098 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1099 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1100 |
Screen default bounds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1101 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1102 |
"/ thats the same as: |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1103 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1104 |
Display bounds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1105 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1106 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1107 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1108 |
center |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1109 |
"return the centerpoint in pixels of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1110 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1111 |
^ (width // 2) @ (height // 2) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1112 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1113 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1114 |
extent |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1115 |
"return the extent of the display (in pixels)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1116 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1117 |
^ width @ height |
293 | 1118 |
|
1119 |
" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1120 |
Display extent |
293 | 1121 |
" |
1122 |
! |
|
1123 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1124 |
height |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1125 |
"return the height of the display (in pixels)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1126 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1127 |
^ height |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1128 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1129 |
"Display height" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1130 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1131 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1132 |
heightInMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1133 |
"return the height in millimeter of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1134 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1135 |
^ heightMM |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1136 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1137 |
"Display heightInMillimeter" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1138 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1139 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1140 |
heightInMillimeter:aNumber |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1141 |
"set the height in millimeter of the display |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1142 |
- needed since some displays do not tell the truth or do not know it" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1143 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1144 |
heightMM := aNumber |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1145 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1146 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1147 |
horizontalPixelPerInch |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1148 |
"return the number of horizontal pixels per inch of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1149 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1150 |
^ (width / widthMM) * 25.4 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1151 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1152 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1153 |
horizontalPixelPerMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1154 |
"return the number of horizontal pixels per millimeter of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1155 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1156 |
^ width / widthMM |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1157 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1158 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1159 |
pixelPerInch |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1160 |
"return the number of horizontal/vertical pixels per inch of the display as Point" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1161 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1162 |
^ ((width / widthMM) @ (height / heightMM)) * 25.4 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1163 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1164 |
"Display pixelPerInch" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1165 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1166 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1167 |
pixelPerMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1168 |
"return the number of horizontal/vertical pixels per millimeter of the display as Point" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1169 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1170 |
^ (width / widthMM) @ (height / heightMM) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1171 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1172 |
"Display pixelPerMillimeter" |
293 | 1173 |
! |
1174 |
||
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
1175 |
resolution |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
1176 |
"return a point consisting of pixel-per-inch horizontally and vertically. |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
1177 |
This is an ST-80 compatibility method" |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
1178 |
|
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
1179 |
^ self pixelPerInch |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
1180 |
! |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
1181 |
|
293 | 1182 |
verticalPixelPerInch |
1183 |
"return the number of vertical pixels per inch of the display" |
|
1184 |
||
1185 |
^ (height / heightMM) * 25.4 |
|
1186 |
! |
|
1187 |
||
1188 |
verticalPixelPerMillimeter |
|
1189 |
"return the number of vertical pixels per millimeter of the display" |
|
1190 |
||
1191 |
^ height / heightMM |
|
1192 |
! |
|
1193 |
||
1194 |
virtualExtent |
|
1195 |
"return the virtual extent of the display (in pixels). |
|
1196 |
On most systems, this is the same as the physical width; |
|
1197 |
except, if a window manager with a virtual desktop like olvwm |
|
1198 |
(simulating a bigger screen) is running." |
|
1199 |
||
1200 |
^ width @ height |
|
1201 |
! |
|
1202 |
||
1203 |
virtualHeight |
|
1204 |
"return the virtual height of the display (in pixels). |
|
1205 |
On most systems, this is the same as the physical height; |
|
1206 |
except, if a window manager with a virtual desktop like olvwm |
|
1207 |
(simulating a bigger screen) is running." |
|
1208 |
||
1209 |
^ self virtualExtent y |
|
1210 |
||
1211 |
"Display virtualHeight" |
|
1212 |
! |
|
1213 |
||
1214 |
virtualWidth |
|
1215 |
"return the virtual width of the display (in pixels). |
|
1216 |
On most systems, this is the same as the physical width; |
|
1217 |
except, if a window manager with a virtual desktop like olvwm |
|
1218 |
(simulating a bigger screen) is running." |
|
1219 |
||
1220 |
^ self virtualExtent x |
|
1221 |
||
1222 |
"Display virtualWidth" |
|
1223 |
! |
|
1224 |
||
1225 |
width |
|
1226 |
"return the width of the display (in pixels)" |
|
1227 |
||
1228 |
^ width |
|
1229 |
||
1230 |
"Display width" |
|
1231 |
! |
|
1232 |
||
1233 |
widthInMillimeter |
|
1234 |
"return the width in millimeter of the display" |
|
1235 |
||
1236 |
^ widthMM |
|
1237 |
||
1238 |
"Display widthInMillimeter" |
|
1239 |
! |
|
1240 |
||
1241 |
widthInMillimeter:aNumber |
|
1242 |
"set the width in millimeter of the display |
|
1243 |
- needed since some displays do not tell the truth or do not know it" |
|
1244 |
||
1245 |
widthMM := aNumber |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1246 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1247 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1248 |
!DeviceWorkstation methodsFor:'accessing keyboard mappings'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1249 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1250 |
buttonTranslation |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1251 |
^ buttonTranslation |
293 | 1252 |
! |
1253 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1254 |
buttonTranslation:anArray |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1255 |
buttonTranslation := anArray |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1256 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1257 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1258 |
keyboardMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1259 |
"return the keyboard map" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1260 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1261 |
^ keyboardMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1262 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1263 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1264 |
keyboardMap:aMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1265 |
"set the keyboard map" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1266 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1267 |
keyboardMap := aMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1268 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1269 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1270 |
!DeviceWorkstation methodsFor:'accessing misc'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1271 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1272 |
displayName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1273 |
"return the display name - that is the name of the display connection |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1274 |
or nil, for default display. For example, in X, this returns a string |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1275 |
like 'hostname:0' for remote connections, and nil for a default local |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1276 |
connection. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1277 |
- nothing known here, but maybe redefined in subclasses." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1278 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1279 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1280 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1281 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1282 |
Display displayName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1283 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1284 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1285 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1286 |
glVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1287 |
"return a string describing the GL version. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1288 |
Since the generic display does not support 3D GL graphics, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1289 |
a dummy is returned here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1290 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1291 |
^ 'noGL' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1292 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1293 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1294 |
Display glVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1295 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1296 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1297 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1298 |
platformName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1299 |
"return a string describing the display systems platform. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1300 |
Returns a dummy here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1301 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1302 |
^ self class platformName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1303 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1304 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1305 |
Display platformName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1306 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1307 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1308 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1309 |
protocolVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1310 |
"return the display systems protocol version number. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1311 |
Returns a dummy here" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1312 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1313 |
^ 0 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1314 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1315 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1316 |
Display protocolVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1317 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1318 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1319 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1320 |
serverVendor |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1321 |
"return a string describing the display systems server vendor. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1322 |
Returns a dummy here" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1323 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1324 |
^ 'generic' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1325 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1326 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1327 |
Display serverVendor |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1328 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1329 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1330 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1331 |
vendorRelease |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1332 |
"return the display systems release number. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1333 |
Returns a dummy here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1334 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1335 |
^ 0 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1336 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1337 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1338 |
Display vendorRelease |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1339 |
" |
293 | 1340 |
! ! |
1341 |
||
1342 |
!DeviceWorkstation methodsFor:'bitmap/window creation'! |
|
1343 |
||
1344 |
createBitmapFromArray:anArray width:w height:h |
|
1345 |
^ self subclassResponsibility |
|
1346 |
! |
|
1347 |
||
1348 |
createBitmapFromFile:aString for:aForm |
|
1349 |
^ self subclassResponsibility |
|
1350 |
! |
|
1351 |
||
1352 |
createBitmapWidth:w height:h |
|
1353 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1354 |
(i.e. random). Return a bitmap id or nil" |
|
1355 |
||
1356 |
^ self subclassResponsibility |
|
1357 |
! |
|
1358 |
||
1359 |
createFaxImageFromArray:data width:w height:h type:type k:k msbFirst:msbFirst |
|
1360 |
"create a new faxImage in the workstation. |
|
1361 |
This is a special interface to servers with the fax-image |
|
1362 |
extension (you won't find it in standard X-servers). |
|
1363 |
||
1364 |
type: 0 -> uncompressed |
|
1365 |
1 -> group3 1D (k is void) |
|
1366 |
2 -> group3 2D |
|
1367 |
3 -> group4 2D (k is void) |
|
1368 |
" |
|
1369 |
||
1370 |
^ nil |
|
1371 |
! |
|
1372 |
||
1373 |
createPixmapWidth:w height:h depth:d |
|
1374 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1375 |
(i.e. random). Return a bitmap id or nil" |
|
1376 |
||
1377 |
^ self subclassResponsibility |
|
1378 |
! |
|
1379 |
||
1380 |
createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight |
|
1381 |
^ self subclassResponsibility |
|
1382 |
! |
|
1383 |
||
1384 |
destroyFaxImage:aFaxImageId |
|
1385 |
^ self subclassResponsibility |
|
1386 |
! |
|
1387 |
||
1388 |
destroyGC:aGCId |
|
1389 |
"destroy a GC" |
|
1390 |
||
1391 |
^ self subclassResponsibility |
|
1392 |
! |
|
1393 |
||
1394 |
destroyPixmap:aDrawableId |
|
1395 |
^ self subclassResponsibility |
|
1396 |
! |
|
1397 |
||
1398 |
destroyView:aView withId:aWindowId |
|
1399 |
^ self subclassResponsibility |
|
1400 |
! |
|
1401 |
||
1402 |
gcFor:aDrawableId |
|
1403 |
"create a GC for drawing into aDrawable" |
|
1404 |
||
1405 |
^ self subclassResponsibility |
|
1406 |
! |
|
1407 |
||
1408 |
rootWindowFor:aView |
|
1409 |
^ self subclassResponsibility |
|
1410 |
! ! |
|
1411 |
||
1412 |
!DeviceWorkstation methodsFor:'color stuff'! |
|
1413 |
||
1414 |
blueComponentOfColor:colorId |
|
1415 |
"get blue component (0..100) of color in map at:index" |
|
1416 |
||
1417 |
self getRGBFrom:colorId into:[:r :g :b | ^ b] |
|
1418 |
! |
|
1419 |
||
1420 |
colorCell |
|
1421 |
"allocate a color - return index" |
|
1422 |
||
1423 |
^ self subclassResponsibility |
|
1424 |
! |
|
1425 |
||
1426 |
colorNamed:aString |
|
1427 |
"allocate a color with color name - return index. |
|
1428 |
Colors should not be allocated by name, since most colors |
|
1429 |
are X specific - get colors by rgb instead." |
|
1430 |
||
1431 |
"support some of them ..." |
|
1432 |
||
1433 |
self getRGBFromName:aString into:[:r :g :b | |
|
1434 |
^ self colorRed:r green:g blue:b |
|
1435 |
]. |
|
1436 |
^ nil |
|
1437 |
! |
|
1438 |
||
1439 |
colorRed:redVal green:greenVal blue:blueVal |
|
1440 |
"allocate a color with rgb values (0..100) - return index" |
|
1441 |
||
1442 |
^ self subclassResponsibility |
|
1443 |
! |
|
1444 |
||
1445 |
freeColor:colorIndex |
|
1446 |
"free a color on the display, when its no longer needed" |
|
1447 |
||
1448 |
^ self subclassResponsibility |
|
1449 |
! |
|
1450 |
||
1451 |
getRGBFrom:index into:aBlock |
|
1452 |
"get rgb components (0..100) of color in map at:index, |
|
1453 |
and evaluate the 3-arg block, aBlock with them" |
|
1454 |
||
1455 |
^ self subclassResponsibility |
|
1456 |
! |
|
1457 |
||
1458 |
getRGBFromName:colorName into:aBlock |
|
1459 |
"get rgb components (0..100) of color named colorName, |
|
1460 |
and evaluate the 3-arg block, aBlock with them. |
|
1461 |
The method here only handles some often used colors; |
|
1462 |
getRGBFromName should not be used, since colorNames other |
|
1463 |
than those below are X specific." |
|
1464 |
||
1465 |
|idx names triple| |
|
1466 |
||
1467 |
names := #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black'). |
|
1468 |
idx := names indexOf:colorName. |
|
1469 |
idx == 0 ifTrue:[ |
|
1470 |
idx := (names asLowercase) indexOf:colorName. |
|
1471 |
]. |
|
1472 |
idx == 0 ifFalse:[ |
|
1473 |
triple := #( |
|
1474 |
(100 0 0) "red" |
|
1475 |
( 0 100 0) "green" |
|
1476 |
( 0 0 100) "blue" |
|
1477 |
(100 100 0) "yellow" |
|
1478 |
(100 0 100) "magenta" |
|
1479 |
( 0 100 100) "cyan" |
|
1480 |
(100 100 100) "white" |
|
1481 |
( 0 0 0) "black" |
|
1482 |
) at:idx. |
|
1483 |
||
1484 |
^ aBlock value:(triple at:1) |
|
1485 |
value:(triple at:2) |
|
1486 |
value:(triple at:3) |
|
1487 |
]. |
|
1488 |
^ nil |
|
1489 |
! |
|
1490 |
||
1491 |
greenComponentOfColor:colorId |
|
1492 |
"get green component (0..100) of color in map at:index" |
|
1493 |
||
1494 |
self getRGBFrom:colorId into:[:r :g :b | ^ g] |
|
1495 |
! |
|
1496 |
||
1497 |
listOfAvailableColors |
|
1498 |
"return a list of all available colornames; |
|
1499 |
This method should not be used, since colornames are |
|
1500 |
very X specific. However, the names defined here are pretty common" |
|
1501 |
||
1502 |
^ #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black') |
|
1503 |
! |
|
1504 |
||
1505 |
redComponentOfColor:colorId |
|
1506 |
"get red component (0..100) of color in map at:index" |
|
1507 |
||
1508 |
self getRGBFrom:colorId into:[:r :g :b | ^ r] |
|
1509 |
! |
|
1510 |
||
1511 |
setColor:index red:redVal green:greenVal blue:blueVal |
|
1512 |
"change color in map at:index to rgb (0..100)" |
|
1513 |
||
1514 |
^ self subclassResponsibility |
|
1515 |
! ! |
|
1516 |
||
1517 |
!DeviceWorkstation methodsFor:'cursor stuff'! |
|
1518 |
||
1519 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
|
1520 |
"change a cursors colors" |
|
1521 |
||
1522 |
^ self subclassResponsibility |
|
1523 |
! |
|
1524 |
||
1525 |
createCursorShape:aShape |
|
1526 |
"create a cursor given a shape-symbol" |
|
1527 |
||
1528 |
^ self subclassResponsibility |
|
1529 |
! |
|
1530 |
||
1531 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy |
|
1532 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
|
1533 |
^ self subclassResponsibility |
|
1534 |
! |
|
1535 |
||
1536 |
destroyCursor:aCursorId |
|
1537 |
"free a cursor" |
|
1538 |
||
1539 |
^ self subclassResponsibility |
|
1540 |
! ! |
|
1541 |
||
1542 |
!DeviceWorkstation methodsFor:'drawing'! |
|
1543 |
||
1544 |
copyFromFaxImage:sourceId x:srcX y:srcY to:destId x:dstX y:dstY |
|
1545 |
width:w height:h with:aGCId scaleX:scaleX scaleY:scaleY |
|
1546 |
"do a bit-blt" |
|
1547 |
||
1548 |
^ self subclassResponsibility |
|
1549 |
! |
|
1550 |
||
1551 |
copyFromId:sourceId x:srcX y:srcY to:destId x:dstX y:dstY |
|
1552 |
width:w height:h with:aGCId |
|
1553 |
"do a bit-blt" |
|
1554 |
||
1555 |
^ self subclassResponsibility |
|
1556 |
! |
|
1557 |
||
1558 |
copyPlaneFromId:sourceId x:srcX y:srcY to:destId x:dstX y:dstY |
|
1559 |
width:w height:h with:aGCId |
|
1560 |
"do a bit-blt, using the low-bit plane of the source only" |
|
1561 |
||
1562 |
^ self subclassResponsibility |
|
1563 |
! |
|
1564 |
||
1565 |
displayArcX:x y:y w:width h:height from:startAngle angle:angle |
|
1566 |
in:aDrawableId with:aGCId |
|
1567 |
"draw an arc" |
|
1568 |
||
1569 |
^ self subclassResponsibility |
|
1570 |
! |
|
1571 |
||
1572 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
|
1573 |
"draw a line" |
|
1574 |
||
1575 |
"could add a bresenham line drawer here ..." |
|
1576 |
^ self subclassResponsibility |
|
1577 |
! |
|
1578 |
||
1579 |
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
|
1580 |
"draw a sub-string - draw foreground on background. |
|
1581 |
If the coordinates are not integers, retry with rounded." |
|
1582 |
||
1583 |
self displayString:aString |
|
1584 |
from:index1 |
|
1585 |
to:index2 |
|
1586 |
x:x |
|
1587 |
y:y |
|
1588 |
in:aDrawableId |
|
1589 |
with:aGCId |
|
1590 |
opaque:true |
|
1591 |
! |
|
1592 |
||
1593 |
displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId |
|
1594 |
"draw a string - draw foreground on background. |
|
1595 |
If the coordinates are not integers, retry with rounded." |
|
1596 |
||
1597 |
self displayString:aString |
|
1598 |
x:x |
|
1599 |
y:y |
|
1600 |
in:aDrawableId |
|
1601 |
with:aGCId |
|
1602 |
opaque:true |
|
1603 |
! |
|
1604 |
||
1605 |
displayPointX:x y:y in:aDrawableId with:aGCId |
|
1606 |
"draw a point" |
|
1607 |
||
1608 |
^ self subclassResponsibility |
|
1609 |
! |
|
1610 |
||
1611 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
1612 |
"draw a polygon" |
|
1613 |
||
1614 |
" |
|
1615 |
should draw the lines here |
|
1616 |
but then, we have to reimplement all line and join styles here |
|
1617 |
" |
|
1618 |
^ self subclassResponsibility |
|
1619 |
! |
|
1620 |
||
1621 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
1622 |
"draw a rectangle" |
|
1623 |
||
1624 |
" |
|
1625 |
should draw four lines here |
|
1626 |
but then, we have to reimplement all line and join styles here |
|
1627 |
" |
|
1628 |
^ self subclassResponsibility |
|
1629 |
! |
|
1630 |
||
1631 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
|
1632 |
"draw a sub-string - draw foreground only. |
|
1633 |
If the coordinates are not integers, retry with rounded." |
|
1634 |
||
1635 |
self |
|
1636 |
displayString:aString |
|
1637 |
from:index1 |
|
1638 |
to:index2 |
|
1639 |
x:x |
|
1640 |
y:y |
|
1641 |
in:aDrawableId |
|
1642 |
with:aGCId |
|
1643 |
opaque:false |
|
1644 |
! |
|
1645 |
||
1646 |
displayString:aString from:i1 to:i2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
1647 |
"draw part of a string" |
|
1648 |
||
1649 |
" |
|
1650 |
should be redefined in concrete subclasses |
|
1651 |
to avoid creation of throw-away string |
|
1652 |
" |
|
1653 |
self displayString:(aString copyFrom:i1 to:i2) |
|
1654 |
x:x |
|
1655 |
y:y |
|
1656 |
in:aDrawableId |
|
1657 |
with:aGCId |
|
1658 |
opaque:opaque |
|
1659 |
! |
|
1660 |
||
1661 |
displayString:aString x:x y:y in:aDrawableId with:aGCId |
|
1662 |
"draw a string - draw foreground only. |
|
1663 |
If the coordinates are not integers, retry with rounded." |
|
1664 |
||
1665 |
self |
|
1666 |
displayString:aString |
|
1667 |
x:x |
|
1668 |
y:y |
|
1669 |
in:aDrawableId |
|
1670 |
with:aGCId |
|
1671 |
opaque:false |
|
1672 |
! |
|
1673 |
||
1674 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
1675 |
"draw a string" |
|
1676 |
||
1677 |
^ self subclassResponsibility |
|
1678 |
! |
|
1679 |
||
1680 |
drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight |
|
1681 |
x:srcx y:srcy |
|
1682 |
into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
|
1683 |
||
1684 |
"draw a bitimage which has depth id, width iw and height ih into |
|
1685 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
1686 |
It has to be checked elsewhere, that server can do it with the given |
|
1687 |
depth; also it is assumed, that the colormap is setup correctly" |
|
1688 |
||
1689 |
^ self subclassResponsibility |
|
1690 |
! |
|
1691 |
||
1692 |
fillArcX:x y:y w:width h:height from:startAngle angle:angle |
|
1693 |
in:aDrawableId with:aGCId |
|
1694 |
"fill an arc" |
|
1695 |
||
1696 |
^ self subclassResponsibility |
|
1697 |
! |
|
1698 |
||
1699 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
1700 |
"fill a polygon" |
|
1701 |
||
1702 |
^ self subclassResponsibility |
|
1703 |
! |
|
1704 |
||
1705 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
1706 |
"fill a rectangle" |
|
1707 |
||
1708 |
^ self subclassResponsibility |
|
1709 |
! ! |
|
1710 |
||
1711 |
!DeviceWorkstation methodsFor:'enumerating'! |
|
1712 |
||
1713 |
allViewsDo:aBlock |
|
1714 |
"evaluate the argument, aBlock for all of my known views" |
|
1715 |
||
1716 |
"/ idToViewMapping notNil ifTrue:[ |
|
1717 |
"/ idToViewMapping keysAndValuesDo:[:id :aView | |
|
1718 |
"/ aView notNil ifTrue:[ |
|
1719 |
"/ aBlock value:aView |
|
1720 |
"/ ] |
|
1721 |
"/ ] |
|
1722 |
||
1723 |
||
1724 |
knownViews notNil ifTrue:[ |
|
1725 |
knownViews do:[:aView | |
|
1726 |
aView notNil ifTrue:[ |
|
1727 |
aBlock value:aView |
|
1728 |
] |
|
1729 |
] |
|
1730 |
] |
|
1731 |
||
1732 |
" |
|
1733 |
View defaultStyle:#iris. |
|
1734 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
1735 |
" |
|
1736 |
" |
|
1737 |
View defaultStyle:#next. |
|
1738 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
1739 |
" |
|
1740 |
" |
|
1741 |
View defaultStyle:#normal. |
|
1742 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
1743 |
" |
|
1744 |
! ! |
|
1745 |
||
1746 |
!DeviceWorkstation methodsFor:'event forwarding'! |
|
1747 |
||
1748 |
buttonMotion:button x:x y:y view:aView |
|
1749 |
"forward a button-motion for some view" |
|
1750 |
||
1751 |
|sensor| |
|
1752 |
||
1753 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1754 |
sensor buttonMotion:button x:x y:y view:aView |
|
1755 |
] ifFalse:[ |
|
1756 |
" |
|
1757 |
if there is no sensor ... |
|
1758 |
" |
|
1759 |
WindowEvent |
|
1760 |
sendEvent:#buttonMotion:x:y: |
|
1761 |
arguments:(Array with:button with:x with:y) |
|
1762 |
view:aView |
|
1763 |
] |
|
1764 |
! |
|
1765 |
||
1766 |
buttonMultiPress:button x:x y:y view:aView |
|
1767 |
"forward a button-multi-press event for some view" |
|
1768 |
||
1769 |
|sensor| |
|
1770 |
||
1771 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1772 |
sensor buttonMultiPress:button x:x y:y view:aView |
|
1773 |
] ifFalse:[ |
|
1774 |
" |
|
1775 |
if there is no sensor ... |
|
1776 |
" |
|
1777 |
WindowEvent |
|
1778 |
sendEvent:#buttonMultiPress:x:y: |
|
1779 |
arguments:(Array with:button with:x with:y) |
|
1780 |
view:aView |
|
1781 |
] |
|
1782 |
! |
|
1783 |
||
1784 |
buttonPress:button x:x y:y view:aView |
|
1785 |
"forward a button-press event for some view" |
|
1786 |
||
1787 |
|sensor| |
|
1788 |
||
1789 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1790 |
sensor buttonPress:button x:x y:y view:aView |
|
1791 |
] ifFalse:[ |
|
1792 |
" |
|
1793 |
if there is no sensor ... |
|
1794 |
" |
|
1795 |
WindowEvent |
|
1796 |
sendEvent:#buttonPress:x:y: |
|
1797 |
arguments:(Array with:button with:x with:y) |
|
1798 |
view:aView |
|
1799 |
] |
|
1800 |
! |
|
1801 |
||
1802 |
buttonRelease:button x:x y:y view:aView |
|
1803 |
"forward a button-release event for some view" |
|
1804 |
||
1805 |
|sensor| |
|
1806 |
||
1807 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1808 |
sensor buttonRelease:button x:x y:y view:aView |
|
1809 |
] ifFalse:[ |
|
1810 |
" |
|
1811 |
if there is no sensor ... |
|
1812 |
" |
|
1813 |
WindowEvent |
|
1814 |
sendEvent:#buttonRelease:x:y: |
|
1815 |
arguments:(Array with:button with:x with:y) |
|
1816 |
view:aView |
|
1817 |
] |
|
1818 |
! |
|
1819 |
||
1820 |
buttonShiftPress:button x:x y:y view:aView |
|
1821 |
"forward a button-shift-press event for some view" |
|
1822 |
||
1823 |
|sensor| |
|
1824 |
||
1825 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1826 |
sensor buttonShiftPress:button x:x y:y view:aView |
|
1827 |
] ifFalse:[ |
|
1828 |
" |
|
1829 |
if there is no sensor ... |
|
1830 |
" |
|
1831 |
WindowEvent |
|
1832 |
sendEvent:#buttonShiftPress:x:y: |
|
1833 |
arguments:(Array with:button with:x with:y) |
|
1834 |
view:aView |
|
1835 |
] |
|
1836 |
! |
|
1837 |
||
1838 |
configureX:x y:y width:w height:h view:aView |
|
1839 |
"forward a configure for some view" |
|
1840 |
||
1841 |
|sensor| |
|
1842 |
||
1843 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1844 |
sensor configureX:x y:y width:w height:h view:aView |
|
1845 |
] ifFalse:[ |
|
1846 |
" |
|
1847 |
if there is no sensor ... |
|
1848 |
" |
|
1849 |
aView configureX:x y:y width:w height:h |
|
1850 |
] |
|
1851 |
! |
|
1852 |
||
1853 |
coveredBy:otherView view:aView |
|
1854 |
"forward a covered for some view" |
|
1855 |
||
1856 |
|sensor| |
|
1857 |
||
1858 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1859 |
sensor coveredBy:otherView view:aView |
|
1860 |
] ifFalse:[ |
|
1861 |
" |
|
1862 |
if there is no sensor ... |
|
1863 |
" |
|
1864 |
aView coveredBy:otherView |
|
1865 |
] |
|
1866 |
! |
|
1867 |
||
1868 |
destroyedView:aView |
|
1869 |
"forward a destroyed event for some view" |
|
1870 |
||
1871 |
|sensor| |
|
1872 |
||
1873 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1874 |
sensor destroyedView:aView |
|
1875 |
] ifFalse:[ |
|
1876 |
" |
|
1877 |
if there is no sensor ... |
|
1878 |
" |
|
1879 |
aView destroyed |
|
1880 |
] |
|
1881 |
! |
|
1882 |
||
1883 |
exposeX:x y:y width:w height:h view:aView |
|
1884 |
"forward an expose for some view" |
|
1885 |
||
1886 |
|sensor| |
|
1887 |
||
1888 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1889 |
sensor exposeX:x y:y width:w height:h view:aView |
|
1890 |
] ifFalse:[ |
|
1891 |
" |
|
1892 |
if there is no sensor ... |
|
1893 |
" |
|
1894 |
WindowEvent |
|
1895 |
sendEvent:#exposeX:y:width:height: |
|
1896 |
arguments:(Array with:x with:y with:w with:h) |
|
1897 |
view:aView |
|
1898 |
] |
|
1899 |
! |
|
1900 |
||
1901 |
focusInView:aView |
|
1902 |
"forward a focusIn event for some view" |
|
1903 |
||
1904 |
|sensor| |
|
1905 |
||
1906 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1907 |
sensor focusInView:aView |
|
1908 |
] ifFalse:[ |
|
1909 |
" |
|
1910 |
if there is no sensor ... |
|
1911 |
" |
|
1912 |
WindowEvent |
|
1913 |
sendEvent:#focusIn |
|
1914 |
arguments:nil |
|
1915 |
view:aView |
|
1916 |
] |
|
1917 |
! |
|
1918 |
||
1919 |
focusOutView:aView |
|
1920 |
"forward a focusOut event for some view" |
|
1921 |
||
1922 |
|sensor| |
|
1923 |
||
1924 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1925 |
sensor focusOutView:aView |
|
1926 |
] ifFalse:[ |
|
1927 |
" |
|
1928 |
if there is no sensor ... |
|
1929 |
" |
|
1930 |
WindowEvent |
|
1931 |
sendEvent:#focusOut |
|
1932 |
arguments:nil |
|
1933 |
view:aView |
|
1934 |
] |
|
1935 |
! |
|
1936 |
||
1937 |
graphicExposeX:x y:y width:w height:h view:aView |
|
1938 |
"forward a graphic expose for some view" |
|
1939 |
||
1940 |
|sensor| |
|
1941 |
||
1942 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1943 |
sensor graphicExposeX:x y:y width:w height:h view:aView |
|
1944 |
] ifFalse:[ |
|
1945 |
" |
|
1946 |
if there is no sensor ... |
|
1947 |
" |
|
1948 |
WindowEvent |
|
1949 |
sendEvent:#graphicExposeX:y:width:height: |
|
1950 |
arguments:(Array with:x with:y with:w with:h) |
|
1951 |
view:aView |
|
1952 |
] |
|
1953 |
! |
|
1954 |
||
1955 |
keyPress:untranslatedKey x:x y:y view:aView |
|
1956 |
"forward a key-press event for some view" |
|
1957 |
||
1958 |
|xlatedKey sensor| |
|
1959 |
||
1960 |
self modifierKeyProcessing:untranslatedKey down:true. |
|
1961 |
||
1962 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1963 |
sensor keyPress:untranslatedKey x:x y:y view:aView |
|
1964 |
] ifFalse:[ |
|
1965 |
" |
|
1966 |
if there is no sensor ... |
|
1967 |
" |
|
1968 |
xlatedKey := self translateKey:untranslatedKey. |
|
1969 |
xlatedKey notNil ifTrue:[ |
|
1970 |
WindowEvent |
|
1971 |
sendEvent:#keyPress:x:y: |
|
1972 |
arguments:(Array with:xlatedKey with:x with:y) |
|
1973 |
view:aView |
|
1974 |
] |
|
1975 |
] |
|
1976 |
! |
|
1977 |
||
1978 |
keyRelease:untranslatedKey x:x y:y view:aView |
|
1979 |
"forward a key-release event for some view" |
|
1980 |
||
1981 |
|xlatedKey sensor| |
|
1982 |
||
1983 |
self modifierKeyProcessing:untranslatedKey down:false. |
|
1984 |
||
1985 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1986 |
sensor keyRelease:untranslatedKey x:x y:y view:aView |
|
1987 |
] ifFalse:[ |
|
1988 |
" |
|
1989 |
if there is no sensor ... |
|
1990 |
" |
|
1991 |
xlatedKey := self translateKey:untranslatedKey. |
|
1992 |
xlatedKey notNil ifTrue:[ |
|
1993 |
WindowEvent |
|
1994 |
sendEvent:#keyRelease:x:y: |
|
1995 |
arguments:(Array with:xlatedKey with:x with:y) |
|
1996 |
view:aView |
|
1997 |
] |
|
1998 |
] |
|
1999 |
! |
|
2000 |
||
2001 |
mappedView:aView |
|
2002 |
"forward a mapped event for some view" |
|
2003 |
||
2004 |
|sensor| |
|
2005 |
||
2006 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2007 |
sensor mappedView:aView |
|
2008 |
] ifFalse:[ |
|
2009 |
" |
|
2010 |
if there is no sensor ... |
|
2011 |
" |
|
2012 |
aView mapped |
|
2013 |
] |
|
2014 |
! |
|
2015 |
||
2016 |
noExposeView:aView |
|
2017 |
"forward a noExpose event for some view" |
|
2018 |
||
2019 |
|sensor| |
|
2020 |
||
2021 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2022 |
sensor noExposeView:aView |
|
2023 |
] ifFalse:[ |
|
2024 |
" |
|
2025 |
if there is no sensor ... |
|
2026 |
" |
|
2027 |
aView noExpose |
|
2028 |
] |
|
2029 |
! |
|
2030 |
||
2031 |
pointerEnter:buttonState x:x y:y view:aView |
|
2032 |
"forward a pointer enter for some view" |
|
2033 |
||
2034 |
|sensor| |
|
2035 |
||
2036 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2037 |
sensor pointerEnter:buttonState x:x y:y view:aView |
|
2038 |
] ifFalse:[ |
|
2039 |
" |
|
2040 |
if there is no sensor ... |
|
2041 |
" |
|
2042 |
WindowEvent |
|
2043 |
sendEvent:#pointerEnter:x:y: |
|
2044 |
arguments:(Array with:buttonState with:x with:y) |
|
2045 |
view:aView |
|
2046 |
] |
|
2047 |
! |
|
2048 |
||
2049 |
pointerLeave:buttonState view:aView |
|
2050 |
"forward a pointer leave for some view" |
|
2051 |
||
2052 |
|sensor| |
|
2053 |
||
2054 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2055 |
sensor pointerLeave:buttonState view:aView |
|
2056 |
] ifFalse:[ |
|
2057 |
" |
|
2058 |
if there is no sensor ... |
|
2059 |
" |
|
2060 |
WindowEvent |
|
2061 |
sendEvent:#pointerLeave: |
|
2062 |
arguments:(Array with:buttonState) |
|
2063 |
view:aView |
|
2064 |
] |
|
2065 |
! |
|
2066 |
||
2067 |
saveAndTerminateView:aView |
|
2068 |
"forward a saveAndTerminate event for some view" |
|
2069 |
||
2070 |
|sensor| |
|
2071 |
||
2072 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2073 |
sensor saveAndTerminateView:aView |
|
2074 |
] ifFalse:[ |
|
2075 |
" |
|
2076 |
if there is no sensor ... |
|
2077 |
" |
|
2078 |
aView saveAndTerminate |
|
2079 |
] |
|
2080 |
! |
|
2081 |
||
2082 |
terminateView:aView |
|
2083 |
"forward a terminate event for some view" |
|
2084 |
||
2085 |
|sensor| |
|
2086 |
||
2087 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2088 |
sensor terminateView:aView |
|
2089 |
] ifFalse:[ |
|
2090 |
" |
|
2091 |
if there is no sensor ... |
|
2092 |
" |
|
2093 |
aView terminate |
|
2094 |
] |
|
2095 |
! |
|
2096 |
||
2097 |
unmappedView:aView |
|
2098 |
"forward an unmapped event for some view" |
|
2099 |
||
2100 |
|sensor| |
|
2101 |
||
2102 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2103 |
sensor unmappedView:aView |
|
2104 |
] ifFalse:[ |
|
2105 |
" |
|
2106 |
if there is no sensor ... |
|
2107 |
" |
|
2108 |
aView unmapped |
|
2109 |
] |
|
2110 |
! ! |
|
2111 |
||
2112 |
!DeviceWorkstation methodsFor:'event handling'! |
|
2113 |
||
2114 |
checkForEndOfDispatch |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
2115 |
"return true, if there are still any views of interest - |
349
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
2116 |
if not, stop dispatch. |
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
2117 |
This ends the dispatcher process when the last view is closed on that device. |
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
2118 |
We only do this for displays other that the default Display." |
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
2119 |
|
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2120 |
dispatching ifFalse:[^ self]. |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2121 |
|
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2122 |
self == Display ifTrue:[ |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2123 |
ExitOnLastClose ifFalse:[^ self]. |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2124 |
]. |
293 | 2125 |
|
2126 |
knownViews notNil ifTrue:[ |
|
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2127 |
(knownViews findFirst:[:slot | slot notNil and:[slot shown]]) == 0 ifTrue:[ |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
2128 |
"/ my last view was closed |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2129 |
dispatching := false. |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2130 |
'DEVWORKST: finished dispatch (last view closed)' infoPrintNL. |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
2131 |
] |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
2132 |
]. |
293 | 2133 |
|
2134 |
"Modified: 19.9.1995 / 11:31:54 / claus" |
|
2135 |
! |
|
2136 |
||
2137 |
dispatchEvent |
|
2138 |
"get and process the next pending event - for any view" |
|
2139 |
||
2140 |
self dispatchEventFor:nil withMask:nil |
|
2141 |
! |
|
2142 |
||
2143 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
2144 |
"central event handling method: |
|
2145 |
get next event and send an appropriate message to the views sensor, |
|
2146 |
or to the view directly (if the view has none). |
|
2147 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
2148 |
otherwise only events for the view with given id are processed |
|
2149 |
(in this case, nothing is done if no events are pending); |
|
2150 |
if the argument aMask is nonNil, only events for this eventMask are |
|
2151 |
handled. The mask is a device dependent event mask." |
|
2152 |
||
2153 |
^ self subclassResponsibility |
|
2154 |
! |
|
2155 |
||
2156 |
dispatchModalWhile:aBlock |
|
2157 |
"get and process next event for any view as long as the |
|
2158 |
argument-block evaluates to true. |
|
2159 |
This is a modal loop, not switching to other processes, |
|
2160 |
effectively polling the device in a (nice) busy loop. |
|
2161 |
This should only be (and is only) used for emergency cases. |
|
2162 |
(such as a graphical debugger, debugging the event-dispatcher itself)" |
|
2163 |
||
2164 |
|myFd| |
|
2165 |
||
2166 |
" |
|
2167 |
if this display has a fileDescriptor to wait on, |
|
2168 |
it is used; otherwise we poll (with a delay to not lock up |
|
2169 |
the workstation) |
|
2170 |
" |
|
2171 |
myFd := self displayFileDescriptor. |
|
2172 |
[aBlock value] whileTrue:[ |
|
2173 |
self eventPending ifFalse:[ |
|
2174 |
myFd isNil ifTrue:[ |
|
2175 |
OperatingSystem millisecondDelay:50 |
|
2176 |
] ifFalse:[ |
|
2177 |
OperatingSystem selectOn:myFd withTimeOut:50. |
|
2178 |
]. |
|
2179 |
Processor evaluateTimeouts. |
|
2180 |
]. |
|
2181 |
self eventPending ifTrue:[ |
|
2182 |
self dispatchEvent |
|
2183 |
]. |
|
2184 |
] |
|
2185 |
! |
|
2186 |
||
2187 |
dispatchPendingEvents |
|
405 | 2188 |
"go dispatch events as long as there is one. |
2189 |
This is only used with modal operation. |
|
2190 |
(i.e. when in the modal debugger)" |
|
293 | 2191 |
|
2192 |
[self eventPending] whileTrue:[ |
|
2193 |
self dispatchEventFor:nil withMask:nil |
|
2194 |
] |
|
2195 |
! |
|
2196 |
||
2197 |
disposeButtonEventsFor:aViewIdOrNil |
|
2198 |
"dispose (i.e. forget) all pending button events on this display" |
|
2199 |
||
2200 |
|mask| |
|
2201 |
||
2202 |
mask := self eventMaskFor:#buttonPress. |
|
2203 |
mask := mask bitOr:(self eventMaskFor:#buttonRelease). |
|
2204 |
mask := mask bitOr:(self eventMaskFor:#buttonMotion). |
|
2205 |
self disposeEventsWithMask:mask for:aViewIdOrNil |
|
2206 |
! |
|
2207 |
||
2208 |
disposeEvents |
|
2209 |
"dispose (i.e. forget) all events pending on this display" |
|
2210 |
||
2211 |
[self eventPending] whileTrue:[ |
|
2212 |
self getEventFor:nil withMask:nil |
|
2213 |
]. |
|
2214 |
! |
|
2215 |
||
2216 |
disposeEventsWithMask:aMask for:aWindowId |
|
2217 |
"dispose (throw away) specific events" |
|
2218 |
||
2219 |
^ self subclassResponsibility |
|
2220 |
! |
|
2221 |
||
2222 |
eventMaskFor:anEventSymbol |
|
2223 |
^ self subclassResponsibility |
|
2224 |
! |
|
2225 |
||
2226 |
eventPending |
|
2227 |
"return true, if any event is pending" |
|
2228 |
||
2229 |
^ self subclassResponsibility |
|
2230 |
! |
|
2231 |
||
2232 |
eventPending:anEventSymbol for:aWindowId |
|
2233 |
"return true, if a specific event is pending for a specific window. |
|
2234 |
This expects device independent event symbols (such as #buttonPress, |
|
2235 |
#buttonRelease etc.) as first argument." |
|
2236 |
||
2237 |
^ self subclassResponsibility |
|
2238 |
! |
|
2239 |
||
405 | 2240 |
eventPendingWithSync:doSync |
293 | 2241 |
"return true, if any event is pending" |
2242 |
||
2243 |
^ self subclassResponsibility |
|
2244 |
! |
|
2245 |
||
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2246 |
eventQueued |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2247 |
"return true, if any event is pending in some internal queue. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2248 |
The fallBack here returns true if events are pending on the display connection; |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2249 |
only devices which use internal queues (i.e. Xlib) need to redefine this." |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2250 |
|
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2251 |
^ self eventPending |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2252 |
! |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2253 |
|
405 | 2254 |
eventsPending:anEventMask for:aWindowId withSync:doSync |
293 | 2255 |
"return true, if any of the masked events is pending |
2256 |
for a specific window. |
|
2257 |
This expects a device dependent event mask as first argument." |
|
2258 |
||
2259 |
^ self subclassResponsibility |
|
2260 |
! |
|
2261 |
||
2262 |
setEventMask:aMask in:aWindowId |
|
310 | 2263 |
"arrange that only events from aMask are reported to a view. |
2264 |
Highly device specific, to be defined in concrete subclasses" |
|
2265 |
||
293 | 2266 |
^ self subclassResponsibility |
2267 |
! |
|
2268 |
||
2269 |
startDispatch |
|
2270 |
"create the display dispatch process." |
|
2271 |
||
2272 |
|inputSema fd p nm| |
|
2273 |
||
2274 |
" |
|
2275 |
only allow one dispatcher process per display |
|
2276 |
" |
|
2277 |
dispatching ifTrue:[^ self]. |
|
2278 |
dispatching := true. |
|
2279 |
||
2280 |
AllScreens isNil ifTrue:[ |
|
2281 |
AllScreens := Set new:1 |
|
2282 |
]. |
|
2283 |
AllScreens add:self. |
|
2284 |
||
2285 |
" |
|
2286 |
The code below (still) handles the situation where ST/X was built |
|
2287 |
without lightweight process support. Since there are many other places |
|
2288 |
in the system whic depend on lightweight processes to function, this |
|
2289 |
may be a stupid thing to do ... expect it to vanish sooner or later. |
|
2290 |
" |
|
2291 |
||
2292 |
fd := self displayFileDescriptor. |
|
2293 |
||
2294 |
ProcessorScheduler isPureEventDriven ifTrue:[ |
|
2295 |
" |
|
2296 |
no threads built in; |
|
2297 |
handle all events by having processor call a block when something |
|
2298 |
arrives on my filedescriptor. Dispatch the event in that block. |
|
2299 |
" |
|
2300 |
Processor enableIOAction:[ |
|
2301 |
dispatching ifTrue:[ |
|
2302 |
[self eventPending] whileTrue:[ |
|
2303 |
self dispatchPendingEvents. |
|
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
2304 |
"/ self checkForEndOfDispatch. |
293 | 2305 |
]. |
2306 |
dispatching ifFalse:[ |
|
2307 |
Processor disableFd:fd. |
|
2308 |
AllScreens remove:self. |
|
2309 |
] |
|
2310 |
] |
|
2311 |
] |
|
2312 |
onInput:fd |
|
2313 |
||
2314 |
] ifFalse:[ |
|
2315 |
" |
|
2316 |
handle stuff as a process - sitting on a semaphore. |
|
2317 |
Tell Processor to trigger this semaphore when something arrives |
|
2318 |
on my filedescriptor. Since a select alone is not enough to |
|
2319 |
know if events are pending (Xlib reads out event-queue while |
|
2320 |
doing output), we also have to install a poll-check block. |
|
2321 |
" |
|
2322 |
inputSema := Semaphore new. |
|
2323 |
p := [ |
|
2324 |
[dispatching] whileTrue:[ |
|
2325 |
AbortSignal handle:[:ex | |
|
2326 |
ex return |
|
2327 |
] do:[ |
|
2328 |
self eventPending ifFalse:[ |
|
2329 |
Processor activeProcess setStateTo:#ioWait if:#active. |
|
2330 |
inputSema wait. |
|
2331 |
]. |
|
2332 |
||
2333 |
self dispatchPendingEvents. |
|
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
2334 |
"/ self checkForEndOfDispatch. |
293 | 2335 |
] |
2336 |
]. |
|
2337 |
Processor disableSemaphore:inputSema. |
|
2338 |
inputSema := nil. |
|
2339 |
AllScreens remove:self. |
|
2340 |
dispatchProcess := nil |
|
2341 |
] forkAt:(Processor userInterruptPriority). |
|
2342 |
" |
|
2343 |
give the process a nice name (for the processMonitor) |
|
2344 |
" |
|
2345 |
(nm := self displayName) notNil ifTrue:[ |
|
2346 |
nm := 'event dispatcher (' , nm , ')'. |
|
2347 |
] ifFalse:[ |
|
2348 |
nm := 'event dispatcher'. |
|
2349 |
]. |
|
2350 |
p name:nm. |
|
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
349
diff
changeset
|
2351 |
Processor signal:inputSema onInput:fd orCheck:[self eventPending]. |
293 | 2352 |
dispatchProcess := p. |
2353 |
] |
|
310 | 2354 |
|
2355 |
"Modified: 12.12.1995 / 20:52:57 / stefan" |
|
293 | 2356 |
! ! |
2357 |
||
2358 |
!DeviceWorkstation methodsFor:'font stuff'! |
|
2359 |
||
2360 |
ascentOf:aFontId |
|
2361 |
"return the number of pixels above the base line of a font" |
|
2362 |
||
2363 |
^ self subclassResponsibility |
|
2364 |
! |
|
2365 |
||
2366 |
descentOf:aFontId |
|
2367 |
"return the number of pixels below the base line of a font" |
|
2368 |
||
2369 |
^ self subclassResponsibility |
|
2370 |
! |
|
2371 |
||
439
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2372 |
encodingOf:aFontId |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2373 |
"return the characterEncoding of a font. |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2374 |
Here, we assume an ISO8859 (=ANSI) encoding" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2375 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2376 |
^ 'ISO8859-1' |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2377 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2378 |
"Created: 23.2.1996 / 00:39:06 / cg" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2379 |
! |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2380 |
|
293 | 2381 |
facesInFamily:aFamilyName |
2382 |
"return a set of all available font faces in aFamily on this display" |
|
2383 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2384 |
^ self facesInFamily:aFamilyName filtering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2385 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2386 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2387 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2388 |
Display facesInFamily:'times' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2389 |
Display facesInFamily:'fixed' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2390 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2391 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2392 |
"Modified: 27.2.1996 / 01:33:47 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2393 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2394 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2395 |
facesInFamily:aFamilyName filtering:filterBlock |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2396 |
"return a set of all available font faces in aFamily on this display. |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2397 |
But only those matching filterBlock (if nonNil)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2398 |
|
293 | 2399 |
|allFonts faces "family face"| |
2400 |
||
2401 |
allFonts := self listOfAvailableFonts. |
|
2402 |
allFonts isNil ifTrue:[^ nil]. |
|
2403 |
||
2404 |
faces := Set new. |
|
2405 |
allFonts do:[:fntDescr | |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2406 |
aFamilyName = fntDescr family ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2407 |
(filterBlock isNil or:[filterBlock value:fntDescr]) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2408 |
faces add:(fntDescr face) |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2409 |
] |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2410 |
] |
293 | 2411 |
]. |
2412 |
^ faces asSortedCollection |
|
2413 |
||
2414 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2415 |
Display facesInFamily:'fixed' filtering:[:f | |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2416 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 2417 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2418 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2419 |
"Created: 27.2.1996 / 01:33:25 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2420 |
"Modified: 27.2.1996 / 01:34:11 / cg" |
293 | 2421 |
! |
2422 |
||
2423 |
fontFamilies |
|
2424 |
"return a set of all available font families on this display" |
|
2425 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2426 |
^ self fontFamiliesFiltering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2427 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2428 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2429 |
Display fontFamilies |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2430 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2431 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2432 |
"Modified: 27.2.1996 / 01:31:14 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2433 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2434 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2435 |
fontFamiliesFiltering:aFilterBlock |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2436 |
"return a set of all available font families on this display, |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2437 |
but only those matching aFilterBlock (if nonNil)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2438 |
|
293 | 2439 |
|allFonts families family| |
2440 |
||
2441 |
allFonts := self listOfAvailableFonts. |
|
2442 |
allFonts isNil ifTrue:[^ nil]. |
|
2443 |
families := Set new. |
|
2444 |
allFonts do:[:fntDescr | |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2445 |
(aFilterBlock isNil or:[aFilterBlock value:fntDescr]) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2446 |
family := fntDescr family. |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2447 |
family notNil ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2448 |
families add:family |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2449 |
] |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2450 |
] |
293 | 2451 |
]. |
2452 |
^ families asSortedCollection |
|
2453 |
||
2454 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2455 |
Display fontFamiliesFiltering:[:f | |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2456 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 2457 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2458 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2459 |
"Modified: 27.2.1996 / 01:31:48 / cg" |
293 | 2460 |
! |
2461 |
||
439
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2462 |
fullNameOf:aFontId |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2463 |
"return the full name of a font. |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2464 |
Here, we return nil, not knowing anything about fonts" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2465 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2466 |
^ nil |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2467 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2468 |
"Created: 23.2.1996 / 00:43:19 / cg" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2469 |
! |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
2470 |
|
293 | 2471 |
getDefaultFont |
2472 |
"return a default font id |
|
2473 |
- used when class Font cannot find anything usable" |
|
2474 |
||
2475 |
^ self subclassResponsibility |
|
2476 |
! |
|
2477 |
||
2478 |
getFontWithFamily:familyString |
|
2479 |
face:faceString |
|
2480 |
style:styleString |
|
2481 |
size:sizeArg |
|
2482 |
encoding:encodingSym |
|
2483 |
||
2484 |
"try to get the specified font, return id. |
|
2485 |
If not available, try next smaller font. |
|
2486 |
If no font fits, return nil" |
|
2487 |
||
2488 |
^ self subclassResponsibility |
|
2489 |
! |
|
2490 |
||
2491 |
listOfAvailableFonts |
|
2492 |
"return a list containing all fonts on this display. |
|
2493 |
The returned list is an array of 4-element arrays, each |
|
2494 |
containing family, face, style, size and encoding." |
|
2495 |
||
2496 |
self subclassResponsibility |
|
2497 |
! |
|
2498 |
||
2499 |
maxWidthOfFont:aFontId |
|
2500 |
"return the width in pixels of the widest character a specific font" |
|
2501 |
||
2502 |
^ self subclassResponsibility |
|
2503 |
! |
|
2504 |
||
2505 |
minWidthOfFont:aFontId |
|
2506 |
"return the width in pixels of the smallest character a specific font" |
|
2507 |
||
2508 |
^ self subclassResponsibility |
|
2509 |
! |
|
2510 |
||
2511 |
releaseFont:aFontId |
|
2512 |
"free a font" |
|
2513 |
||
2514 |
^ self subclassResponsibility |
|
2515 |
! |
|
2516 |
||
2517 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName |
|
2518 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
|
2519 |
on this display" |
|
2520 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2521 |
^ self sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2522 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2523 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2524 |
Display sizesInFamily:'times' face:'medium' style:'italic' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2525 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2526 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2527 |
"Modified: 27.2.1996 / 01:38:42 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2528 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2529 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2530 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2531 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2532 |
on this display. |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2533 |
But only those matching filter (if nonNIl)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2534 |
|
293 | 2535 |
|allFonts sizes "family face style size"| |
2536 |
||
2537 |
allFonts := self listOfAvailableFonts. |
|
2538 |
allFonts isNil ifTrue:[^ nil]. |
|
2539 |
||
2540 |
sizes := Set new. |
|
2541 |
allFonts do:[:fntDescr | |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2542 |
(aFamilyName = fntDescr family) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2543 |
(aFaceName = fntDescr face) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2544 |
(aStyleName = fntDescr style) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2545 |
(filter isNil or:[filter value:fntDescr]) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2546 |
sizes add:fntDescr size |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2547 |
] |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2548 |
] |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2549 |
] |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2550 |
] |
293 | 2551 |
]. |
2552 |
^ sizes |
|
2553 |
||
2554 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2555 |
Display sizesInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2556 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 2557 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2558 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2559 |
"Created: 27.2.1996 / 01:37:56 / cg" |
293 | 2560 |
! |
2561 |
||
2562 |
stylesInFamily:aFamilyName face:aFaceName |
|
2563 |
"return a set of all available font styles in aFamily/aFace on this display" |
|
2564 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2565 |
^ self stylesInFamily:aFamilyName face:aFaceName filtering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2566 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2567 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2568 |
Display stylesInFamily:'times' face:'medium' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2569 |
Display stylesInFamily:'times' face:'bold' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2570 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2571 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2572 |
"Modified: 27.2.1996 / 01:35:43 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2573 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2574 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2575 |
stylesInFamily:aFamilyName face:aFaceName filtering:filter |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2576 |
"return a set of all available font styles in aFamily/aFace on this display. |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2577 |
But only thise matching filter (if nonNil)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2578 |
|
293 | 2579 |
|allFonts styles "family face style"| |
2580 |
||
2581 |
allFonts := self listOfAvailableFonts. |
|
2582 |
allFonts isNil ifTrue:[^ nil]. |
|
2583 |
||
2584 |
styles := Set new. |
|
2585 |
allFonts do:[:fntDescr | |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2586 |
(aFamilyName = fntDescr family) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2587 |
(aFaceName = fntDescr face) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2588 |
(filter isNil or:[filter value:fntDescr]) ifTrue:[ |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2589 |
styles add:fntDescr style |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2590 |
] |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2591 |
] |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2592 |
] |
293 | 2593 |
]. |
2594 |
^ styles asSortedCollection |
|
2595 |
||
2596 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2597 |
Display stylesInFamily:'fixed' face:'medium' filtering:[:f | |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2598 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 2599 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2600 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
2601 |
"Created: 27.2.1996 / 01:35:22 / cg" |
293 | 2602 |
! |
2603 |
||
2604 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
|
2605 |
"return the width in pixels of a substring in a specific font" |
|
2606 |
||
2607 |
^ self subclassResponsibility |
|
2608 |
! |
|
2609 |
||
2610 |
widthOf:aString inFont:aFontId |
|
2611 |
"return the width in pixels of a string in a specific font" |
|
2612 |
||
2613 |
^ self subclassResponsibility |
|
2614 |
! ! |
|
2615 |
||
2616 |
!DeviceWorkstation methodsFor:'grabbing '! |
|
2617 |
||
2618 |
activeKeyboardGrab |
|
2619 |
"return the view, which currently has the keyboard grabbed, |
|
2620 |
or nil, if there is none" |
|
2621 |
||
2622 |
^ activeKeyboardGrab |
|
2623 |
! |
|
2624 |
||
2625 |
activePointerGrab |
|
2626 |
"return the view, which currently has the pointer grabbed, |
|
2627 |
or nil, if there is none" |
|
2628 |
||
2629 |
^ activePointerGrab |
|
2630 |
! |
|
2631 |
||
2632 |
grabKeyboardIn:aWindowId |
|
2633 |
"grab the keyboard - all keyboard input will be sent to the view |
|
2634 |
with id aWindowId" |
|
2635 |
||
2636 |
^ self subclassResponsibility |
|
2637 |
! |
|
2638 |
||
2639 |
grabKeyboardInView:aView |
|
2640 |
"grab the keyboard - all keyboard input will be sent to aView. |
|
2641 |
Return true if ok, false if it failed for some reason." |
|
2642 |
||
2643 |
activeKeyboardGrab notNil ifTrue:[ |
|
2644 |
self ungrabKeyboard. |
|
2645 |
activeKeyboardGrab := nil |
|
2646 |
]. |
|
2647 |
(self grabKeyboardIn:(aView id)) ifTrue:[ |
|
2648 |
activeKeyboardGrab := aView. |
|
2649 |
^ true |
|
2650 |
]. |
|
2651 |
^ false |
|
2652 |
! |
|
2653 |
||
2654 |
grabPointerIn:aWindowId |
|
2655 |
"grap the pointer; all pointer events will be reported to the view |
|
2656 |
with id aWindowId. Return true if ok, false if it failed for some reason." |
|
2657 |
||
2658 |
^ self grabPointerIn:aWindowId withCursor:nil pointerMode:#async keyboardMode:#sync confineTo:nil |
|
2659 |
! |
|
2660 |
||
2661 |
grabPointerIn:aWindowId withCursor:cursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
|
2662 |
"grap the pointer - all pointer events will be reported to aWindowId. The cursor will be set to cursorId |
|
2663 |
for the duration of the grab. For pMode/kMode, see X documentation. The pointer is restricted to |
|
2664 |
confineId - if non-nil." |
|
2665 |
||
2666 |
^ self subclassResponsibility |
|
2667 |
! |
|
2668 |
||
2669 |
grabPointerInView:aView |
|
2670 |
"grap the pointer; all pointer events will be reported to |
|
2671 |
aView. Return true if ok, false if it failed for some reason." |
|
2672 |
||
2673 |
activePointerGrab notNil ifTrue:[ |
|
2674 |
self ungrabPointer. |
|
2675 |
activePointerGrab := nil |
|
2676 |
]. |
|
2677 |
(self grabPointerIn:(aView id)) ifTrue:[ |
|
2678 |
activePointerGrab := aView. |
|
2679 |
^ true |
|
2680 |
]. |
|
2681 |
^ false |
|
2682 |
! |
|
2683 |
||
2684 |
setActivePointerGrab:aView |
|
2685 |
"DO NOT USE. private kludge - will vanish" |
|
2686 |
||
2687 |
activePointerGrab := aView |
|
2688 |
! |
|
2689 |
||
2690 |
ungrabKeyboard |
|
2691 |
"release the keyboard" |
|
2692 |
||
2693 |
^ self subclassResponsibility |
|
2694 |
! |
|
2695 |
||
2696 |
ungrabPointer |
|
2697 |
"release the pointer" |
|
2698 |
||
2699 |
^ self subclassResponsibility |
|
2700 |
! ! |
|
2701 |
||
2702 |
!DeviceWorkstation methodsFor:'graphic context stuff'! |
|
2703 |
||
2704 |
noClipIn:aGCId |
|
2705 |
"disable clipping rectangle" |
|
2706 |
||
2707 |
^ self subclassResponsibility |
|
2708 |
! |
|
2709 |
||
2710 |
setBackground:bgColorIndex in:aGCId |
|
2711 |
"set background color to be drawn with" |
|
2712 |
||
2713 |
^ self subclassResponsibility |
|
2714 |
! |
|
2715 |
||
2716 |
setBitmapMask:aBitmapId in:aGCId |
|
2717 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
|
2718 |
||
2719 |
^ self subclassResponsibility |
|
2720 |
! |
|
2721 |
||
2722 |
setClipByChildren:aBool in:aGCId |
|
2723 |
"enable/disable drawing into child views" |
|
2724 |
||
2725 |
^ self subclassResponsibility |
|
2726 |
! |
|
2727 |
||
2728 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:aGCId |
|
2729 |
"clip to a rectangle" |
|
2730 |
||
2731 |
^ self subclassResponsibility |
|
2732 |
! |
|
2733 |
||
2734 |
setFont:aFontId in:aGCId |
|
2735 |
"set font to be drawn in" |
|
2736 |
||
2737 |
^ self subclassResponsibility |
|
2738 |
! |
|
2739 |
||
2740 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
|
2741 |
"set foreground and background colors to be drawn with" |
|
2742 |
||
2743 |
^ self subclassResponsibility |
|
2744 |
! |
|
2745 |
||
2746 |
setForeground:fgColor background:bgColor mask:aBitmapId in:aGCId |
|
2747 |
"set foreground and background colors to be drawn with using mask or |
|
2748 |
solid (if aBitmapId is nil)" |
|
2749 |
||
2750 |
^ self subclassResponsibility |
|
2751 |
! |
|
2752 |
||
2753 |
setForeground:fgColor background:bgColor mask:aBitmapId lineWidth:lw in:aGCId |
|
2754 |
"set foreground and background colors to be drawn with using mask or |
|
2755 |
solid (if aBitmapId is nil); also set lineWidth" |
|
2756 |
||
2757 |
^ self subclassResponsibility |
|
2758 |
! |
|
2759 |
||
2760 |
setForeground:fgColorIndex in:aGCId |
|
2761 |
"set foreground color to be drawn with" |
|
2762 |
||
2763 |
^ self subclassResponsibility |
|
2764 |
! |
|
2765 |
||
2766 |
setFunction:aFunctionSymbol in:aGCId |
|
2767 |
"set alu function to be drawn with" |
|
2768 |
||
2769 |
^ self subclassResponsibility |
|
2770 |
! |
|
2771 |
||
2772 |
setGraphicsExposures:aBoolean in:aGCId |
|
2773 |
"set or clear the graphics exposures flag" |
|
2774 |
||
2775 |
^ self subclassResponsibility |
|
2776 |
! |
|
2777 |
||
2778 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
|
2779 |
"set line attributes" |
|
2780 |
||
2781 |
^ self subclassResponsibility |
|
2782 |
! |
|
2783 |
||
2784 |
setMaskOriginX:orgX y:orgY in:aGCid |
|
2785 |
"set the mask origin" |
|
2786 |
||
2787 |
^ self subclassResponsibility |
|
2788 |
! |
|
2789 |
||
2790 |
setPixmapMask:aPixmapId in:aGCId |
|
2791 |
"set or clear the drawing mask - a pixmap mask providing full color" |
|
2792 |
||
2793 |
^ self subclassResponsibility |
|
2794 |
! ! |
|
2795 |
||
0 | 2796 |
!DeviceWorkstation methodsFor:'initialize / release'! |
2797 |
||
293 | 2798 |
close |
2799 |
"close down connection to Display - usually never done" |
|
2800 |
||
2801 |
^ self subclassResponsibility |
|
2802 |
! |
|
2803 |
||
0 | 2804 |
initialize |
2805 |
"initialize the receiver for a connection to the default display" |
|
2806 |
||
2807 |
^ self initializeFor:nil |
|
2808 |
! |
|
2809 |
||
2810 |
initializeFor:aDisplayOrNilForAny |
|
2811 |
"initialize the receiver for a connection to a display. If the |
|
2812 |
argument is non-nil, it should specify which workstation should be |
|
2813 |
connected to (in a device specific manner). For X displays, this is |
|
2814 |
to be the display-string i.e. hostname:displayNr. |
|
2815 |
If the argument is nil, connect to the default display." |
|
2816 |
||
71 | 2817 |
^ self subclassResponsibility |
0 | 2818 |
! |
2819 |
||
293 | 2820 |
initializeKeyboardMap |
2821 |
"keystrokes from the server are translated via the keyboard map. |
|
2822 |
Untranslated keystrokes arrive either as characters, or symbols |
|
2823 |
(which are the keySyms as symbol). The mapping table which is |
|
2824 |
setup here, is used in sendKeyPress:... later. |
|
2825 |
" |
|
2826 |
||
2827 |
keyboardMap isNil ifTrue:[ |
|
2828 |
keyboardMap := KeyboardMap new. |
|
2829 |
]. |
|
2830 |
||
2831 |
" |
|
2832 |
no more setup here - moved everything out into 'display.rc' file |
|
2833 |
" |
|
0 | 2834 |
! |
2835 |
||
276
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
2836 |
invalidateConnection |
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
2837 |
displayId := nil |
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
2838 |
! |
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
2839 |
|
0 | 2840 |
reinitialize |
2841 |
"reinit after snapin" |
|
2842 |
||
46 | 2843 |
|prevKnownViews prevMapping| |
0 | 2844 |
|
414
bf996c417cc8
flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents:
405
diff
changeset
|
2845 |
Font flushDeviceFontsFor:self. |
bf996c417cc8
flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents:
405
diff
changeset
|
2846 |
|
0 | 2847 |
displayId := nil. |
51 | 2848 |
dispatching := false. |
151 | 2849 |
dispatchProcess := nil. |
46 | 2850 |
|
2851 |
"/ prevMapping := idToViewMapping. |
|
2852 |
"/ idToViewMapping := nil. |
|
2853 |
||
0 | 2854 |
prevKnownViews := knownViews. |
2855 |
knownViews := nil. |
|
2856 |
knownIds := nil. |
|
2857 |
||
2858 |
self initializeFor:nil. |
|
2859 |
||
43 | 2860 |
" |
2861 |
first, all Forms must be recreated |
|
51 | 2862 |
(since they may be needed for view recreation as |
43 | 2863 |
background or icons) |
2864 |
" |
|
0 | 2865 |
Form reinitializeAllOn:self. |
2866 |
||
46 | 2867 |
"/ prevMapping notNil ifTrue:[ |
0 | 2868 |
prevKnownViews notNil ifTrue:[ |
71 | 2869 |
" |
2870 |
first round: flush all device specific stuff |
|
2871 |
" |
|
51 | 2872 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
71 | 2873 |
prevKnownViews do:[:aView | |
2874 |
aView notNil ifTrue:[ |
|
2875 |
aView prepareForReinit |
|
2876 |
] |
|
2877 |
]. |
|
2878 |
||
2879 |
" |
|
2880 |
2nd round: all views should reinstall themself |
|
2881 |
on the new display |
|
2882 |
" |
|
51 | 2883 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
71 | 2884 |
prevKnownViews do:[:aView | |
2885 |
aView notNil ifTrue:[ |
|
2886 |
"have to re-create the view" |
|
414
bf996c417cc8
flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents:
405
diff
changeset
|
2887 |
AbortSignal catch:[ |
bf996c417cc8
flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents:
405
diff
changeset
|
2888 |
aView reinitialize |
bf996c417cc8
flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents:
405
diff
changeset
|
2889 |
] |
71 | 2890 |
] |
2891 |
]. |
|
2892 |
" |
|
2893 |
3rd round: all views get a chance to handle |
|
2894 |
changed environment (colors, font sizes etc) |
|
2895 |
" |
|
51 | 2896 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
71 | 2897 |
prevKnownViews do:[:aView | |
2898 |
aView notNil ifTrue:[ |
|
2899 |
aView reAdjustGeometry |
|
2900 |
] |
|
2901 |
] |
|
0 | 2902 |
]. |
8 | 2903 |
dispatching := false. |
133 | 2904 |
! ! |
2905 |
||
71 | 2906 |
!DeviceWorkstation methodsFor:'interactive queries'! |
2907 |
||
293 | 2908 |
originFromUser:extent |
2909 |
"let user specify a rectangles origin on the screen, return the rectangle. |
|
2910 |
Start with initialRectangle. |
|
2911 |
Can be used for dragging operations." |
|
2912 |
||
2913 |
|curs origin root rect| |
|
2914 |
||
2915 |
curs := Cursor origin on:self. |
|
2916 |
||
2917 |
" |
|
2918 |
just in case; wait for button to be down ... |
|
2919 |
" |
|
2920 |
[self leftButtonPressed] whileFalse:[Processor yield]. |
|
2921 |
||
2922 |
root := self rootView. |
|
2923 |
||
2924 |
" |
|
2925 |
grab and wait for leftButton being pressed |
|
2926 |
" |
|
2927 |
origin := self pointerPosition. |
|
2928 |
||
2929 |
root noClipByChildren. |
|
2930 |
root foreground:Color black background:Color white. |
|
2931 |
||
2932 |
root xoring:[ |
|
2933 |
|left right top bottom newOrigin newCorner p| |
|
2934 |
||
2935 |
rect := origin extent:extent. |
|
2936 |
root displayRectangle:rect. |
|
2937 |
||
2938 |
self |
|
2939 |
grabPointerIn:root id |
|
2940 |
withCursor:curs id |
|
2941 |
pointerMode:#async |
|
2942 |
keyboardMode:#sync |
|
2943 |
confineTo:nil. |
|
2944 |
||
2945 |
[self leftButtonPressed] whileTrue:[ |
|
2946 |
newOrigin := self pointerPosition. |
|
2947 |
||
2948 |
(newOrigin ~= origin) ifTrue:[ |
|
2949 |
root displayRectangle:rect. |
|
2950 |
||
2951 |
self |
|
2952 |
grabPointerIn:root id |
|
2953 |
withCursor:curs id |
|
2954 |
pointerMode:#async |
|
2955 |
keyboardMode:#sync |
|
2956 |
confineTo:nil. |
|
2957 |
||
2958 |
rect := newOrigin extent:extent. |
|
2959 |
root displayRectangle:rect. |
|
2960 |
self disposeButtonEventsFor:nil. |
|
2961 |
self flush. |
|
2962 |
origin := newOrigin. |
|
2963 |
] ifFalse:[ |
|
2964 |
Processor yield |
|
2965 |
] |
|
2966 |
]. |
|
2967 |
root displayRectangle:rect. |
|
2968 |
self ungrabPointer. |
|
2969 |
]. |
|
2970 |
||
2971 |
self ungrabPointer. |
|
2972 |
||
2973 |
"flush all events pending on my display" |
|
2974 |
||
2975 |
root clipByChildren. |
|
2976 |
||
2977 |
self flush. |
|
2978 |
self disposeButtonEventsFor:nil. |
|
2979 |
||
2980 |
^ rect |
|
2981 |
||
2982 |
" |
|
2983 |
Display originFromUser:200@200 |
|
2984 |
" |
|
2985 |
! |
|
2986 |
||
2987 |
pointFromUser |
|
2988 |
"let user specify a point on the screen (by pressing the left button)" |
|
2989 |
||
2990 |
^ self pointFromUserShowing:(Cursor crossHair). |
|
2991 |
||
2992 |
" |
|
2993 |
Display pointFromUser |
|
2994 |
" |
|
2995 |
! |
|
2996 |
||
81 | 2997 |
pointFromUserShowing:aCursor |
2998 |
"let user specify a point on the screen (by pressing leftButton). |
|
2999 |
Show aCursor while waiting." |
|
3000 |
||
3001 |
|p| |
|
23 | 3002 |
|
3003 |
self ungrabPointer. |
|
151 | 3004 |
self grabPointerIn:(self rootWindowId) withCursor:((aCursor on:self) id) |
75 | 3005 |
pointerMode:#async keyboardMode:#sync confineTo:nil. |
134 | 3006 |
activePointerGrab := rootView. |
81 | 3007 |
|
157 | 3008 |
" |
3009 |
wait for leftButton ... |
|
3010 |
" |
|
81 | 3011 |
[self leftButtonPressed] whileFalse:[Processor yield]. |
157 | 3012 |
|
23 | 3013 |
p := self pointerPosition. |
3014 |
||
3015 |
self ungrabPointer. |
|
3016 |
||
3017 |
"flush all events pending on myself" |
|
81 | 3018 |
self disposeButtonEventsFor:nil. |
23 | 3019 |
^ p |
3020 |
||
71 | 3021 |
" |
81 | 3022 |
Display pointFromUserShowing:(Cursor stop) |
133 | 3023 |
Display pointFromUserShowing:(Cursor crossHair) |
157 | 3024 |
Display pointFromUserShowing:(Cursor origin) |
81 | 3025 |
Display pointFromUser |
3026 |
" |
|
3027 |
! |
|
3028 |
||
293 | 3029 |
rectangleFromUser |
3030 |
"let user specify a rectangle in the screen, return the rectangle" |
|
3031 |
||
3032 |
|origin| |
|
81 | 3033 |
|
3034 |
" |
|
293 | 3035 |
get origin |
3036 |
" |
|
3037 |
origin := self pointFromUserShowing:(Cursor origin on:self). |
|
3038 |
||
3039 |
" |
|
3040 |
get corner |
|
3041 |
" |
|
3042 |
^ self rectangleFromUser:(origin corner:origin). |
|
3043 |
||
3044 |
" |
|
3045 |
Display rectangleFromUser |
|
71 | 3046 |
" |
23 | 3047 |
! |
3048 |
||
81 | 3049 |
rectangleFromUser:initialRectangle |
3050 |
"let user specify a rectangle on the screen, return the rectangle. |
|
133 | 3051 |
Start with initialRectangle. |
3052 |
A helper for rectangleFromUser; can also be used for resizing operations." |
|
81 | 3053 |
|
157 | 3054 |
|curs1 origin corner root rect| |
3055 |
||
3056 |
curs1 := Cursor corner on:self. |
|
23 | 3057 |
|
134 | 3058 |
root := self rootView. |
81 | 3059 |
|
3060 |
" |
|
3061 |
grab and wait for leftButton being pressed |
|
3062 |
" |
|
3063 |
origin := initialRectangle origin. |
|
3064 |
||
3065 |
root noClipByChildren. |
|
3066 |
root foreground:Color black background:Color white. |
|
3067 |
||
3068 |
root xoring:[ |
|
3069 |
|left right top bottom newOrigin newCorner p curs| |
|
3070 |
||
71 | 3071 |
corner := origin. |
81 | 3072 |
rect := origin corner:corner. |
3073 |
root displayRectangle:rect. |
|
3074 |
||
157 | 3075 |
self |
3076 |
grabPointerIn:root id |
|
3077 |
withCursor:curs1 id |
|
3078 |
pointerMode:#async |
|
3079 |
keyboardMode:#sync |
|
3080 |
confineTo:nil. |
|
3081 |
||
3082 |
" |
|
3083 |
just in case; wait for button to be down ... |
|
3084 |
" |
|
3085 |
[self leftButtonPressed] whileFalse:[Processor yield]. |
|
81 | 3086 |
|
71 | 3087 |
[self leftButtonPressed] whileTrue:[ |
81 | 3088 |
left := initialRectangle origin x. |
3089 |
top := initialRectangle origin y. |
|
3090 |
right := initialRectangle corner x. |
|
3091 |
bottom := initialRectangle corner y. |
|
3092 |
||
3093 |
p := self pointerPosition. |
|
3094 |
p x < initialRectangle left ifTrue:[ |
|
3095 |
p y < initialRectangle top ifTrue:[ |
|
3096 |
curs := Cursor topLeft. |
|
3097 |
left := p x. |
|
3098 |
top := p y. |
|
3099 |
] ifFalse:[ |
|
3100 |
curs := Cursor bottomLeft. |
|
3101 |
left := p x. |
|
3102 |
bottom := p y |
|
3103 |
] |
|
3104 |
] ifFalse:[ |
|
3105 |
p y < initialRectangle top ifTrue:[ |
|
3106 |
curs := Cursor topRight. |
|
3107 |
right := p x. |
|
3108 |
top := p y |
|
3109 |
] ifFalse:[ |
|
3110 |
curs := Cursor bottomRight. |
|
3111 |
right := p x. |
|
3112 |
bottom := p y |
|
3113 |
] |
|
3114 |
]. |
|
3115 |
||
3116 |
newOrigin := left @ top. |
|
3117 |
newCorner := right @ bottom. |
|
3118 |
||
3119 |
((newOrigin ~= origin) or:[newCorner ~= corner]) ifTrue:[ |
|
3120 |
root displayRectangle:rect. |
|
3121 |
||
3122 |
self grabPointerIn:root id withCursor:curs id |
|
71 | 3123 |
pointerMode:#async keyboardMode:#sync confineTo:nil. |
3124 |
||
81 | 3125 |
origin := newOrigin. |
71 | 3126 |
corner := newCorner. |
81 | 3127 |
rect := origin corner:corner. |
3128 |
root displayRectangle:rect. |
|
3129 |
self disposeButtonEventsFor:nil. |
|
151 | 3130 |
self flush. |
157 | 3131 |
] ifFalse:[ |
3132 |
Processor yield |
|
71 | 3133 |
] |
3134 |
]. |
|
81 | 3135 |
root displayRectangle:rect. |
3136 |
self ungrabPointer. |
|
23 | 3137 |
]. |
3138 |
||
3139 |
self ungrabPointer. |
|
3140 |
||
3141 |
"flush all events pending on my display" |
|
81 | 3142 |
|
3143 |
root clipByChildren. |
|
3144 |
||
151 | 3145 |
self flush. |
81 | 3146 |
self disposeButtonEventsFor:nil. |
3147 |
||
3148 |
^ rect |
|
157 | 3149 |
|
3150 |
" |
|
3151 |
Display rectangleFromUser:(100@100 corner:300@300) |
|
3152 |
" |
|
81 | 3153 |
! |
3154 |
||
293 | 3155 |
topviewFromUser |
3156 |
"let user specify a view on the screen; if the selected view is |
|
3157 |
not an ST/X view, nil is returned. |
|
3158 |
Otherwise, the topview is returned." |
|
3159 |
||
3160 |
|v| |
|
3161 |
||
3162 |
v := self viewFromUser. |
|
3163 |
v notNil ifTrue:[ |
|
3164 |
v := v topView |
|
3165 |
]. |
|
3166 |
^ v |
|
157 | 3167 |
|
3168 |
" |
|
293 | 3169 |
Display topviewFromUser |
157 | 3170 |
" |
190 | 3171 |
! |
3172 |
||
23 | 3173 |
viewFromUser |
3174 |
"let user specify a view on the screen; if the selected view is |
|
133 | 3175 |
not an ST/X view, nil is returned. |
3176 |
This returns the view being clicked in, which is not always a topView. |
|
3177 |
(send topView to the returned view or use topviewFromUser, |
|
3178 |
to get the topview)" |
|
23 | 3179 |
|
71 | 3180 |
^ self viewFromPoint:(self pointFromUser) |
3181 |
||
3182 |
" |
|
133 | 3183 |
Display viewFromUser |
71 | 3184 |
" |
3185 |
" |
|
3186 |
|v| |
|
3187 |
v := Display viewFromUser. |
|
3188 |
v notNil ifTrue:[v topView] ifFalse:[nil] |
|
3189 |
" |
|
3190 |
! |
|
3191 |
||
293 | 3192 |
viewIdFromUser |
3193 |
"let user specify a view on the screen, return its window id. |
|
3194 |
This works even for non smalltalk views. |
|
3195 |
This returns the id of the view being clicked in, |
|
3196 |
which is not always a topView." |
|
3197 |
||
3198 |
^ self viewIdFromPoint:(self pointFromUser) |
|
71 | 3199 |
|
3200 |
" |
|
293 | 3201 |
Display viewIdFromUser |
71 | 3202 |
" |
293 | 3203 |
|
3204 |
"Created: 18.9.1995 / 23:07:20 / claus" |
|
0 | 3205 |
! ! |
3206 |
||
3207 |
!DeviceWorkstation methodsFor:'keyboard mapping'! |
|
3208 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3209 |
altModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3210 |
"Return the set of keys which are treated as Alt-keys. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3211 |
This set is initialized at startup from what the server thinks |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3212 |
are alt-keys." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3213 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3214 |
^ altModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3215 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3216 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3217 |
Display altModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3218 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3219 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3220 |
"Created: 2.1.1996 / 14:57:13 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3221 |
"Modified: 2.1.1996 / 15:01:54 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3222 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3223 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3224 |
altModifiers:arrayOfAltModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3225 |
"Change the set of keys which are treated as Alt-keys." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3226 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3227 |
altModifiers := arrayOfAltModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3228 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3229 |
"Created: 2.1.1996 / 14:58:24 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3230 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3231 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3232 |
metaModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3233 |
"Return the set of keys which are treated as Meta-keys (i.e. Cmd-keys). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3234 |
This set is initialized at startup from what the server thinks |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3235 |
are meta-keys." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3236 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3237 |
^ metaModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3238 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3239 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3240 |
Display metaModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3241 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3242 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3243 |
"Created: 2.1.1996 / 14:57:35 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3244 |
"Modified: 2.1.1996 / 15:02:00 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3245 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3246 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3247 |
metaModifiers:arrayOfMetaModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3248 |
"Change the set of keys which are treated as Meta-keys (i.e. Cmd keys)." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3249 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3250 |
metaModifiers := arrayOfMetaModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3251 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3252 |
"Created: 2.1.1996 / 14:58:41 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3253 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3254 |
|
293 | 3255 |
modifierKeyProcessing:key down:pressed |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3256 |
"internal, private method. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3257 |
Called with every keyPress/keyRelease to update the xxxDown flags." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3258 |
|
293 | 3259 |
(altModifiers notNil and:[altModifiers includes:key]) ifTrue:[ |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3260 |
altDown := pressed |
293 | 3261 |
] ifFalse:[ |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3262 |
(metaModifiers notNil and:[metaModifiers includes:key]) ifTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3263 |
metaDown := pressed |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3264 |
] ifFalse:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3265 |
(shiftModifiers notNil and:[shiftModifiers includes:key]) ifTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3266 |
shiftDown := pressed |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3267 |
] ifFalse:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3268 |
(ctrlModifiers notNil and:[ctrlModifiers includes:key]) ifTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3269 |
ctrlDown := pressed |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3270 |
] |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3271 |
] |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3272 |
] |
293 | 3273 |
] |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3274 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3275 |
"Modified: 2.1.1996 / 15:00:25 / cg" |
293 | 3276 |
! |
3277 |
||
51 | 3278 |
translateKey:untranslatedKey |
3279 |
"Return the key translated via the translation table. |
|
89 | 3280 |
Your application program should never depend on the values returned |
3281 |
by this method, but instead use symbolic keys (such as #FindNext). |
|
3282 |
Doing so allows easier reconfiguration by changing the translation map |
|
3283 |
in the 'smalltalk.rc' or 'display.rc' startup files. |
|
51 | 3284 |
|
3285 |
First, the modifier is prepended, making character X into |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3286 |
AltX, CtrlX or CmdX (on many systems, no separate Cmd (or Meta) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3287 |
key exists; on those we always get AltX if the metaModifiers are not set correctly). |
89 | 3288 |
If multiple modifiers are active, the symbol becoms the concatenation |
3289 |
as in AltCtrlq (for control-alt-q). Shift will affect the last component, |
|
3290 |
thus the above with shift becoms: AltCtrlQ instead. |
|
3291 |
Some keyboards offer both Alt and Meta keys - on those, the first has a |
|
3292 |
prefix of Alt, the second has Cmd as prefix. Keyboards with only an Alt |
|
3293 |
key will will create prefix codes of Cmd for that. |
|
3294 |
For symbolic keys (i.e.Tab, Backspace etc, shift is ignored). |
|
51 | 3295 |
Then the result is used as a key into the translation keyboardMap |
3296 |
to get the final return value." |
|
3297 |
||
145 | 3298 |
|xlatedKey dontTranslate| |
51 | 3299 |
|
3300 |
xlatedKey := untranslatedKey. |
|
145 | 3301 |
|
3302 |
"should this come from a configurable variable ?" |
|
3303 |
dontTranslate := (untranslatedKey == #Control |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3304 |
or:[untranslatedKey == #'Control_L' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3305 |
or:[untranslatedKey == #'Control_R' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3306 |
or:[untranslatedKey == #'Shift' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3307 |
or:[untranslatedKey == #'Shift_L' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3308 |
or:[untranslatedKey == #'Shift_R' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3309 |
or:[untranslatedKey == #'Alt' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3310 |
or:[untranslatedKey == #'Alt_L' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3311 |
or:[untranslatedKey == #'Alt_R' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3312 |
or:[untranslatedKey == #'Meta' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3313 |
or:[untranslatedKey == #'Meta_L' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3314 |
or:[untranslatedKey == #'Meta_R' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3315 |
or:[untranslatedKey == #'Cmd' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3316 |
or:[untranslatedKey == #'Cmd_L' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3317 |
or:[untranslatedKey == #'Cmd_R']]]]]]]]]]]]]]). |
145 | 3318 |
|
259 | 3319 |
dontTranslate ifFalse:[ |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3320 |
ctrlDown ifTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3321 |
xlatedKey := 'Ctrl' , xlatedKey asString |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3322 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3323 |
metaDown ifTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3324 |
xlatedKey := 'Cmd' , xlatedKey asString |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3325 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3326 |
altDown ifTrue:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3327 |
xlatedKey := 'Alt' , xlatedKey asString |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3328 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3329 |
xlatedKey isCharacter ifFalse:[ |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3330 |
xlatedKey := xlatedKey asSymbol |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3331 |
]. |
51 | 3332 |
]. |
3333 |
||
3334 |
xlatedKey := keyboardMap valueFor:xlatedKey. |
|
259 | 3335 |
xlatedKey isCharacter ifFalse:[ |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3336 |
xlatedKey := xlatedKey asSymbol |
259 | 3337 |
]. |
51 | 3338 |
^ xlatedKey |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3339 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3340 |
"Modified: 2.1.1996 / 15:00:56 / cg" |
293 | 3341 |
! ! |
3342 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3343 |
!DeviceWorkstation methodsFor:'keyboard queries'! |
293 | 3344 |
|
3345 |
altDown |
|
3346 |
"return true, if the alt-key is currently pressed." |
|
3347 |
||
3348 |
^ altDown |
|
249
f33de7016dba
modifierKeyProcessing (altDown/metaDown ...) now done in smalltalk
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
3349 |
! |
f33de7016dba
modifierKeyProcessing (altDown/metaDown ...) now done in smalltalk
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
3350 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3351 |
ctrlDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3352 |
"return true, if the control-key is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3353 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3354 |
^ ctrlDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3355 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3356 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3357 |
metaDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3358 |
"return true, if the meta-key (alt-key on systems without meta) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3359 |
is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3360 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3361 |
^ metaDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3362 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3363 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3364 |
shiftDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3365 |
"return true, if the shift-key is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3366 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3367 |
^ shiftDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3368 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3369 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3370 |
!DeviceWorkstation methodsFor:'misc'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3371 |
|
293 | 3372 |
beep |
3373 |
"output an audible beep or bell" |
|
3374 |
||
3375 |
Stdout nextPut:(Character bell) |
|
3376 |
! |
|
3377 |
||
3378 |
buffered |
|
3379 |
"buffer drawing - do not send it immediately to the display. |
|
3380 |
This is the default; see comment in #unBuffered." |
|
3381 |
||
3382 |
^ self |
|
3383 |
! |
|
3384 |
||
3385 |
compressMotionEvents:aBoolean |
|
3386 |
"turn on/off motion event compression |
|
3387 |
- compressions makes always sense except in free-hand drawing of curves" |
|
3388 |
||
3389 |
motionEventCompression := aBoolean |
|
115 | 3390 |
! |
3391 |
||
293 | 3392 |
flush |
3393 |
"send all buffered drawing to the display. |
|
3394 |
This used to be called #synchronizeOutput, but has been renamed |
|
3395 |
for ST-80 compatibility." |
|
3396 |
||
3397 |
^ self |
|
3398 |
! |
|
3399 |
||
3400 |
ringBell |
|
3401 |
"alias for beep; for ST-80 compatibility" |
|
3402 |
||
3403 |
self beep |
|
115 | 3404 |
! |
3405 |
||
293 | 3406 |
setInputFocusTo:aWindowId |
3407 |
^ self subclassResponsibility |
|
115 | 3408 |
! |
3409 |
||
293 | 3410 |
sync |
3411 |
"for ST-80 compatibility" |
|
3412 |
||
3413 |
self flush |
|
115 | 3414 |
! |
3415 |
||
293 | 3416 |
synchronizeOutput |
3417 |
"send all buffered drawing to the display. |
|
3418 |
OBSOLETE: please use #flush for ST-80 compatibility." |
|
3419 |
||
3420 |
self obsoleteMethodWarning:'use #flush'. |
|
3421 |
^ self flush |
|
115 | 3422 |
! |
3423 |
||
293 | 3424 |
unBuffered |
3425 |
"make all drawing be sent immediately to the display. |
|
3426 |
This may horribly slow down your drawings, but will result |
|
3427 |
in any errors to be delivered right after the bad operation |
|
3428 |
(in X only). Only useful for debugging." |
|
3429 |
||
3430 |
^ self |
|
3431 |
! ! |
|
3432 |
||
3433 |
!DeviceWorkstation methodsFor:'pointer queries'! |
|
3434 |
||
3435 |
buttonStates |
|
3436 |
"return an integer representing the state of the pointer buttons; |
|
3437 |
a one-bit represents a pressed button. The bit positions are device specific |
|
3438 |
and to be returned by the *ButtonStateMask methods. |
|
3439 |
Must be redefined by concrete subclasses." |
|
3440 |
||
3441 |
^ self subclassResponsibility |
|
115 | 3442 |
! |
3443 |
||
293 | 3444 |
leftButtonPressed |
3445 |
"return true, if the left button is currently pressed" |
|
3446 |
||
3447 |
^ (self buttonStates bitAnd:self leftButtonStateMask) ~~ 0 |
|
3448 |
! |
|
3449 |
||
3450 |
leftButtonStateMask |
|
3451 |
"return an integer for masking out the left button from a |
|
3452 |
buttonStates value. This is very device specific and to |
|
3453 |
be redefined by concrete subclasses." |
|
3454 |
||
3455 |
^ self subclassResponsibility |
|
115 | 3456 |
! |
3457 |
||
293 | 3458 |
middleButtonPressed |
3459 |
"return true, if the middle button is currently pressed" |
|
3460 |
||
3461 |
^ (self buttonStates bitAnd:self middleButtonStateMask) ~~ 0 |
|
115 | 3462 |
! |
3463 |
||
293 | 3464 |
middleButtonStateMask |
3465 |
"return an integer for masking out the middle button from a |
|
3466 |
buttonStates value. This is very device specific and to |
|
3467 |
be redefined by concrete subclasses." |
|
3468 |
||
3469 |
^ self subclassResponsibility |
|
115 | 3470 |
! |
3471 |
||
293 | 3472 |
pointerPosition |
3473 |
"return the current pointer position in root-window coordinates. |
|
3474 |
Must be redefined by concrete subclasses." |
|
3475 |
||
3476 |
^ self subclassResponsibility |
|
115 | 3477 |
! |
3478 |
||
293 | 3479 |
rightButtonPressed |
3480 |
"return true, if the right button is currently pressed" |
|
3481 |
||
3482 |
^ (self buttonStates bitAnd:self rightButtonStateMask) ~~ 0 |
|
115 | 3483 |
! |
3484 |
||
293 | 3485 |
rightButtonStateMask |
3486 |
"return an integer for masking out the right button from a |
|
3487 |
buttonStates value. This is very device specific and to |
|
3488 |
be redefined by concrete subclasses." |
|
3489 |
||
3490 |
^ self subclassResponsibility |
|
115 | 3491 |
! |
3492 |
||
293 | 3493 |
rootPositionOfLastEvent |
3494 |
"return the position in root-window coordinates |
|
3495 |
of the last button, key or pointer event. |
|
3496 |
Must be redefined by concrete subclasses." |
|
3497 |
||
3498 |
^ self subclassResponsibility |
|
3499 |
! ! |
|
3500 |
||
3501 |
!DeviceWorkstation methodsFor:'printing & storing'! |
|
3502 |
||
3503 |
printOn:aStream |
|
3504 |
"for your convenience, add the name of the display connection |
|
3505 |
or 'default' to the printed representation." |
|
3506 |
||
3507 |
|name| |
|
3508 |
||
3509 |
super printOn:aStream. |
|
3510 |
||
3511 |
aStream nextPut:$(. |
|
3512 |
(name := self displayName) isNil ifTrue:[ |
|
3513 |
name := 'defaultDisplay' |
|
3514 |
]. |
|
3515 |
aStream nextPutAll:name. |
|
3516 |
aStream nextPut:$) |
|
3517 |
! ! |
|
3518 |
||
3519 |
!DeviceWorkstation methodsFor:'retrieving pixels'! |
|
3520 |
||
3521 |
getPixelX:x y:y from:aDrawableId |
|
3522 |
"return the pixel value at x/y" |
|
3523 |
||
3524 |
^ self subclassResponsibility |
|
115 | 3525 |
! ! |
3526 |
||
54 | 3527 |
!DeviceWorkstation methodsFor:'view registration'! |
0 | 3528 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
3529 |
addKnownView:aView withId:aWindowID |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
3530 |
"add the View aView with id:aWindowID to the list of known views/id's. |
51 | 3531 |
This map is needed later (on event arrival) to get the view from |
3532 |
the views id (which is passed along with the devices event) quickly." |
|
0 | 3533 |
|
151 | 3534 |
|freeIdx newArr sz newSize| |
46 | 3535 |
|
0 | 3536 |
knownViews isNil ifTrue:[ |
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3537 |
knownViews := WeakArray new:50. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3538 |
knownIds := Array new:50. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3539 |
freeIdx := 1. |
54 | 3540 |
] ifFalse:[ |
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3541 |
freeIdx := knownViews identityIndexOf:nil. |
118 | 3542 |
|
3543 |
"/ 1 to:knownViews size do:[:idx | |
|
151 | 3544 |
"/ |id| |
118 | 3545 |
"/ (knownViews at:idx) isNil ifTrue:[ |
3546 |
"/ freeIdx := idx |
|
3547 |
"/ id := knownIds at:idx. |
|
3548 |
"/ id notNil ifTrue:[ |
|
3549 |
"/ "/ this one is no longer valid ... |
|
3550 |
"/ knownIds at:idx put:nil. |
|
3551 |
"/ ]. |
|
133 | 3552 |
"/ ] |
3553 |
"/ ]. |
|
0 | 3554 |
]. |
46 | 3555 |
|
118 | 3556 |
freeIdx == 0 ifTrue:[ |
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3557 |
sz := knownViews size. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3558 |
newSize := sz * 2. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3559 |
newArr := WeakArray new:newSize. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3560 |
newArr replaceFrom:1 to:sz with:knownViews. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3561 |
knownViews := newArr. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3562 |
|
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3563 |
newArr := Array new:newSize. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3564 |
newArr replaceFrom:1 to:sz with:knownIds. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3565 |
knownIds := newArr. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3566 |
freeIdx := sz + 1 |
54 | 3567 |
]. |
3568 |
knownViews at:freeIdx put:aView. |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
3569 |
knownIds at:freeIdx put:aWindowID. |
190 | 3570 |
|
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3571 |
"/ dispatching ifFalse:[ |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3572 |
"/ self startDispatch |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3573 |
"/ ]. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3574 |
|
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3575 |
"Modified: 22.12.1995 / 22:46:09 / cg" |
0 | 3576 |
! |
3577 |
||
3578 |
removeKnownView:aView |
|
51 | 3579 |
"remove aView from the list of known views/id's." |
0 | 3580 |
|
54 | 3581 |
|index| |
3582 |
||
3583 |
aView isNil ifTrue:[^ self]. |
|
3584 |
||
46 | 3585 |
"/ idToViewMapping removeValue:aView ifAbsent:[]. |
3586 |
"/ lastId := nil. |
|
3587 |
"/ lastView := nil |
|
3588 |
||
0 | 3589 |
knownViews notNil ifTrue:[ |
71 | 3590 |
index := knownViews identityIndexOf:aView. |
3591 |
index == 0 ifFalse:[ |
|
3592 |
knownViews at:index put:nil. |
|
3593 |
knownIds at:index put:nil. |
|
3594 |
lastId := nil. |
|
190 | 3595 |
lastView := nil. |
3596 |
||
349
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
3597 |
self checkForEndOfDispatch. |
71 | 3598 |
] |
0 | 3599 |
] |
3600 |
! |
|
3601 |
||
54 | 3602 |
update:something |
3603 |
|id| |
|
3604 |
||
118 | 3605 |
"/ no longer called for ... |
3606 |
"/ |
|
54 | 3607 |
something == knownViews ifTrue:[ |
71 | 3608 |
" |
3609 |
some view was garbage-collected; |
|
3610 |
destroy it ... |
|
3611 |
" |
|
3612 |
1 to:knownViews size do:[:idx | |
|
3613 |
(knownViews at:idx) isNil ifTrue:[ |
|
3614 |
id := knownIds at:idx. |
|
3615 |
id notNil ifTrue:[ |
|
3616 |
knownIds at:idx put:nil. |
|
3617 |
]. |
|
3618 |
] |
|
3619 |
]. |
|
54 | 3620 |
|
3621 |
] |
|
293 | 3622 |
! |
3623 |
||
3624 |
viewFromId:aWindowID |
|
3625 |
"given an Id, return the corresponding view." |
|
3626 |
||
3627 |
|index| |
|
3628 |
||
3629 |
"/ ^ idToViewMapping at:aNumber ifAbsent:[nil]. |
|
3630 |
||
3631 |
index := knownIds indexOf:aWindowID. |
|
3632 |
index == 0 ifTrue:[^ nil]. |
|
3633 |
^ knownViews at:index. |
|
0 | 3634 |
! ! |
3635 |
||
12 | 3636 |
!DeviceWorkstation methodsFor:'window stuff'! |
3637 |
||
293 | 3638 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
3639 |
"clear a rectangular area of a window to its view background" |
|
3640 |
||
3641 |
^ self subclassResponsibility |
|
3642 |
! |
|
3643 |
||
3644 |
clearWindow:aWindowId |
|
3645 |
"clear a windows to its view background" |
|
3646 |
||
3647 |
^ self subclassResponsibility |
|
3648 |
! |
|
3649 |
||
3650 |
lowerWindow:aWindowId |
|
3651 |
^ self subclassResponsibility |
|
3652 |
! |
|
3653 |
||
3654 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h |
|
3655 |
^ self subclassResponsibility |
|
3656 |
! |
|
3657 |
||
3658 |
mapWindow:aWindowId |
|
3659 |
^ self subclassResponsibility |
|
3660 |
! |
|
3661 |
||
3662 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
|
3663 |
^ self subclassResponsibility |
|
3664 |
! |
|
3665 |
||
3666 |
moveWindow:aWindowId x:x y:y |
|
3667 |
^ self subclassResponsibility |
|
3668 |
! |
|
3669 |
||
3670 |
raiseWindow:aWindowId |
|
3671 |
^ self subclassResponsibility |
|
3672 |
! |
|
3673 |
||
3674 |
resizeWindow:aWindowId width:w height:h |
|
3675 |
^ self subclassResponsibility |
|
12 | 3676 |
! |
3677 |
||
3678 |
restoreCursors |
|
3679 |
"restore the cursors of all views to their current cursor" |
|
3680 |
||
46 | 3681 |
"/ idToViewMapping notNil ifTrue:[ |
51 | 3682 |
"/ idToViewMapping keysAndValuesDo:[:viewId :view | |
3683 |
"/ |curs cid| |
|
3684 |
"/ curs := view cursor. |
|
3685 |
"/ curs notNil ifTrue:[ |
|
3686 |
"/ cid := curs id. |
|
3687 |
"/ cid notNil ifTrue:[ |
|
3688 |
"/ self setCursor:cid in:viewId |
|
3689 |
"/ ] |
|
3690 |
"/ ] |
|
3691 |
"/ ]. |
|
151 | 3692 |
"/ self flush |
46 | 3693 |
"/ ] |
3694 |
||
12 | 3695 |
knownViews notNil ifTrue:[ |
71 | 3696 |
knownViews do:[:aView | |
3697 |
|c vid cid| |
|
3698 |
||
3699 |
(aView notNil and:[(vid := aView id) notNil]) ifTrue:[ |
|
3700 |
c := aView cursor. |
|
3701 |
(c notNil and:[(cid := c id) notNil]) ifTrue:[ |
|
3702 |
self setCursor:cid in:vid |
|
3703 |
] |
|
3704 |
] |
|
3705 |
]. |
|
151 | 3706 |
self flush |
12 | 3707 |
] |
3708 |
||
3709 |
"Display setCursors:(Cursor wait)" |
|
3710 |
"Display restoreCursors" |
|
3711 |
! |
|
3712 |
||
293 | 3713 |
setBackingStore:how in:aWindowId |
3714 |
"turn on/off backing-store for a window" |
|
23 | 3715 |
|
3716 |
^ self subclassResponsibility |
|
3717 |
! |
|
3718 |
||
293 | 3719 |
setCursor:aCursorId in:aWindowId |
3720 |
"set a windows visible shape" |
|
12 | 3721 |
|
3722 |
^ self subclassResponsibility |
|
3723 |
! |
|
3724 |
||
293 | 3725 |
setCursors:aCursor |
3726 |
"change the cursor of all views to aCursorId" |
|
3727 |
||
3728 |
| id | |
|
3729 |
||
3730 |
id := (aCursor on:self) id. |
|
3731 |
id notNil ifTrue:[ |
|
3732 |
"/ idToViewMapping notNil ifTrue:[ |
|
3733 |
"/ idToViewMapping keysAndValuesDo:[:viewId :view | |
|
3734 |
"/ self setCursor:id in:viewId |
|
3735 |
"/ ]. |
|
3736 |
knownViews do:[:aView | |
|
3737 |
|vid| |
|
3738 |
||
3739 |
(aView notNil and:[(vid := aView id) notNil]) ifTrue:[ |
|
3740 |
self setCursor:id in:vid |
|
3741 |
] |
|
3742 |
]. |
|
3743 |
self flush |
|
51 | 3744 |
"/ ] |
293 | 3745 |
] |
3746 |
||
3747 |
"Display setCursors:Cursor wait" |
|
3748 |
"Display restoreCursors" |
|
0 | 3749 |
! |
3750 |
||
293 | 3751 |
setIconName:aString in:aWindowId |
3752 |
"set a windows icon name" |
|
10 | 3753 |
|
0 | 3754 |
^ self subclassResponsibility |
3755 |
! |
|
3756 |
||
3757 |
setSaveUnder:yesOrNo in:aWindowId |
|
3758 |
"turn on/off save-under for a window" |
|
10 | 3759 |
|
0 | 3760 |
^ self subclassResponsibility |
3761 |
! |
|
3762 |
||
3763 |
setWindowBackground:aColorIndex in:aWindowId |
|
10 | 3764 |
"set a windows background color" |
0 | 3765 |
|
3766 |
^ self subclassResponsibility |
|
3767 |
! |
|
3768 |
||
3769 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
|
10 | 3770 |
"set a windows background pattern to be a form" |
3771 |
||
0 | 3772 |
^ self subclassResponsibility |
3773 |
! |
|
3774 |
||
3775 |
setWindowBorderColor:aColorIndex in:aWindowId |
|
10 | 3776 |
"set a windows border color" |
3777 |
||
0 | 3778 |
^ self subclassResponsibility |
3779 |
! |
|
3780 |
||
3781 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
|
10 | 3782 |
"set a windows border pattern" |
3783 |
||
0 | 3784 |
^ self subclassResponsibility |
3785 |
! |
|
3786 |
||
3787 |
setWindowBorderShape:aPixmapId in:aWindowId |
|
10 | 3788 |
"set a windows border shape" |
3789 |
||
0 | 3790 |
^ self subclassResponsibility |
3791 |
! |
|
3792 |
||
293 | 3793 |
setWindowBorderWidth:aNumber in:aWindowId |
3794 |
"set a windows border width" |
|
10 | 3795 |
|
0 | 3796 |
^ self subclassResponsibility |
3797 |
! |
|
3798 |
||
3799 |
setWindowIcon:aForm in:aWindowId |
|
10 | 3800 |
"set a windows icon" |
3801 |
||
0 | 3802 |
^ self subclassResponsibility |
3803 |
! |
|
3804 |
||
3805 |
setWindowIconWindow:aView in:aWindowId |
|
10 | 3806 |
"set a windows icon window" |
3807 |
||
0 | 3808 |
^ self subclassResponsibility |
3809 |
! |
|
3810 |
||
293 | 3811 |
setWindowName:aString in:aWindowId |
3812 |
"set a windows name" |
|
10 | 3813 |
|
0 | 3814 |
^ self subclassResponsibility |
3815 |
! |
|
3816 |
||
293 | 3817 |
setWindowShape:aPixmapId in:aWindowId |
3818 |
"set a windows visible shape" |
|
3819 |
||
0 | 3820 |
^ self subclassResponsibility |
3821 |
! |
|
3822 |
||
3823 |
unmapWindow:aWindowId |
|
3824 |
^ self subclassResponsibility |
|
3825 |
! ! |
|
3826 |
||
293 | 3827 |
!DeviceWorkstation class methodsFor:'documentation'! |
3828 |
||
3829 |
version |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
3830 |
^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.72 1996-02-27 01:09:35 cg Exp $' |
0 | 3831 |
! ! |
293 | 3832 |
DeviceWorkstation initialize! |