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