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