0
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
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
|
|
14 |
instanceVariableNames:'displayId
|
|
15 |
visualType monitorType
|
|
16 |
depth ncells bitsPerRGB
|
|
17 |
hasColors hasGreyscales
|
|
18 |
width height widthMM heightMM resolutionHor resolutionVer
|
|
19 |
knownViews knownIds knownBitmaps knownBitmapIds
|
|
20 |
dispatching
|
|
21 |
idleBlocks
|
|
22 |
controlDown shiftDown metaDown altDown
|
|
23 |
ignoreBackingStore motionEventCompression
|
|
24 |
timeOutBlocks timeOutTimes
|
|
25 |
lastId lastView
|
|
26 |
keyboardMap'
|
2
|
27 |
classVariableNames: 'ButtonTranslation MultiClickTimeDelta
|
|
28 |
DeviceErrorSignal'
|
0
|
29 |
poolDictionaries:''
|
|
30 |
category:'Interface-Graphics'
|
|
31 |
!
|
|
32 |
|
|
33 |
DeviceWorkstation comment:'
|
|
34 |
|
|
35 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
36 |
All Rights Reserved
|
|
37 |
|
|
38 |
%W% %E%
|
|
39 |
written jan 93 by claus
|
|
40 |
'!
|
|
41 |
|
|
42 |
!DeviceWorkstation class methodsFor:'documentation'!
|
|
43 |
|
|
44 |
documentation
|
|
45 |
"
|
|
46 |
this abstract class defines common protocol to all Display types.
|
|
47 |
|
|
48 |
instance variables:
|
|
49 |
|
2
|
50 |
displayId <Number> the device id of the display
|
0
|
51 |
visualType <Symbol> one of #StaticGray, #PseudoColor, ... #TrueColor
|
|
52 |
monitorType <Symbol> one of #monochrome, #color, #unknown
|
2
|
53 |
|
0
|
54 |
depth <Integer> bits per color
|
|
55 |
ncells <Integer> number of colors (i.e. colormap size; not always == 2^depth)
|
|
56 |
bitsPerRGB <Integer> number of valid bits per rgb component
|
2
|
57 |
(actual number taken in A/D converter; not all devices report the true value)
|
|
58 |
hasColors <Boolean> true, if display supports colors
|
|
59 |
hasGreyscales <Boolean> true, if display supports grey-scales (i.e is not b/w display)
|
|
60 |
width <Integer> number of horizontal pixels
|
|
61 |
height <Integer> number of vertical pixels
|
|
62 |
heightMM <Number> screen height in millimeter
|
|
63 |
widthMM <Number> screen width in millimeter
|
0
|
64 |
resolutionHor <Number> pixels per horizontal millimeter
|
|
65 |
resolutionVer <Number> pixels per vertical millimeter
|
|
66 |
|
2
|
67 |
knownViews <Collection> all views known
|
|
68 |
knownIds <Collection> corresponding device-view ids
|
|
69 |
knownBitmaps <Collection> all known device bitmaps
|
|
70 |
knownBitmapIds <Collection> corresponding device-bitmap ids
|
|
71 |
|
|
72 |
dispatching <Boolean> true, if currently in dispatch loop
|
|
73 |
|
|
74 |
idleBlocks <Collection> blocks to evaluate, when no events are pending
|
0
|
75 |
|
|
76 |
controlDown <Boolean> control key currently pressed
|
|
77 |
shiftDown <Boolean> shift key currently pressed
|
2
|
78 |
metaDown <Boolean>
|
|
79 |
altDown <Boolean>
|
|
80 |
|
|
81 |
ignoreBackingStore
|
|
82 |
motionEventCompression
|
|
83 |
|
|
84 |
timeOutBlocks <Collection>
|
|
85 |
timeOutTimes <Collection>
|
|
86 |
|
|
87 |
lastId <Number>
|
|
88 |
lastView <View>
|
|
89 |
|
0
|
90 |
keyboardMap <KeyBdMap> mapping for keys
|
|
91 |
|
|
92 |
"
|
|
93 |
! !
|
|
94 |
|
|
95 |
!DeviceWorkstation class methodsFor:'initialization'!
|
|
96 |
|
2
|
97 |
initialize
|
|
98 |
DeviceErrorSignal isNil ifTrue:[
|
|
99 |
DeviceErrorSignal := (Signal new) mayProceed:true.
|
|
100 |
DeviceErrorSignal notifierString:'device error'.
|
|
101 |
].
|
|
102 |
!
|
|
103 |
|
0
|
104 |
initializeConstants
|
|
105 |
"initialize some (soft) constants"
|
|
106 |
|
|
107 |
MultiClickTimeDelta := 300.
|
|
108 |
ButtonTranslation := #(1 2 3) "identity translation"
|
|
109 |
! !
|
|
110 |
|
2
|
111 |
!DeviceWorkstation class methodsFor:'signal access'!
|
|
112 |
|
|
113 |
deviceErrorSignal
|
|
114 |
"return the signal used for device error reporting"
|
|
115 |
|
|
116 |
^ DeviceErrorSignal
|
|
117 |
! !
|
|
118 |
|
0
|
119 |
!DeviceWorkstation class methodsFor:'accessing'!
|
|
120 |
|
|
121 |
buttonTranslation:anArray
|
|
122 |
"set the button translation, #(1 2 3) is no-translation,
|
|
123 |
#(3 2 1) is ok for left-handers"
|
|
124 |
|
|
125 |
ButtonTranslation := anArray
|
|
126 |
! !
|
|
127 |
|
|
128 |
!DeviceWorkstation methodsFor:'initialize / release'!
|
|
129 |
|
|
130 |
initialize
|
|
131 |
"initialize the receiver for a connection to the default display"
|
|
132 |
|
|
133 |
^ self initializeFor:nil
|
|
134 |
!
|
|
135 |
|
|
136 |
initializeFor:aDisplayOrNilForAny
|
|
137 |
"initialize the receiver for a connection to a display. If the
|
|
138 |
argument is non-nil, it should specify which workstation should be
|
|
139 |
connected to (in a device specific manner). For X displays, this is
|
|
140 |
to be the display-string i.e. hostname:displayNr.
|
|
141 |
If the argument is nil, connect to the default display."
|
|
142 |
|
|
143 |
self subclassResponsibility
|
|
144 |
!
|
|
145 |
|
|
146 |
close
|
2
|
147 |
"close down connection to Display - usually never done"
|
|
148 |
|
0
|
149 |
^ self subclassResponsibility
|
|
150 |
!
|
|
151 |
|
|
152 |
reinitialize
|
|
153 |
"reinit after snapin"
|
|
154 |
|
|
155 |
|prevKnownViews|
|
|
156 |
|
|
157 |
displayId := nil.
|
|
158 |
prevKnownViews := knownViews.
|
|
159 |
knownViews := nil.
|
|
160 |
knownIds := nil.
|
|
161 |
|
|
162 |
self initializeFor:nil.
|
|
163 |
|
|
164 |
"now, all Forms must be recreated"
|
|
165 |
|
|
166 |
Form reinitializeAllOn:self.
|
|
167 |
|
|
168 |
prevKnownViews notNil ifTrue:[
|
|
169 |
"
|
|
170 |
first round: flush all device specific stuff
|
|
171 |
"
|
|
172 |
prevKnownViews do:[:aView |
|
|
173 |
aView notNil ifTrue:[
|
|
174 |
aView prepareForReinit
|
|
175 |
]
|
|
176 |
].
|
|
177 |
"
|
|
178 |
2nd round: all views should reinstall themself
|
|
179 |
on the new display
|
|
180 |
"
|
|
181 |
prevKnownViews do:[:aView |
|
|
182 |
aView notNil ifTrue:[
|
|
183 |
"have to re-create the view"
|
|
184 |
aView reinitialize
|
|
185 |
]
|
|
186 |
].
|
|
187 |
"
|
|
188 |
3rd round: all views get a chance to handle
|
|
189 |
changed environment (colors, font sizes etc)
|
|
190 |
"
|
|
191 |
prevKnownViews do:[:aView |
|
|
192 |
aView notNil ifTrue:[
|
|
193 |
aView reAdjustGeometry
|
|
194 |
]
|
|
195 |
]
|
|
196 |
].
|
|
197 |
dispatching := false
|
|
198 |
!
|
|
199 |
|
|
200 |
initializeKeyboardMap
|
|
201 |
"keystrokes from the server are translated via the keyboard map.
|
|
202 |
Untranslated keystrokes arrive either as characters, or symbols
|
|
203 |
(which are the keySyms as symbol). The mapping table which is
|
|
204 |
setup here, is used in sendKeyPress:... later.
|
|
205 |
"
|
|
206 |
|
|
207 |
keyboardMap := KeyboardMap new.
|
|
208 |
|
|
209 |
keyboardMap bindValue:#Copy to:#Cmdc.
|
|
210 |
keyboardMap bindValue:#Cut to:#Cmdx.
|
|
211 |
keyboardMap bindValue:#Paste to:#Cmdv.
|
|
212 |
keyboardMap bindValue:#Replace to:#Cmdr.
|
|
213 |
|
|
214 |
keyboardMap bindValue:#Find to:#Cmds.
|
|
215 |
keyboardMap bindValue:#FindNext to:#Cmdf.
|
|
216 |
keyboardMap bindValue:#FindPrev to:#Cmdb.
|
|
217 |
|
|
218 |
keyboardMap bindValue:#SelectAll to:#CmdA.
|
|
219 |
|
|
220 |
(OperatingSystem getSystemType = 'sunos') ifTrue:[
|
|
221 |
"
|
|
222 |
define suns left-function keys
|
|
223 |
(this really should be done by xmodmap/server)
|
|
224 |
"
|
|
225 |
keyboardMap bindValue:#Find to:#F19.
|
|
226 |
keyboardMap bindValue:#Cut to:#F20.
|
|
227 |
keyboardMap bindValue:#Paste to:#F18.
|
|
228 |
keyboardMap bindValue:#Open to:#F17.
|
|
229 |
keyboardMap bindValue:#Copy to:#F16.
|
|
230 |
keyboardMap bindValue:#Undo to:#F14.
|
|
231 |
keyboardMap bindValue:#Props to:#F13.
|
|
232 |
keyboardMap bindValue:#Again to:#F12.
|
|
233 |
keyboardMap bindValue:#Prior to:#F29.
|
|
234 |
keyboardMap bindValue:#Next to:#F35.
|
|
235 |
keyboardMap bindValue:#Home to:#F27.
|
|
236 |
keyboardMap bindValue:#End to:#R13.
|
|
237 |
].
|
|
238 |
|
|
239 |
(OperatingSystem getSystemType = 'next') ifTrue:[
|
|
240 |
"
|
|
241 |
kludge for my next server with german keyboard:
|
|
242 |
the modifier map does not allow me to include alt-key
|
2
|
243 |
modification - therefore, its done here, which is stupid
|
0
|
244 |
"
|
|
245 |
keyboardMap bindValue:$~ to:#Alt1.
|
|
246 |
keyboardMap bindValue:$< to:#Alt4.
|
|
247 |
keyboardMap bindValue:$> to:#Alt5.
|
|
248 |
keyboardMap bindValue:$| to:#Alt6.
|
|
249 |
keyboardMap bindValue:${ to:#Alt7.
|
|
250 |
keyboardMap bindValue:$[ to:#Alt8.
|
|
251 |
keyboardMap bindValue:$] to:#Alt9.
|
|
252 |
keyboardMap bindValue:$} to:#Alt0.
|
|
253 |
keyboardMap bindValue:$# to:#'Alt+'.
|
|
254 |
keyboardMap bindValue:$@ to:#'Alt'''.
|
|
255 |
keyboardMap bindValue:$^ to:#'Alt`'.
|
|
256 |
].
|
|
257 |
|
|
258 |
"
|
|
259 |
international characters - map to iso8859 values
|
|
260 |
"
|
|
261 |
keyboardMap bindValue:(Character value:16rFC) to:#udiaeresis.
|
|
262 |
keyboardMap bindValue:(Character value:16rE4) to:#adiaeresis.
|
|
263 |
keyboardMap bindValue:(Character value:16rF6) to:#odiaeresis.
|
|
264 |
keyboardMap bindValue:(Character value:16rDC) to:#Udiaeresis.
|
|
265 |
keyboardMap bindValue:(Character value:16rC4) to:#Adiaeresis.
|
|
266 |
keyboardMap bindValue:(Character value:16rD6) to:#Odiaeresis.
|
|
267 |
keyboardMap bindValue:(Character value:16rDF) to:#ssharp.
|
2
|
268 |
"
|
|
269 |
and also the pre-translated characters
|
|
270 |
for those characters which are already translated by
|
|
271 |
modifier map
|
|
272 |
"
|
|
273 |
keyboardMap bindValue:$~ to:#'Cmd~'.
|
|
274 |
keyboardMap bindValue:$\ to:#'Cmd\'.
|
|
275 |
keyboardMap bindValue:$| to:#'Cmd|'.
|
|
276 |
keyboardMap bindValue:${ to:#'Cmd{'.
|
|
277 |
keyboardMap bindValue:$[ to:#'Cmd['.
|
|
278 |
keyboardMap bindValue:$] to:#'Cmd]'.
|
|
279 |
keyboardMap bindValue:$} to:#'Cmd}'.
|
|
280 |
keyboardMap bindValue:$@ to:#'Cmd@'.
|
0
|
281 |
|
|
282 |
"
|
|
283 |
more needed, french for example ...
|
|
284 |
"
|
|
285 |
|
|
286 |
"
|
|
287 |
misc characters
|
|
288 |
"
|
|
289 |
keyboardMap bindValue:(Character value:16rA7) to:#section.
|
|
290 |
keyboardMap bindValue:(Character value:16rB0) to:#degree.
|
|
291 |
keyboardMap bindValue:(Character value:16rB2) to:#twosuperior.
|
|
292 |
keyboardMap bindValue:(Character value:16rB3) to:#threesuperior.
|
|
293 |
keyboardMap bindValue:(Character value:16rB5) to:#mu.
|
|
294 |
! !
|
|
295 |
|
2
|
296 |
!DeviceWorkstation class methodsFor:'error handling'!
|
|
297 |
|
|
298 |
resourceIdOfLastError
|
|
299 |
"return the resource id responsible for the last error"
|
|
300 |
|
|
301 |
^ self subclassResponsibility
|
|
302 |
!
|
|
303 |
|
|
304 |
lastError
|
|
305 |
"return a string descibing the last error"
|
|
306 |
|
|
307 |
^ self subclassResponsibility
|
|
308 |
!
|
|
309 |
|
|
310 |
errorInterrupt
|
|
311 |
"x-error interrupt"
|
|
312 |
|
|
313 |
|badId badResource|
|
|
314 |
|
|
315 |
badId := self resourceIdOfLastError.
|
|
316 |
badId ~~ 0 ifTrue:[
|
|
317 |
badResource := self resourceOfId:badId.
|
|
318 |
].
|
|
319 |
^ DeviceErrorSignal
|
|
320 |
raiseRequestWith:badResource
|
|
321 |
errorString: 'Display error: ' , (self lastError)
|
|
322 |
!
|
|
323 |
|
|
324 |
resourceOfId:id
|
|
325 |
"search thru all device stuff for a resource.
|
|
326 |
Needed for error handling"
|
|
327 |
|
|
328 |
Form allInstances do:[:f |
|
|
329 |
f id == id ifTrue:[^ f]
|
|
330 |
].
|
|
331 |
|
|
332 |
self allInstances do:[:aDisplay |
|
|
333 |
|views|
|
|
334 |
|
|
335 |
views := aDisplay knownViews.
|
|
336 |
views notNil ifTrue:[
|
|
337 |
views do:[:v |
|
|
338 |
v id == id ifTrue:[^ v].
|
|
339 |
v gcId == id ifTrue:[^ v]
|
|
340 |
].
|
|
341 |
].
|
|
342 |
].
|
|
343 |
|
|
344 |
Color allInstances do:[:c |
|
|
345 |
c colorId == id ifTrue:[^ c]
|
|
346 |
].
|
|
347 |
|
|
348 |
Font allInstances do:[:f |
|
|
349 |
f fontId == id ifTrue:[^ f]
|
|
350 |
].
|
|
351 |
^ nil
|
|
352 |
! !
|
|
353 |
|
0
|
354 |
!DeviceWorkstation methodsFor:'misc'!
|
|
355 |
|
|
356 |
metaDown
|
|
357 |
"return true, if the meta-key (alt-key on systems without meta)
|
|
358 |
is currently pressed"
|
|
359 |
|
|
360 |
^ metaDown
|
|
361 |
!
|
|
362 |
|
|
363 |
altDown
|
|
364 |
"return true, if the alt-key is currently pressed"
|
|
365 |
|
|
366 |
^ altDown
|
|
367 |
!
|
|
368 |
|
|
369 |
controlDown
|
|
370 |
"return true, if the control-key is currently pressed"
|
|
371 |
|
|
372 |
^ controlDown
|
|
373 |
!
|
|
374 |
|
|
375 |
shiftDown
|
|
376 |
"return true, if the shift-key is currently pressed"
|
|
377 |
|
|
378 |
^ shiftDown
|
|
379 |
!
|
|
380 |
|
|
381 |
unBuffered
|
|
382 |
"make all drawing be sent immediately to the display"
|
|
383 |
|
|
384 |
^ self
|
|
385 |
!
|
|
386 |
|
|
387 |
buffered
|
|
388 |
"buffer drawing - do not send it immediately to the display"
|
|
389 |
|
|
390 |
^ self
|
|
391 |
!
|
|
392 |
|
|
393 |
synchronizeOutput
|
|
394 |
"send all buffered drawing to the display"
|
|
395 |
|
|
396 |
^ self
|
|
397 |
!
|
|
398 |
|
|
399 |
compressMotionEvents:aBoolean
|
|
400 |
"turn on/off motion event compression
|
|
401 |
- compressions makes always sense except in free-hand drawing of curves"
|
|
402 |
|
|
403 |
motionEventCompression := aBoolean
|
|
404 |
!
|
|
405 |
|
|
406 |
hasColors:aBoolean
|
|
407 |
"set the hasColors flag - needed since some servers dont tell the
|
|
408 |
truth if a monochrome monitor is connected to a color server"
|
|
409 |
|
|
410 |
hasColors := aBoolean
|
|
411 |
!
|
|
412 |
|
|
413 |
hasGreyscales:aBoolean
|
|
414 |
"set the hasGreyscales flag - can be used to simulate b&w behavior"
|
|
415 |
|
|
416 |
hasGreyscales := aBoolean
|
|
417 |
!
|
|
418 |
|
|
419 |
ignoreBackingStore:aBoolean
|
|
420 |
"if the argument is true, the views backingStore setting will be ignored, and
|
|
421 |
no backing store used - this can be used on servers where backing store is
|
|
422 |
very slow (from rc-file)"
|
|
423 |
|
|
424 |
ignoreBackingStore := aBoolean
|
|
425 |
!
|
|
426 |
|
|
427 |
beep
|
|
428 |
"output an audible beep or bell"
|
|
429 |
|
|
430 |
Stdout nextPut:(Character bell)
|
|
431 |
!
|
|
432 |
|
|
433 |
setInputFocusTo:aWindowId
|
|
434 |
^ self subclassResponsibility
|
|
435 |
! !
|
|
436 |
|
|
437 |
!DeviceWorkstation methodsFor:'enumeration'!
|
|
438 |
|
|
439 |
allViewsDo:aBlock
|
|
440 |
"evaluate the argument, aBlock for all known views"
|
|
441 |
|
|
442 |
knownViews notNil ifTrue:[
|
|
443 |
knownViews do:[:aView |
|
|
444 |
aView notNil ifTrue:[
|
|
445 |
aBlock value:aView
|
|
446 |
]
|
|
447 |
]
|
|
448 |
]
|
|
449 |
|
|
450 |
"
|
|
451 |
View defaultStyle:#iris.
|
|
452 |
Display allViewsDo:[:v | v initStyle. v redraw]
|
|
453 |
"
|
|
454 |
"
|
|
455 |
View defaultStyle:#next.
|
|
456 |
Display allViewsDo:[:v | v initStyle. v redraw]
|
|
457 |
"
|
|
458 |
"
|
|
459 |
View defaultStyle:#normal.
|
|
460 |
Display allViewsDo:[:v | v initStyle. v redraw]
|
|
461 |
"
|
|
462 |
! !
|
|
463 |
|
|
464 |
!DeviceWorkstation methodsFor:'accessing & queries'!
|
|
465 |
|
|
466 |
displayFileDescriptor
|
|
467 |
^ self subclassResponsibility
|
|
468 |
!
|
|
469 |
|
|
470 |
serverVendor
|
|
471 |
^ self subclassResponsibility
|
|
472 |
!
|
|
473 |
|
|
474 |
vendorRelease
|
|
475 |
^ self subclassResponsibility
|
|
476 |
!
|
|
477 |
|
|
478 |
protocolVersion
|
|
479 |
^ self subclassResponsibility
|
|
480 |
!
|
|
481 |
|
|
482 |
blackpixel
|
|
483 |
"return the colorId of black"
|
|
484 |
|
|
485 |
^ self subclassResponsibility
|
|
486 |
!
|
|
487 |
|
|
488 |
whitepixel
|
|
489 |
"return the colorId of white"
|
|
490 |
|
|
491 |
^ self subclassResponsibility
|
|
492 |
!
|
|
493 |
|
|
494 |
viewIdFromPoint:aPoint in:windowId
|
|
495 |
"given a point in rootWindow, return the viewId of the subview of windowId
|
|
496 |
hit by this coordinate.
|
|
497 |
return nil if no view was hit.
|
|
498 |
- use to find window to drop objects after a cross-view drag"
|
|
499 |
|
|
500 |
^ self subclassResponsibility
|
|
501 |
!
|
|
502 |
|
|
503 |
translatePoint:aPoint from:windowId1 to:windowId2
|
|
504 |
"given a point in window1, return the coordinate in window2
|
|
505 |
- use to xlate points from a window to rootwindow"
|
|
506 |
|
|
507 |
^ self subclassResponsibility
|
|
508 |
!
|
|
509 |
|
|
510 |
id
|
|
511 |
"return the displayId"
|
|
512 |
|
|
513 |
^ displayId
|
|
514 |
!
|
|
515 |
|
|
516 |
ncells
|
|
517 |
"return the number of color cells, the display has"
|
|
518 |
|
|
519 |
^ ncells
|
|
520 |
!
|
|
521 |
|
|
522 |
depth
|
|
523 |
"return the depth in pixels of the display"
|
|
524 |
|
|
525 |
^ depth
|
|
526 |
!
|
|
527 |
|
|
528 |
bitsPerRGB
|
|
529 |
"return the number of valid bits per rgb component"
|
|
530 |
|
|
531 |
^ bitsPerRGB
|
|
532 |
!
|
|
533 |
|
|
534 |
visualType:aSymbol
|
|
535 |
"set the visual type. The only situation, where this makes sense,
|
|
536 |
is with my plasma-display, which ignores the palette and spits out
|
|
537 |
grey scales independent of LUT definitions. (of which the server
|
|
538 |
knows nothing)"
|
|
539 |
|
|
540 |
visualType := aSymbol.
|
|
541 |
(visualType == #StaticGray or:[visualType == #GrayScale]) ifTrue:[
|
|
542 |
hasColors := false
|
|
543 |
] ifFalse:[
|
|
544 |
hasColors := true
|
|
545 |
]
|
|
546 |
!
|
|
547 |
|
|
548 |
visualType
|
|
549 |
"return a symbol representing the visual type of the display"
|
|
550 |
|
|
551 |
^ visualType
|
|
552 |
!
|
|
553 |
|
|
554 |
monitorType
|
|
555 |
"return a symbol representing the monitor type of the display.
|
|
556 |
It is usually set to #unknown, #color or #monochrome.
|
|
557 |
But it can be set to any value from the startup file, for later
|
|
558 |
testing from anywhere. For example the startup for plasma-displays
|
|
559 |
can set it to #plasma to later influence the colors used in widgets
|
|
560 |
(indirectly through the resource file)."
|
|
561 |
|
|
562 |
^ monitorType
|
|
563 |
!
|
|
564 |
|
|
565 |
monitorType:aSymbol
|
|
566 |
"set the monitorType - see comment in DeviceWorkstation>>montorType"
|
|
567 |
|
|
568 |
monitorType := aSymbol
|
|
569 |
!
|
|
570 |
|
|
571 |
hasColors
|
|
572 |
"return true, if its a color display"
|
|
573 |
|
|
574 |
^ hasColors
|
|
575 |
!
|
|
576 |
|
|
577 |
hasGreyscales
|
|
578 |
"return true, if this workstation supports greyscales
|
|
579 |
(also true for color displays)"
|
|
580 |
|
|
581 |
^ hasGreyscales
|
|
582 |
!
|
|
583 |
|
|
584 |
hasShape
|
|
585 |
"return true, if this workstation supports non-rectangular windows"
|
|
586 |
|
|
587 |
^ false
|
|
588 |
!
|
|
589 |
|
|
590 |
hasShm
|
|
591 |
"return true, if this workstation supports shared pixmaps"
|
|
592 |
|
|
593 |
^ false
|
|
594 |
!
|
|
595 |
|
|
596 |
hasFax
|
|
597 |
"return true, if this workstation supports decompression of fax images"
|
|
598 |
|
|
599 |
^ false
|
|
600 |
!
|
|
601 |
|
|
602 |
hasDPS
|
|
603 |
"return true, if the server support postscript output into views"
|
|
604 |
|
|
605 |
^ false
|
|
606 |
!
|
|
607 |
|
|
608 |
keyboardMap
|
|
609 |
"return the keyboard map"
|
|
610 |
|
|
611 |
^ keyboardMap
|
|
612 |
!
|
|
613 |
|
|
614 |
width
|
|
615 |
"return the width in pixels of the display"
|
|
616 |
|
|
617 |
^ width
|
|
618 |
!
|
|
619 |
|
|
620 |
height
|
|
621 |
"return the height in pixels of the display"
|
|
622 |
|
|
623 |
^ height
|
|
624 |
!
|
|
625 |
|
|
626 |
boundingBox
|
|
627 |
"return width and height as a Point.
|
|
628 |
Smalltalk-80 compatibility"
|
|
629 |
|
|
630 |
^ Rectangle origin:(0 @ 0) extent:(width @ height)
|
|
631 |
!
|
|
632 |
|
|
633 |
widthInMillimeter
|
|
634 |
"return the width in millimeter of the display"
|
|
635 |
|
|
636 |
^ widthMM
|
|
637 |
!
|
|
638 |
|
|
639 |
heightInMillimeter
|
|
640 |
"return the height in millimeter of the display"
|
|
641 |
|
|
642 |
^ heightMM
|
|
643 |
!
|
|
644 |
|
|
645 |
widthInMillimeter:aNumber
|
|
646 |
"set the width in millimeter of the display
|
|
647 |
- needed since some X-servers do not tell the truth"
|
|
648 |
|
|
649 |
widthMM := aNumber
|
|
650 |
!
|
|
651 |
|
|
652 |
heightInMillimeter:aNumber
|
|
653 |
"set the height in millimeter of the display
|
|
654 |
- needed since some X-servers do not tell the truth"
|
|
655 |
|
|
656 |
heightMM := aNumber
|
|
657 |
!
|
|
658 |
|
|
659 |
pixelPerMillimeter
|
|
660 |
"return the number of horizontal/vertical pixels per millimeter of the display as Point"
|
|
661 |
|
|
662 |
^ (width / widthMM) @ (height / heightMM)
|
|
663 |
|
|
664 |
"Display pixelPerMillimeter"
|
|
665 |
!
|
|
666 |
|
|
667 |
pixelPerInch
|
|
668 |
"return the number of horizontal/vertical pixels per inch of the display as Point"
|
|
669 |
|
|
670 |
^ ((width / widthMM) @ (height / heightMM)) * 25.4
|
|
671 |
|
|
672 |
"Display pixelPerInch"
|
|
673 |
!
|
|
674 |
|
|
675 |
horizontalPixelPerMillimeter
|
|
676 |
"return the number of horizontal pixels per millimeter of the display"
|
|
677 |
|
|
678 |
^ width / widthMM
|
|
679 |
!
|
|
680 |
|
|
681 |
verticalPixelPerMillimeter
|
|
682 |
"return the number of vertical pixels per millimeter of the display"
|
|
683 |
|
|
684 |
^ height / heightMM
|
|
685 |
!
|
|
686 |
|
|
687 |
horizontalPixelPerInch
|
|
688 |
"return the number of horizontal pixels per inch of the display"
|
|
689 |
|
|
690 |
^ (width / widthMM) * 25.4
|
|
691 |
!
|
|
692 |
|
|
693 |
verticalPixelPerInch
|
|
694 |
"return the number of vertical pixels per inch of the display"
|
|
695 |
|
|
696 |
^ (height / heightMM) * 25.4
|
|
697 |
!
|
|
698 |
|
|
699 |
center
|
|
700 |
"return the centerpoint in pixels of the display"
|
|
701 |
|
|
702 |
^ (width // 2) @ (height // 2)
|
|
703 |
!
|
|
704 |
|
|
705 |
knownViews
|
|
706 |
"return a collection of all known views"
|
|
707 |
|
|
708 |
^ knownViews
|
|
709 |
!
|
|
710 |
|
|
711 |
knownViews:aCollection
|
|
712 |
"set the collection of all known views - take care,
|
|
713 |
bad use of this will create funny results; use only for snapshot support"
|
|
714 |
|
|
715 |
knownViews := aCollection
|
|
716 |
!
|
|
717 |
|
|
718 |
timeOutBlocks
|
|
719 |
"return the collection of timeout blocks"
|
|
720 |
|
|
721 |
^ timeOutBlocks
|
|
722 |
!
|
|
723 |
|
|
724 |
timeOutBlocks:aCollection
|
|
725 |
"set the collection of timeout blocks - dangerous"
|
|
726 |
|
|
727 |
timeOutBlocks := aCollection
|
|
728 |
!
|
|
729 |
|
|
730 |
idleBlocks
|
|
731 |
"return the collection of idle blocks"
|
|
732 |
|
|
733 |
^ idleBlocks
|
|
734 |
!
|
|
735 |
|
|
736 |
idleBlocks:aCollection
|
|
737 |
"set the collection of idle blocks - dangerous"
|
|
738 |
|
|
739 |
idleBlocks := aCollection
|
|
740 |
! !
|
|
741 |
|
|
742 |
|
|
743 |
!DeviceWorkstation methodsFor:'keyboard mapping'!
|
|
744 |
|
|
745 |
sendKeyPress:untranslatedKey x:x y:y view:view controller:controller
|
|
746 |
"forward a key-press event to either controller or view,
|
|
747 |
the key is translated via the translation table."
|
|
748 |
|
|
749 |
|key xlatedKey|
|
|
750 |
|
|
751 |
key := untranslatedKey.
|
|
752 |
controlDown ifTrue:[
|
|
753 |
(key size == 1) ifTrue:[ "a single character"
|
|
754 |
key := ('Ctrl' , untranslatedKey asString) asSymbol
|
|
755 |
]
|
|
756 |
].
|
|
757 |
metaDown ifTrue:[
|
|
758 |
(untranslatedKey isMemberOf:Character) ifTrue:[
|
|
759 |
key := ('Cmd' , untranslatedKey asString) asSymbol
|
|
760 |
]
|
|
761 |
].
|
|
762 |
altDown ifTrue:[
|
|
763 |
(untranslatedKey isMemberOf:Character) ifTrue:[
|
|
764 |
key := ('Alt' , untranslatedKey asString) asSymbol
|
|
765 |
]
|
|
766 |
].
|
|
767 |
|
|
768 |
|
|
769 |
xlatedKey := keyboardMap valueFor:key.
|
|
770 |
xlatedKey notNil ifTrue:[
|
|
771 |
controller notNil ifTrue:[
|
|
772 |
controller keyPress:xlatedKey x:x y:y in:view
|
|
773 |
] ifFalse:[
|
|
774 |
view keyPress:xlatedKey x:x y:y
|
|
775 |
]
|
|
776 |
]
|
|
777 |
! !
|
|
778 |
|
|
779 |
!DeviceWorkstation methodsFor:'private'!
|
|
780 |
|
|
781 |
addKnownView:aView withId:aNumber
|
|
782 |
"add the View aView with Id:aNumber to the list of known views/id's"
|
|
783 |
|
|
784 |
knownViews isNil ifTrue:[
|
|
785 |
knownViews := (VariableArray new:100) grow:0.
|
|
786 |
knownIds := (VariableArray new:100) grow:0
|
|
787 |
].
|
|
788 |
knownViews add:aView.
|
|
789 |
knownIds add:aNumber.
|
|
790 |
lastView := aView.
|
|
791 |
lastId := aNumber
|
|
792 |
!
|
|
793 |
|
|
794 |
removeKnownView:aView
|
|
795 |
"remove aView from the list of known views/id's"
|
|
796 |
|
|
797 |
|index|
|
|
798 |
|
|
799 |
knownViews notNil ifTrue:[
|
|
800 |
index := knownViews identityIndexOf:aView ifAbsent:[0].
|
|
801 |
(index == 0) ifFalse:[
|
|
802 |
knownViews removeIndex:index.
|
|
803 |
knownIds removeIndex:index.
|
|
804 |
lastId := nil.
|
|
805 |
lastView := nil
|
|
806 |
]
|
|
807 |
]
|
|
808 |
!
|
|
809 |
|
|
810 |
viewFromId:aNumber
|
|
811 |
"given an Id, return the corresponding view"
|
|
812 |
|
|
813 |
|index|
|
|
814 |
|
|
815 |
(aNumber == lastId) ifTrue:[
|
|
816 |
^ lastView
|
|
817 |
].
|
|
818 |
index := knownIds identityIndexOf:aNumber ifAbsent:[0].
|
|
819 |
(index == 0) ifTrue:[^ nil].
|
|
820 |
lastView := knownViews at:index.
|
|
821 |
lastId := aNumber.
|
|
822 |
^ lastView
|
|
823 |
! !
|
|
824 |
|
|
825 |
!DeviceWorkstation methodsFor:'font stuff'!
|
|
826 |
|
|
827 |
fontFamilies
|
|
828 |
"return a set of all available font families on this display"
|
|
829 |
|
|
830 |
|allFonts families family|
|
|
831 |
|
|
832 |
allFonts := self listOfAvailableFonts.
|
|
833 |
allFonts isNil ifTrue:[^ nil].
|
|
834 |
families := Set new.
|
|
835 |
allFonts do:[:arr |
|
|
836 |
family := arr at:1.
|
|
837 |
family notNil ifTrue:[
|
|
838 |
families add:family
|
|
839 |
]
|
|
840 |
].
|
|
841 |
^ families
|
|
842 |
|
|
843 |
"Display fontFamilies"
|
|
844 |
!
|
|
845 |
|
|
846 |
facesInFamily:aFamilyName
|
|
847 |
"return a set of all available font faces in aFamily on this display"
|
|
848 |
|
|
849 |
|allFonts faces family face|
|
|
850 |
|
|
851 |
allFonts := self listOfAvailableFonts.
|
|
852 |
allFonts isNil ifTrue:[^ nil].
|
|
853 |
faces := Set new.
|
|
854 |
allFonts do:[:arr |
|
|
855 |
family := arr at:1.
|
|
856 |
(family = aFamilyName) ifTrue:[
|
|
857 |
face := arr at:2.
|
|
858 |
faces add:face
|
|
859 |
]
|
|
860 |
].
|
|
861 |
^ faces
|
|
862 |
|
|
863 |
"Display facesInFamily:'times'"
|
|
864 |
"Display facesInFamily:'fixed'"
|
|
865 |
!
|
|
866 |
|
|
867 |
stylesInFamily:aFamilyName face:aFaceName
|
|
868 |
"return a set of all available font styles in aFamily/aFace on this display"
|
|
869 |
|
|
870 |
|allFonts styles family face style|
|
|
871 |
|
|
872 |
allFonts := self listOfAvailableFonts.
|
|
873 |
allFonts isNil ifTrue:[^ nil].
|
|
874 |
styles := Set new.
|
|
875 |
allFonts do:[:arr |
|
|
876 |
family := arr at:1.
|
|
877 |
(family = aFamilyName) ifTrue:[
|
|
878 |
face := arr at:2.
|
|
879 |
(face = aFaceName) ifTrue:[
|
|
880 |
style := arr at:3.
|
|
881 |
styles add:style
|
|
882 |
]
|
|
883 |
]
|
|
884 |
].
|
|
885 |
^ styles
|
|
886 |
|
|
887 |
"Display stylesInFamily:'times' face:'medium'"
|
|
888 |
"Display stylesInFamily:'times' face:'bold'"
|
|
889 |
!
|
|
890 |
|
|
891 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName
|
|
892 |
"return a set of all available font sizes in aFamily/aFace/aStyle
|
|
893 |
on this display"
|
|
894 |
|
|
895 |
|allFonts sizes family face style size|
|
|
896 |
|
|
897 |
allFonts := self listOfAvailableFonts.
|
|
898 |
allFonts isNil ifTrue:[^ nil].
|
|
899 |
sizes := Set new.
|
|
900 |
allFonts do:[:arr |
|
|
901 |
family := arr at:1.
|
|
902 |
(family = aFamilyName) ifTrue:[
|
|
903 |
face := arr at:2.
|
|
904 |
(face = aFaceName) ifTrue:[
|
|
905 |
style := arr at:3.
|
|
906 |
(style = aStyleName) ifTrue:[
|
|
907 |
size := arr at:4.
|
|
908 |
sizes add:size
|
|
909 |
]
|
|
910 |
]
|
|
911 |
]
|
|
912 |
].
|
|
913 |
^ sizes
|
|
914 |
|
|
915 |
"Display sizesInFamily:'times' face:'medium' style:'italic'"
|
|
916 |
! !
|
|
917 |
|
|
918 |
!DeviceWorkstation methodsFor:'window stuff'!
|
|
919 |
|
|
920 |
setCursors:aCursor
|
|
921 |
"change the cursor of all views to aCursorId"
|
|
922 |
|
|
923 |
| id |
|
|
924 |
|
|
925 |
id := (aCursor on:self) id.
|
|
926 |
id notNil ifTrue:[
|
|
927 |
knownViews notNil ifTrue:[
|
|
928 |
knownViews do:[:aView |
|
|
929 |
aView id notNil ifTrue:[
|
|
930 |
self setCursor:id in:(aView id)
|
|
931 |
]
|
|
932 |
].
|
|
933 |
self synchronizeOutput
|
|
934 |
]
|
|
935 |
]
|
|
936 |
|
|
937 |
"Display setCursors:(Cursor wait"
|
|
938 |
"Display restoreCursors"
|
|
939 |
!
|
|
940 |
|
|
941 |
restoreCursors
|
|
942 |
"restore the cursors of all views to their current cursor"
|
|
943 |
|
|
944 |
knownViews notNil ifTrue:[
|
|
945 |
knownViews do:[:aView |
|
|
946 |
aView id notNil ifTrue:[
|
|
947 |
aView cursor notNil ifTrue:[
|
|
948 |
aView cursor id notNil ifTrue:[
|
|
949 |
self setCursor:(aView cursor id) in:(aView id)
|
|
950 |
]
|
|
951 |
]
|
|
952 |
]
|
|
953 |
].
|
|
954 |
self synchronizeOutput
|
|
955 |
]
|
|
956 |
|
|
957 |
"Display setCursors:(Cursor wait)"
|
|
958 |
"Display restoreCursors"
|
|
959 |
! !
|
|
960 |
|
|
961 |
!DeviceWorkstation methodsFor:'events'!
|
|
962 |
|
|
963 |
addIdleBlock:aBlock
|
|
964 |
"add the argument, aBlock to the list of idle-blocks; to be
|
|
965 |
evaluated whenever no events are pending"
|
|
966 |
|
|
967 |
idleBlocks isNil ifTrue:[
|
|
968 |
idleBlocks := VariableArray new
|
|
969 |
].
|
|
970 |
idleBlocks add:aBlock
|
|
971 |
!
|
|
972 |
|
|
973 |
removeIdleBlock:aBlock
|
|
974 |
"remove the argument, aBlock from the list of idle-blocks"
|
|
975 |
|
|
976 |
idleBlocks notNil ifTrue:[
|
|
977 |
idleBlocks remove:aBlock
|
|
978 |
]
|
|
979 |
!
|
|
980 |
|
|
981 |
addTimedBlock:aBlock after:delta
|
|
982 |
"add the argument, aBlock to the list of time-sceduled-blocks; to be
|
|
983 |
evaluated after delta seconds; the block will be removed after beeing
|
|
984 |
evaluated"
|
|
985 |
|
|
986 |
|now then|
|
|
987 |
|
|
988 |
now := OperatingSystem getMillisecondTime.
|
|
989 |
then := OperatingSystem millisecondTimeAdd:now and:(delta * 1000).
|
|
990 |
|
|
991 |
timeOutBlocks isNil ifTrue:[
|
|
992 |
timeOutBlocks := VariableArray with:aBlock.
|
|
993 |
timeOutTimes := VariableArray with:then
|
|
994 |
] ifFalse:[
|
|
995 |
timeOutBlocks add:aBlock.
|
|
996 |
timeOutTimes add:then
|
|
997 |
]
|
|
998 |
!
|
|
999 |
|
|
1000 |
removeTimedBlock:aBlock
|
|
1001 |
"remove the argument, aBlock from the list of time-sceduled-blocks"
|
|
1002 |
|
|
1003 |
|index|
|
|
1004 |
|
|
1005 |
timeOutBlocks notNil ifTrue:[
|
|
1006 |
index := timeOutBlocks identityIndexOf:aBlock startingAt:1.
|
|
1007 |
(index ~~ 0) ifTrue:[
|
|
1008 |
timeOutBlocks removeIndex:index.
|
|
1009 |
timeOutTimes removeIndex:index
|
|
1010 |
]
|
|
1011 |
]
|
|
1012 |
!
|
|
1013 |
|
|
1014 |
waitForEventOrTimeoutFor:aViewIdOrNil
|
|
1015 |
"wait for an event to arrive or the time to next timeout block
|
|
1016 |
has elepsed - since not all operatingsystems support the select-function
|
|
1017 |
(correctly) this method may return earlier; this has to be checked in
|
|
1018 |
the caller"
|
|
1019 |
|
|
1020 |
|n now thisTime delta minDelta|
|
|
1021 |
|
|
1022 |
(timeOutBlocks size == 0) ifTrue:[
|
|
1023 |
^ self dispatchEventFor:aViewIdOrNil withMask:nil
|
|
1024 |
].
|
|
1025 |
|
|
1026 |
now := OperatingSystem getMillisecondTime.
|
|
1027 |
thisTime := timeOutTimes at:1.
|
|
1028 |
(OperatingSystem millisecondTime:thisTime isAfter:now) ifFalse:[^ self].
|
|
1029 |
minDelta := OperatingSystem millisecondTimeDeltaBetween:thisTime
|
|
1030 |
and:now.
|
|
1031 |
n := timeOutBlocks size.
|
|
1032 |
(n > 1) ifTrue:[
|
|
1033 |
2 to:n do:[:index |
|
|
1034 |
thisTime := timeOutTimes at:index.
|
|
1035 |
thisTime == now ifTrue:[^ self].
|
|
1036 |
(OperatingSystem millisecondTime:thisTime isAfter:now)
|
|
1037 |
"(thisTime <= now)"
|
|
1038 |
ifFalse:[^ self].
|
|
1039 |
"delta := thisTime - now."
|
|
1040 |
delta := OperatingSystem
|
|
1041 |
millisecondTimeDeltaBetween:thisTime
|
|
1042 |
and:now.
|
|
1043 |
minDelta := delta min:minDelta
|
|
1044 |
]
|
|
1045 |
].
|
|
1046 |
(minDelta > 0) ifTrue:[
|
|
1047 |
(OperatingSystem getOSType = 'sco') ifTrue:[
|
|
1048 |
"SCO instant ShitStation has a bug here
|
|
1049 |
waiting always 1 sec in the select"
|
|
1050 |
|
|
1051 |
OperatingSystem millisecondDelay:10.
|
|
1052 |
^ self
|
|
1053 |
].
|
|
1054 |
OperatingSystem selectOn:(self displayFileDescriptor)
|
|
1055 |
withTimeOut:(minDelta / 1000)
|
|
1056 |
]
|
|
1057 |
!
|
|
1058 |
|
|
1059 |
evaluateTimeOutBlocks
|
|
1060 |
"walk through timeOutBlocks and evaluate those that need to be .."
|
|
1061 |
|
|
1062 |
|now index endIndex block tBlock blocksToEvaluate|
|
|
1063 |
|
|
1064 |
endIndex := timeOutBlocks size.
|
|
1065 |
(endIndex ~~ 0) ifTrue:[
|
|
1066 |
now := OperatingSystem getMillisecondTime.
|
|
1067 |
index := 1.
|
2
|
1068 |
blocksToEvaluate := nil.
|
0
|
1069 |
[index <= endIndex] whileTrue:[
|
|
1070 |
tBlock := timeOutTimes at:index.
|
|
1071 |
(OperatingSystem millisecondTime:tBlock isAfter:now) ifFalse:[
|
|
1072 |
block := timeOutBlocks at:index.
|
|
1073 |
timeOutTimes removeIndex:index.
|
|
1074 |
timeOutBlocks removeIndex:index.
|
|
1075 |
blocksToEvaluate isNil ifTrue:[
|
|
1076 |
blocksToEvaluate := OrderedCollection with:block
|
|
1077 |
] ifFalse:[
|
|
1078 |
blocksToEvaluate add:block
|
|
1079 |
].
|
|
1080 |
"block value. "
|
|
1081 |
endIndex := endIndex - 1
|
|
1082 |
] ifTrue:[
|
|
1083 |
index := index + 1
|
|
1084 |
]
|
|
1085 |
].
|
|
1086 |
blocksToEvaluate notNil ifTrue:[
|
|
1087 |
blocksToEvaluate do:[:aBlock |
|
|
1088 |
aBlock value
|
|
1089 |
]
|
|
1090 |
]
|
|
1091 |
]
|
|
1092 |
!
|
|
1093 |
|
|
1094 |
dispatch
|
|
1095 |
"mainloop - fetch event and process - this is done as long as any views
|
|
1096 |
exist"
|
|
1097 |
|
|
1098 |
Initializing isNil ifTrue:[ Initializing := false].
|
|
1099 |
dispatching isNil ifTrue:[ dispatching := false].
|
|
1100 |
|
|
1101 |
Initializing ifTrue:[^ self].
|
|
1102 |
dispatching ifTrue:[^ self].
|
|
1103 |
|
|
1104 |
dispatching := true.
|
|
1105 |
|
|
1106 |
[dispatching] whileTrue:[
|
|
1107 |
knownViews size == 0 ifTrue:[
|
|
1108 |
dispatching := false
|
|
1109 |
] ifFalse:[
|
|
1110 |
((knownViews size == 1) and:[(knownViews at:1) == RootView]) ifTrue:[
|
|
1111 |
dispatching := false
|
|
1112 |
] ifFalse:[
|
2
|
1113 |
self dispatchCheckingIdleAndTimeoutsFor:nil
|
0
|
1114 |
]
|
|
1115 |
].
|
|
1116 |
Processor yield
|
|
1117 |
]
|
|
1118 |
!
|
|
1119 |
|
|
1120 |
dispatchWhile:aBlock
|
|
1121 |
"get and process next event for any view as long as the argument-block
|
|
1122 |
evaluates to true"
|
|
1123 |
|
|
1124 |
self dispatchFor:nil while:aBlock
|
|
1125 |
!
|
|
1126 |
|
|
1127 |
dispatchFor:aViewIdOrNil while:aBlock
|
|
1128 |
"get and process next event for aViewId (nil = any) as long as the argument-block
|
|
1129 |
evaluates to true"
|
|
1130 |
|
|
1131 |
[aBlock value] whileTrue:[
|
|
1132 |
((idleBlocks size == 0) and:[timeOutBlocks size == 0]) ifTrue:[
|
|
1133 |
self dispatchEventFor:aViewIdOrNil withMask:nil
|
|
1134 |
] ifFalse:[
|
|
1135 |
self dispatchCheckingIdleAndTimeoutsFor:aViewIdOrNil
|
|
1136 |
]
|
|
1137 |
]
|
|
1138 |
!
|
|
1139 |
|
|
1140 |
dispatchEvent
|
|
1141 |
"get and process next event for any view"
|
|
1142 |
|
|
1143 |
self dispatchEventFor:nil withMask:nil
|
|
1144 |
!
|
|
1145 |
|
|
1146 |
dispatchCheckingIdleAndTimeoutsFor:aViewIdOrNil
|
|
1147 |
"if there is any event pending, process it;
|
|
1148 |
otherwise evaluate idle blocks (if any)"
|
|
1149 |
|
2
|
1150 |
|limit doingGC|
|
|
1151 |
|
0
|
1152 |
self eventPendingWithoutSync ifTrue:[
|
|
1153 |
self dispatchEventFor:aViewIdOrNil withMask:nil
|
|
1154 |
] ifFalse:[
|
2
|
1155 |
"no event pending - do background stuff"
|
|
1156 |
|
|
1157 |
"if its worth doing, collect a bit of garbage"
|
|
1158 |
limit := ObjectMemory incrementalGCLimit.
|
|
1159 |
doingGC := limit notNil and:[ObjectMemory oldSpaceAllocatedSinceLastGC > limit].
|
|
1160 |
doingGC ifTrue:[
|
|
1161 |
ObjectMemory gcStep.
|
|
1162 |
].
|
0
|
1163 |
(idleBlocks size ~~ 0) ifTrue:[
|
|
1164 |
idleBlocks do:[:aBlock |
|
|
1165 |
aBlock value
|
2
|
1166 |
].
|
0
|
1167 |
] ifFalse:[
|
2
|
1168 |
doingGC ifFalse:[
|
|
1169 |
"no idle blocks defined, no event pending;
|
|
1170 |
wait 'til either event arrives or time to next timeoutBlock
|
|
1171 |
has passed ..."
|
|
1172 |
self waitForEventOrTimeoutFor:nil
|
|
1173 |
]
|
0
|
1174 |
]
|
|
1175 |
].
|
2
|
1176 |
timeOutBlocks size ~~ 0 ifTrue:[
|
|
1177 |
self evaluateTimeOutBlocks
|
|
1178 |
].
|
0
|
1179 |
! !
|
|
1180 |
|
|
1181 |
!DeviceWorkstation methodsFor:'bitmap/window creation'!
|
|
1182 |
|
|
1183 |
createFaxImageFromArray:data width:w height:h type:type k:k msbFirst:msbFirst
|
|
1184 |
"create a new faxImage in the workstation
|
|
1185 |
type: 0 -> uncompressed
|
|
1186 |
1 -> group3 1D (k is void)
|
|
1187 |
2 -> group3 2D
|
|
1188 |
3 -> group4 2D (k is void)"
|
|
1189 |
|
|
1190 |
^ nil
|
|
1191 |
!
|
|
1192 |
|
|
1193 |
createBitmapWidth:w height:h
|
|
1194 |
"allocate a bitmap on the Xserver, the contents is undefined
|
|
1195 |
(i.e. random). Return a bitmap id or nil"
|
|
1196 |
|
|
1197 |
^ self subclassResponsibility
|
|
1198 |
!
|
|
1199 |
|
|
1200 |
createPixmapWidth:w height:h depth:d
|
|
1201 |
"allocate a pixmap on the Xserver, the contents is undefined
|
|
1202 |
(i.e. random). Return a bitmap id or nil"
|
|
1203 |
|
|
1204 |
^ self subclassResponsibility
|
|
1205 |
!
|
|
1206 |
|
|
1207 |
createBitmapFromFile:aString for:aForm
|
|
1208 |
^ self subclassResponsibility
|
|
1209 |
!
|
|
1210 |
|
|
1211 |
createBitmapFromArray:anArray width:w height:h
|
|
1212 |
^ self subclassResponsibility
|
|
1213 |
!
|
|
1214 |
|
|
1215 |
destroyPixmap:aDrawableId
|
|
1216 |
^ self subclassResponsibility
|
|
1217 |
!
|
|
1218 |
|
|
1219 |
destroyFaxImage:aFaxImageId
|
|
1220 |
^ self subclassResponsibility
|
|
1221 |
!
|
|
1222 |
|
|
1223 |
rootWindowFor:aView
|
|
1224 |
^ self subclassResponsibility
|
|
1225 |
!
|
|
1226 |
|
|
1227 |
createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight
|
|
1228 |
^ self subclassResponsibility
|
|
1229 |
!
|
|
1230 |
|
|
1231 |
destroyView:aView withId:aWindowId
|
|
1232 |
^ self subclassResponsibility
|
|
1233 |
!
|
|
1234 |
|
|
1235 |
destroyGC:aGCId
|
|
1236 |
^ self subclassResponsibility
|
|
1237 |
!
|
|
1238 |
|
|
1239 |
gcFor:aDrawableId
|
|
1240 |
^ self subclassResponsibility
|
|
1241 |
! !
|
|
1242 |
|
|
1243 |
!DeviceWorkstation methodsFor:'font stuff'!
|
|
1244 |
|
|
1245 |
listOfAvailableFonts
|
|
1246 |
"return a list with all available font names on this display"
|
|
1247 |
|
|
1248 |
^ self subclassResponsibility
|
|
1249 |
!
|
|
1250 |
|
|
1251 |
getFontWithFamily:familyString face:faceString
|
|
1252 |
style:styleString size:sizeArg encoding:encodingSym
|
|
1253 |
|
|
1254 |
"try to get the specified font, if not available, try next smaller
|
|
1255 |
font"
|
|
1256 |
|
|
1257 |
^ self subclassResponsibility
|
|
1258 |
!
|
|
1259 |
|
|
1260 |
getDefaultFont
|
|
1261 |
"return a default font id - used when class Font cannot
|
|
1262 |
find anything usable"
|
|
1263 |
|
|
1264 |
^ self subclassResponsibility
|
|
1265 |
!
|
|
1266 |
|
|
1267 |
releaseFont:aFontId
|
|
1268 |
^ self subclassResponsibility
|
|
1269 |
!
|
|
1270 |
|
|
1271 |
ascentOf:aFontId
|
|
1272 |
^ self subclassResponsibility
|
|
1273 |
!
|
|
1274 |
|
|
1275 |
descentOf:aFontId
|
|
1276 |
^ self subclassResponsibility
|
|
1277 |
!
|
|
1278 |
|
|
1279 |
minWidthOfFont:aFontId
|
|
1280 |
^ self subclassResponsibility
|
|
1281 |
!
|
|
1282 |
|
|
1283 |
maxWidthOfFont:aFontId
|
|
1284 |
^ self subclassResponsibility
|
|
1285 |
!
|
|
1286 |
|
|
1287 |
widthOf:aString inFont:aFontId
|
|
1288 |
^ self subclassResponsibility
|
|
1289 |
!
|
|
1290 |
|
|
1291 |
widthOf:aString from:index1 to:index2 inFont:aFontId
|
|
1292 |
^ self subclassResponsibility
|
|
1293 |
! !
|
|
1294 |
|
|
1295 |
!DeviceWorkstation methodsFor:'cursor stuff'!
|
|
1296 |
|
|
1297 |
destroyCursor:aCursorId
|
|
1298 |
^ self subclassResponsibility
|
|
1299 |
!
|
|
1300 |
|
|
1301 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy
|
|
1302 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot"
|
|
1303 |
^ self subclassResponsibility
|
|
1304 |
!
|
|
1305 |
|
|
1306 |
createCursorShape:aShape
|
|
1307 |
"create a cursor given a shape-symbol"
|
|
1308 |
|
|
1309 |
^ self subclassResponsibility
|
|
1310 |
!
|
|
1311 |
|
|
1312 |
colorCursor:aCursorId foreground:fgColor background:bgColor
|
|
1313 |
"change a cursors colors"
|
|
1314 |
|
|
1315 |
^ self subclassResponsibility
|
|
1316 |
!
|
|
1317 |
|
|
1318 |
grabKeyboardIn:aWindowId
|
|
1319 |
"grab the keyboard - all keyboard input will be sent to aWindow"
|
|
1320 |
|
|
1321 |
^ self subclassResponsibility
|
|
1322 |
!
|
|
1323 |
|
|
1324 |
ungrabKeyboard
|
|
1325 |
"release the keyboard"
|
|
1326 |
^ self subclassResponsibility
|
|
1327 |
!
|
|
1328 |
|
|
1329 |
grabPointerIn:aWindowId
|
|
1330 |
"grap the pointer"
|
|
1331 |
^ self subclassResponsibility
|
|
1332 |
!
|
|
1333 |
|
|
1334 |
ungrabPointer
|
|
1335 |
"release the pointer"
|
|
1336 |
^ self subclassResponsibility
|
|
1337 |
! !
|
|
1338 |
|
|
1339 |
!DeviceWorkstation methodsFor:'color stuff'!
|
|
1340 |
|
|
1341 |
listOfAvailableColors
|
|
1342 |
"return a list of all available colornames;
|
|
1343 |
This method should not be used, since colornames are
|
|
1344 |
very X specific."
|
|
1345 |
|
|
1346 |
^ #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black')
|
|
1347 |
!
|
|
1348 |
|
|
1349 |
freeColor:colorIndex
|
|
1350 |
"free a color on the display, when its no longer needed"
|
|
1351 |
|
|
1352 |
^ self subclassResponsibility
|
|
1353 |
!
|
|
1354 |
|
|
1355 |
colorRed:redVal green:greenVal blue:blueVal
|
|
1356 |
"allocate a color with rgb values (0..100) - return index"
|
|
1357 |
|
|
1358 |
^ self subclassResponsibility
|
|
1359 |
!
|
|
1360 |
|
|
1361 |
colorNamed:aString
|
|
1362 |
"allocate a color with color name - return index.
|
|
1363 |
Colors should not be allocated by name, since most colors
|
|
1364 |
are X specific - get colors by rgb instead."
|
|
1365 |
|
|
1366 |
"support some of them ..."
|
|
1367 |
|
|
1368 |
self getRGBFromName:aString into:[:r :g :b |
|
|
1369 |
^ self colorRed:r green:g blue:b
|
|
1370 |
].
|
|
1371 |
^ nil
|
|
1372 |
!
|
|
1373 |
|
|
1374 |
colorCell
|
|
1375 |
"allocate a color - return index"
|
|
1376 |
|
|
1377 |
^ self subclassResponsibility
|
|
1378 |
!
|
|
1379 |
|
|
1380 |
setColor:index red:redVal green:greenVal blue:blueVal
|
|
1381 |
"change color in map at:index to rgb (0..100)"
|
|
1382 |
|
|
1383 |
^ self subclassResponsibility
|
|
1384 |
!
|
|
1385 |
|
|
1386 |
getRGBFromName:colorName into:aBlock
|
|
1387 |
"get rgb components (0..100) of color named colorName,
|
|
1388 |
and evaluate the 3-arg block, aBlock with them.
|
|
1389 |
The method here only handles some often used colors;
|
|
1390 |
getRGBFromName should not be used, since colorNames other
|
|
1391 |
than those below are X specific."
|
|
1392 |
|
|
1393 |
|idx names triple|
|
|
1394 |
|
|
1395 |
names := #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black').
|
|
1396 |
idx := names indexOf:colorName ifAbsent:[0].
|
|
1397 |
idx == 0 ifTrue:[
|
|
1398 |
idx := (names asLowercase) indexOf:colorName ifAbsent:[0].
|
|
1399 |
].
|
|
1400 |
idx == 0 ifFalse:[
|
|
1401 |
triple := #(
|
|
1402 |
(100 0 0) "red"
|
|
1403 |
( 0 100 0) "green"
|
|
1404 |
( 0 0 100) "blue"
|
|
1405 |
(100 100 0) "yellow"
|
|
1406 |
(100 0 100) "magenta"
|
|
1407 |
( 0 100 100) "cyan"
|
|
1408 |
(100 100 100) "white"
|
|
1409 |
( 0 0 0) "black"
|
|
1410 |
) at:idx.
|
|
1411 |
|
|
1412 |
^ aBlock value:(triple at:1)
|
|
1413 |
value:(triple at:2)
|
|
1414 |
value:(triple at:3)
|
|
1415 |
].
|
|
1416 |
^ nil
|
|
1417 |
!
|
|
1418 |
|
|
1419 |
getRGBFrom:index into:aBlock
|
|
1420 |
"get rgb components (0..100) of color in map at:index,
|
|
1421 |
and evaluate the 3-arg block, aBlock with them"
|
|
1422 |
|
|
1423 |
^ self subclassResponsibility
|
|
1424 |
! !
|
|
1425 |
|
|
1426 |
!DeviceWorkstation methodsFor:'window stuff'!
|
|
1427 |
|
|
1428 |
setBackingStore:how in:aWindowId
|
|
1429 |
"turn on/off backing-store for a window"
|
|
1430 |
^ self subclassResponsibility
|
|
1431 |
!
|
|
1432 |
|
|
1433 |
setSaveUnder:yesOrNo in:aWindowId
|
|
1434 |
"turn on/off save-under for a window"
|
|
1435 |
^ self subclassResponsibility
|
|
1436 |
!
|
|
1437 |
|
|
1438 |
setWindowBackground:aColorIndex in:aWindowId
|
|
1439 |
"set the windows background color"
|
|
1440 |
|
|
1441 |
^ self subclassResponsibility
|
|
1442 |
!
|
|
1443 |
|
|
1444 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId
|
|
1445 |
"set the windows background pattern to be a form"
|
|
1446 |
^ self subclassResponsibility
|
|
1447 |
!
|
|
1448 |
|
|
1449 |
setWindowBorderColor:aColorIndex in:aWindowId
|
|
1450 |
"set the windows border color"
|
|
1451 |
^ self subclassResponsibility
|
|
1452 |
!
|
|
1453 |
|
|
1454 |
setWindowBorderPixmap:aPixmapId in:aWindowId
|
|
1455 |
^ self subclassResponsibility
|
|
1456 |
!
|
|
1457 |
|
|
1458 |
setWindowBorderWidth:aNumber in:aWindowId
|
|
1459 |
^ self subclassResponsibility
|
|
1460 |
!
|
|
1461 |
|
|
1462 |
setWindowBorderShape:aPixmapId in:aWindowId
|
|
1463 |
^ self subclassResponsibility
|
|
1464 |
!
|
|
1465 |
|
|
1466 |
setWindowShape:aPixmapId in:aWindowId
|
|
1467 |
^ self subclassResponsibility
|
|
1468 |
!
|
|
1469 |
|
|
1470 |
setCursor:aCursorId in:aWindowId
|
|
1471 |
^ self subclassResponsibility
|
|
1472 |
!
|
|
1473 |
|
|
1474 |
setWindowName:aString in:aWindowId
|
|
1475 |
^ self subclassResponsibility
|
|
1476 |
!
|
|
1477 |
|
|
1478 |
setIconName:aString in:aWindowId
|
|
1479 |
^ self subclassResponsibility
|
|
1480 |
!
|
|
1481 |
|
|
1482 |
setWindowIcon:aForm in:aWindowId
|
|
1483 |
^ self subclassResponsibility
|
|
1484 |
!
|
|
1485 |
|
|
1486 |
setWindowIconWindow:aView in:aWindowId
|
|
1487 |
^ self subclassResponsibility
|
|
1488 |
!
|
|
1489 |
|
|
1490 |
clearWindow:aWindowId
|
|
1491 |
^ self subclassResponsibility
|
|
1492 |
!
|
|
1493 |
|
|
1494 |
clearRectangleX:x y:y width:width height:height in:aWindowId
|
|
1495 |
^ self subclassResponsibility
|
|
1496 |
!
|
|
1497 |
|
|
1498 |
mapWindow:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h
|
|
1499 |
^ self subclassResponsibility
|
|
1500 |
!
|
|
1501 |
|
|
1502 |
mapWindow:aWindowId
|
|
1503 |
^ self subclassResponsibility
|
|
1504 |
!
|
|
1505 |
|
|
1506 |
unmapWindow:aWindowId
|
|
1507 |
^ self subclassResponsibility
|
|
1508 |
!
|
|
1509 |
|
|
1510 |
raiseWindow:aWindowId
|
|
1511 |
^ self subclassResponsibility
|
|
1512 |
!
|
|
1513 |
|
|
1514 |
lowerWindow:aWindowId
|
|
1515 |
^ self subclassResponsibility
|
|
1516 |
!
|
|
1517 |
|
|
1518 |
moveWindow:aWindowId x:x y:y
|
|
1519 |
^ self subclassResponsibility
|
|
1520 |
!
|
|
1521 |
|
|
1522 |
resizeWindow:aWindowId width:w height:h
|
|
1523 |
^ self subclassResponsibility
|
|
1524 |
!
|
|
1525 |
|
|
1526 |
moveResizeWindow:aWindowId x:x y:y width:w height:h
|
|
1527 |
^ self subclassResponsibility
|
|
1528 |
! !
|
|
1529 |
|
|
1530 |
!DeviceWorkstation methodsFor:'graphic context stuff'!
|
|
1531 |
|
|
1532 |
setForeground:fgColorIndex in:aGCId
|
|
1533 |
"set foreground color to be drawn with"
|
|
1534 |
^ self subclassResponsibility
|
|
1535 |
!
|
|
1536 |
|
|
1537 |
setBackground:bgColorIndex in:aGCId
|
|
1538 |
"set background color to be drawn with"
|
|
1539 |
^ self subclassResponsibility
|
|
1540 |
!
|
|
1541 |
|
|
1542 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId
|
|
1543 |
"set foreground and background colors to be drawn with"
|
|
1544 |
^ self subclassResponsibility
|
|
1545 |
!
|
|
1546 |
|
|
1547 |
setForeground:fgColor background:bgColor mask:aBitmapId in:aGCId
|
|
1548 |
"set foreground and background colors to be drawn with using mask or
|
|
1549 |
solid (if aBitmapId is nil)"
|
|
1550 |
^ self subclassResponsibility
|
|
1551 |
!
|
|
1552 |
|
|
1553 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
|
|
1554 |
"set line attributes"
|
|
1555 |
^ self subclassResponsibility
|
|
1556 |
!
|
|
1557 |
|
|
1558 |
setForeground:fgColor background:bgColor mask:aBitmapId lineWidth:lw in:aGCId
|
|
1559 |
"set foreground and background colors to be drawn with using mask or
|
|
1560 |
solid (if aBitmapId is nil); also set lineWidth"
|
|
1561 |
^ self subclassResponsibility
|
|
1562 |
!
|
|
1563 |
|
|
1564 |
setFunction:aFunctionSymbol in:aGCId
|
|
1565 |
"set alu function to be drawn with"
|
|
1566 |
^ self subclassResponsibility
|
|
1567 |
!
|
|
1568 |
|
|
1569 |
setFont:aFontId in:aGCId
|
|
1570 |
"set font to be drawn in"
|
|
1571 |
^ self subclassResponsibility
|
|
1572 |
!
|
|
1573 |
|
|
1574 |
setPixmapMask:aPixmapId in:aGCId
|
|
1575 |
"set or clear the drawing mask - a pixmap mask providing full color"
|
|
1576 |
|
|
1577 |
^ self subclassResponsibility
|
|
1578 |
!
|
|
1579 |
|
|
1580 |
setBitmapMask:aBitmapId in:aGCId
|
|
1581 |
"set or clear the drawing mask - a bitmap mask using current fg/bg"
|
|
1582 |
^ self subclassResponsibility
|
|
1583 |
!
|
|
1584 |
|
|
1585 |
setMaskOriginX:orgX y:orgY in:aGCid
|
|
1586 |
"set the mask origin"
|
|
1587 |
^ self subclassResponsibility
|
|
1588 |
!
|
|
1589 |
|
|
1590 |
setClipByChildren:aBool in:aGCId
|
|
1591 |
"enable/disable drawing into child views"
|
|
1592 |
^ self subclassResponsibility
|
|
1593 |
!
|
|
1594 |
|
|
1595 |
noClipIn:aGCId
|
|
1596 |
"disable clipping rectangle"
|
|
1597 |
^ self subclassResponsibility
|
|
1598 |
!
|
|
1599 |
|
|
1600 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:aGCId
|
|
1601 |
"clip to a rectangle"
|
|
1602 |
^ self subclassResponsibility
|
|
1603 |
!
|
|
1604 |
|
|
1605 |
setGraphicsExposures:aBoolean in:aGCId
|
|
1606 |
"set or clear the graphics exposures flag"
|
|
1607 |
|
|
1608 |
^ self subclassResponsibility
|
|
1609 |
! !
|
|
1610 |
|
|
1611 |
!DeviceWorkstation methodsFor:'retrieving pixels'!
|
|
1612 |
|
|
1613 |
getPixelX:x y:y from:aDrawableId
|
|
1614 |
"return the pixel value at x/y"
|
|
1615 |
|
|
1616 |
^ self subclassResponsibility
|
|
1617 |
! !
|
|
1618 |
|
|
1619 |
!DeviceWorkstation methodsFor:'drawing'!
|
|
1620 |
|
|
1621 |
displayString:aString x:x y:y in:aDrawableId with:aGCId
|
|
1622 |
"draw a string - draw foreground only"
|
|
1623 |
|
|
1624 |
^ self subclassResponsibility
|
|
1625 |
!
|
|
1626 |
|
|
1627 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId
|
|
1628 |
"draw part of a string - draw foreground only"
|
|
1629 |
|
|
1630 |
self displayString:(aString copyFrom:index1 to:index2)
|
|
1631 |
x:x y:y in:aDrawableId with:aGCId
|
|
1632 |
!
|
|
1633 |
|
|
1634 |
displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId
|
|
1635 |
"draw a string - draw both foreground and background"
|
|
1636 |
|
|
1637 |
^ self subclassResponsibility
|
|
1638 |
!
|
|
1639 |
|
|
1640 |
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId
|
|
1641 |
"draw part of a string - draw both foreground and background"
|
|
1642 |
|
|
1643 |
self displayOpaqueString:(aString copyFrom:index1 to:index2)
|
|
1644 |
x:x y:y in:aDrawableId with:aGCId
|
|
1645 |
!
|
|
1646 |
|
|
1647 |
drawPointX:x y:y in:aDrawableId with:aGCId
|
|
1648 |
"draw a point"
|
|
1649 |
|
|
1650 |
^ self subclassResponsibility
|
|
1651 |
!
|
|
1652 |
|
|
1653 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
|
|
1654 |
"draw a line"
|
|
1655 |
^ self subclassResponsibility
|
|
1656 |
!
|
|
1657 |
|
|
1658 |
drawRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
|
|
1659 |
"draw a rectangle"
|
|
1660 |
|
|
1661 |
^ self subclassResponsibility
|
|
1662 |
!
|
|
1663 |
|
|
1664 |
drawPolygon:aPolygon in:aDrawableId with:aGCId
|
|
1665 |
"draw a polygon"
|
|
1666 |
^ self subclassResponsibility
|
|
1667 |
!
|
|
1668 |
|
|
1669 |
copyFromFaxImage:sourceId x:srcX y:srcY to:destId x:dstX y:dstY
|
|
1670 |
width:w height:h with:aGCId scaleX:scaleX scaleY:scaleY
|
|
1671 |
"do a bit-blt"
|
|
1672 |
^ self subclassResponsibility
|
|
1673 |
!
|
|
1674 |
|
|
1675 |
copyFromId:sourceId x:srcX y:srcY to:destId x:dstX y:dstY
|
|
1676 |
width:w height:h with:aGCId
|
|
1677 |
"do a bit-blt"
|
|
1678 |
^ self subclassResponsibility
|
|
1679 |
!
|
|
1680 |
|
|
1681 |
copyPlaneFromId:sourceId x:srcX y:srcY to:destId x:dstX y:dstY
|
|
1682 |
width:w height:h with:aGCId
|
|
1683 |
"do a bit-blt"
|
|
1684 |
|
|
1685 |
^ self subclassResponsibility
|
|
1686 |
!
|
|
1687 |
|
|
1688 |
drawArcX:x y:y w:width h:height from:startAngle angle:angle
|
|
1689 |
in:aDrawableId with:aGCId
|
|
1690 |
"draw an arc"
|
|
1691 |
^ self subclassResponsibility
|
|
1692 |
!
|
|
1693 |
|
|
1694 |
fillArcX:x y:y w:width h:height from:startAngle angle:angle
|
|
1695 |
in:aDrawableId with:aGCId
|
|
1696 |
"fill an arc"
|
|
1697 |
|
|
1698 |
^ self subclassResponsibility
|
|
1699 |
!
|
|
1700 |
|
|
1701 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
|
|
1702 |
"fill a rectangle"
|
|
1703 |
^ self subclassResponsibility
|
|
1704 |
!
|
|
1705 |
|
|
1706 |
fillPolygon:aPolygon in:aDrawableId with:aGCId
|
|
1707 |
"fill a polygon"
|
|
1708 |
^ self subclassResponsibility
|
|
1709 |
!
|
|
1710 |
|
|
1711 |
drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight
|
|
1712 |
x:srcx y:srcy
|
|
1713 |
into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId
|
|
1714 |
"draw a bitimage which has depth id, width iw and height ih into
|
|
1715 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
|
|
1716 |
It has to be checked elsewhere, that server can do it with the given
|
|
1717 |
depth; also it is assumed, that the colormap is setup correctly"
|
|
1718 |
^ self subclassResponsibility
|
|
1719 |
! !
|
|
1720 |
|
|
1721 |
!DeviceWorkstation methodsFor:'events'!
|
|
1722 |
|
|
1723 |
eventMaskFor:anEventSymbol
|
|
1724 |
^ self subclassResponsibility
|
|
1725 |
!
|
|
1726 |
|
|
1727 |
setEventMask:aMask in:aWindowId
|
|
1728 |
^ self subclassResponsibility
|
|
1729 |
!
|
|
1730 |
|
|
1731 |
dispatchEventFor:aViewIdOrNil withMask:eventMask
|
|
1732 |
"central event handling method:
|
|
1733 |
get next event and send appropriate message to the view or the controller,
|
|
1734 |
if the view has one.;
|
|
1735 |
If the argument aViewIdOrNil is nil, events for any view are processed,
|
|
1736 |
otherwise only events for the view with given id are processed
|
|
1737 |
(in this case, nothing is done if no events are pending);
|
|
1738 |
if the argument aMask is nonNil, only events for this eventMask are
|
|
1739 |
handled;"
|
|
1740 |
^ self subclassResponsibility
|
|
1741 |
!
|
|
1742 |
|
|
1743 |
dispatchExposeEventsFor:aViewId
|
|
1744 |
"handle all pending exposes until a noExpose or graphicsExpose arrives;
|
|
1745 |
then exit loop"
|
|
1746 |
^ self subclassResponsibility
|
|
1747 |
!
|
|
1748 |
|
|
1749 |
disposeEventsWithMask:aMask for:aWindowId
|
|
1750 |
"dispose (throw away) specific events"
|
|
1751 |
^ self subclassResponsibility
|
|
1752 |
!
|
|
1753 |
|
|
1754 |
exposeEventsFor:aViewId do:aBlock
|
|
1755 |
"for every pending expose event for aViewId evaluate the argument
|
|
1756 |
aBlock with 4 arguments"
|
|
1757 |
|
|
1758 |
^ self subclassResponsibility
|
|
1759 |
!
|
|
1760 |
|
|
1761 |
eventPending
|
|
1762 |
"return true, if any event is pending"
|
|
1763 |
^ self subclassResponsibility
|
|
1764 |
!
|
|
1765 |
|
|
1766 |
eventPendingWithoutSync
|
|
1767 |
"return true, if any event is pending"
|
|
1768 |
^ self subclassResponsibility
|
|
1769 |
!
|
|
1770 |
|
|
1771 |
eventsPending:anEventMask for:aWindowId
|
|
1772 |
"return true, if any of the masked events is pending"
|
|
1773 |
|
|
1774 |
^ self subclassResponsibility
|
|
1775 |
!
|
|
1776 |
|
|
1777 |
eventPending:anEventSymbol for:aWindowId
|
|
1778 |
"return true, if a specific event is pending"
|
|
1779 |
^ self subclassResponsibility
|
|
1780 |
!
|
|
1781 |
|
|
1782 |
nextEventFor:aViewIdOrNil withMask:eventMask sendTo:eventDispatcher
|
|
1783 |
"get next event and send an appropriate message to eventDispatcher.
|
|
1784 |
(see below for the 2 exceptions)
|
|
1785 |
If the argument aViewIdOrNil is nil, events for any view are processed,
|
|
1786 |
otherwise only events for the view with given id are processed
|
|
1787 |
(in this case, nothing is done if no events are pending);
|
|
1788 |
if the argument aMask is nonNil, only events for this eventMask are
|
|
1789 |
handled.
|
|
1790 |
GraphicExpose events are sent to the view directly instead of the eventDisp
|
|
1791 |
atcher.
|
|
1792 |
This must be done since queueing those events does not make sense (they are
|
|
1793 |
the
|
|
1794 |
responses to bitBlt operations and must be handled immediately."
|
|
1795 |
^ self subclassResponsibility
|
|
1796 |
! !
|