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