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