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