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