changeset 3397 | 55d7642b74f6 |
parent 3396 | 18f99e9fc5ec |
child 3398 | 763d33dbd23a |
3396:18f99e9fc5ec | 3397:55d7642b74f6 |
---|---|
1 " |
1 " |
2 COPYRIGHT (c) 1993 by Claus Gittinger |
2 COPYRIGHT (c) 1993 by Claus Gittinger |
3 All Rights Reserved |
3 All Rights Reserved |
4 |
4 |
5 This software is furnished under a license and may be used |
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 |
6 only in accordance with the terms of that license and with the |
7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
11 " |
11 " |
12 |
12 |
13 "{ Package: 'stx:libview' }" |
13 "{ Package: 'stx:libview' }" |
14 |
14 |
15 HostGraphicsDevice subclass:#DeviceWorkstation |
15 HostGraphicsDevice subclass:#DeviceWorkstation |
16 instanceVariableNames:'visualType monitorType depth ncells bitsPerRGB bitsRed bitsGreen |
16 instanceVariableNames:'visualType monitorType depth ncells bitsPerRGB bitsRed bitsGreen |
17 bitsBlue redMask greenMask blueMask redShift greenShift blueShift |
17 bitsBlue redMask greenMask blueMask redShift greenShift blueShift |
18 hasColors hasGreyscales width height widthMM heightMM |
18 hasColors hasGreyscales width height widthMM heightMM |
19 resolutionHor resolutionVer idToTableIndexMapping knownViews |
19 resolutionHor resolutionVer idToTableIndexMapping knownViews |
20 knownIds knownBitmaps knownBitmapIds dispatching dispatchProcess |
20 knownIds knownBitmaps knownBitmapIds dispatching dispatchProcess |
21 exitOnLastClose ctrlDown shiftDown metaDown altDown superDown |
21 exitOnLastClose ctrlDown shiftDown metaDown altDown superDown |
22 motionEventCompression lastId lastView keyboardMap rootView |
22 motionEventCompression lastId lastView keyboardMap rootView |
23 isSlow activeKeyboardGrab activePointerGrab buttonTranslation |
23 isSlow activeKeyboardGrab activePointerGrab buttonTranslation |
24 multiClickTimeDelta altModifiers metaModifiers ctrlModifiers |
24 multiClickTimeDelta altModifiers metaModifiers ctrlModifiers |
25 shiftModifiers superModifiers supportsDeepIcons preferredIconSize |
25 shiftModifiers superModifiers supportsDeepIcons preferredIconSize |
26 ditherColors fixColors numFixRed numFixGreen numFixBlue |
26 ditherColors fixColors numFixRed numFixGreen numFixBlue |
27 fixGrayColors copyBuffer lastCopyBuffer blackColor whiteColor |
27 fixGrayColors copyBuffer lastCopyBuffer blackColor whiteColor |
28 focusMode activeView clipBoardEncoding focusView |
28 focusMode activeView clipBoardEncoding focusView |
29 deviceErrorSignal deviceIOErrorSignal' |
29 deviceErrorSignal deviceIOErrorSignal' |
30 classVariableNames:'ButtonTranslation MultiClickTimeDelta DeviceErrorSignal |
30 classVariableNames:'ButtonTranslation MultiClickTimeDelta DeviceErrorSignal |
31 DeviceIOErrorSignal DeviceIOTimeoutErrorSignal ErrorPrinting |
31 DeviceIOErrorSignal DeviceIOTimeoutErrorSignal ErrorPrinting |
32 DefaultScreen AllScreens CurrentScreenQuerySignal |
32 DefaultScreen AllScreens CurrentScreenQuerySignal |
33 LastActiveScreen LastActiveProcess WindowsRightButtonBehavior |
33 LastActiveScreen LastActiveProcess WindowsRightButtonBehavior |
34 ExitOnLastClose DrawingOnClosedDeviceSignal' |
34 ExitOnLastClose DrawingOnClosedDeviceSignal' |
35 poolDictionaries:'' |
35 poolDictionaries:'' |
36 category:'Interface-Graphics' |
36 category:'Interface-Graphics' |
37 ! |
37 ! |
38 |
38 |
39 !DeviceWorkstation class methodsFor:'documentation'! |
39 !DeviceWorkstation class methodsFor:'documentation'! |
40 |
40 |
41 copyright |
41 copyright |
42 " |
42 " |
43 COPYRIGHT (c) 1993 by Claus Gittinger |
43 COPYRIGHT (c) 1993 by Claus Gittinger |
44 All Rights Reserved |
44 All Rights Reserved |
45 |
45 |
46 This software is furnished under a license and may be used |
46 This software is furnished under a license and may be used |
47 only in accordance with the terms of that license and with the |
47 only in accordance with the terms of that license and with the |
48 inclusion of the above copyright notice. This software may not |
48 inclusion of the above copyright notice. This software may not |
49 be provided or otherwise made available to, or used by, any |
49 be provided or otherwise made available to, or used by, any |
70 monitorType <Symbol> one of #monochrome, #color, #unknown |
70 monitorType <Symbol> one of #monochrome, #color, #unknown |
71 |
71 |
72 depth <SmallInteger> bits per color |
72 depth <SmallInteger> bits per color |
73 ncells <SmallInteger> number of colors (i.e. colormap size; not always == 2^depth) |
73 ncells <SmallInteger> number of colors (i.e. colormap size; not always == 2^depth) |
74 bitsPerRGB <SmallInteger> number of valid bits per rgb component |
74 bitsPerRGB <SmallInteger> number of valid bits per rgb component |
75 (actual number taken in A/D converter; not all devices report the true value) |
75 (actual number taken in A/D converter; not all devices report the true value) |
76 bitsRed <SmallInteger> number of red bits (only valid for TrueColor displays) |
76 bitsRed <SmallInteger> number of red bits (only valid for TrueColor displays) |
77 bitsGreen <SmallInteger> number of green bits (only valid for TrueColor displays) |
77 bitsGreen <SmallInteger> number of green bits (only valid for TrueColor displays) |
78 bitsBlue <SmallInteger> number of blue bits (only valid for TrueColor displays) |
78 bitsBlue <SmallInteger> number of blue bits (only valid for TrueColor displays) |
79 redMask <SmallInteger> shifted red mask (only useful for TrueColor displays) |
79 redMask <SmallInteger> shifted red mask (only useful for TrueColor displays) |
80 greenMask <SmallInteger> shifted green mask (only useful for TrueColor displays) |
80 greenMask <SmallInteger> shifted green mask (only useful for TrueColor displays) |
98 knownBitmaps <Collection> all known device bitmaps |
98 knownBitmaps <Collection> all known device bitmaps |
99 knownBitmapIds <Collection> corresponding device-bitmap ids |
99 knownBitmapIds <Collection> corresponding device-bitmap ids |
100 |
100 |
101 dispatching <Boolean> true, if currently in dispatch loop |
101 dispatching <Boolean> true, if currently in dispatch loop |
102 exitDispatchOnLastWindowClose |
102 exitDispatchOnLastWindowClose |
103 <Boolean> if true, dispatch is finished when the last |
103 <Boolean> if true, dispatch is finished when the last |
104 window closes (default:true). |
104 window closes (default:true). |
105 |
105 |
106 ctrlDown <Boolean> true, if control key currently pressed |
106 ctrlDown <Boolean> true, if control key currently pressed |
107 shiftDown <Boolean> true, if shift key currently pressed |
107 shiftDown <Boolean> true, if shift key currently pressed |
108 metaDown <Boolean> true, if meta key (cmd-key) is currently pressed |
108 metaDown <Boolean> true, if meta key (cmd-key) is currently pressed |
109 altDown <Boolean> true, if alt key is currently pressed |
109 altDown <Boolean> true, if alt key is currently pressed |
110 |
110 |
111 motionEventCompression |
111 motionEventCompression |
112 <Boolean> if true motion events are compressed |
112 <Boolean> if true motion events are compressed |
113 (obsolete: now done in sensor) |
113 (obsolete: now done in sensor) |
114 |
114 |
115 lastId <Number> the id of the last events view (internal) |
115 lastId <Number> the id of the last events view (internal) |
116 lastView <View> the last events view (internal, for faster id->view mapping) |
116 lastView <View> the last events view (internal, for faster id->view mapping) |
117 |
117 |
118 keyboardMap <KeyBdMap> mapping for keys |
118 keyboardMap <KeyBdMap> mapping for keys |
119 rootView <DisplayRootView> this displays root window |
119 rootView <DisplayRootView> this displays root window |
120 isSlow <Boolean> set/cleared from startup - used to turn off |
120 isSlow <Boolean> set/cleared from startup - used to turn off |
121 things like popup-shadows etc. |
121 things like popup-shadows etc. |
122 |
122 |
123 focusMode <Symbol> nil, #pointer or #activeWindow |
123 focusMode <Symbol> nil, #pointer or #activeWindow |
124 activeWindow <View> WINDOWS only: the currently active (foreground) view |
124 activeWindow <View> WINDOWS only: the currently active (foreground) view |
125 |
125 |
126 clipBoardEncoding |
126 clipBoardEncoding |
127 <Symbol> encoding of pasted clipBoard text; |
127 <Symbol> encoding of pasted clipBoard text; |
128 nil means: iso8859. |
128 nil means: iso8859. |
129 set this to #shiftJis, if pasting |
129 set this to #shiftJis, if pasting |
130 SJIS text (for example, from netscape) |
130 SJIS text (for example, from netscape) |
131 Some systems pass encoding information |
131 Some systems pass encoding information |
132 in the clipBoard - there, this is not |
132 in the clipBoard - there, this is not |
133 needed. |
133 needed. |
134 |
134 |
135 [class variables:] |
135 [class variables:] |
136 |
136 |
137 MultiClickTimeDelta in ms; controls how long of a delay is |
137 MultiClickTimeDelta in ms; controls how long of a delay is |
138 required between two clicks, to NOT take |
138 required between two clicks, to NOT take |
139 it as a multi-click. |
139 it as a multi-click. |
140 |
140 |
141 ErrorPrinting controls low-level (X-) error message printing |
141 ErrorPrinting controls low-level (X-) error message printing |
142 |
142 |
143 AllScreens a collectin of known screens |
143 AllScreens a collectin of known screens |
144 |
144 |
145 [see also:] |
145 [see also:] |
146 GraphicsContext DeviceDrawable |
146 GraphicsContext DeviceDrawable |
147 WindowSensor WindowGroup WindowEvent |
147 WindowSensor WindowGroup WindowEvent |
148 ProcessorScheduler |
148 ProcessorScheduler |
149 PSMedium |
149 PSMedium |
150 |
150 |
151 [author:] |
151 [author:] |
152 Claus Gittinger |
152 Claus Gittinger |
153 " |
153 " |
154 ! |
154 ! |
155 |
155 |
156 events |
156 events |
157 " |
157 " |
170 and CTRL-C handling to be performed even while other processes are running. |
170 and CTRL-C handling to be performed even while other processes are running. |
171 The code executed by the event process is found in #startDispatch. |
171 The code executed by the event process is found in #startDispatch. |
172 |
172 |
173 Individual events can be enabled or disabled. The ones that are enabled |
173 Individual events can be enabled or disabled. The ones that are enabled |
174 by default are: |
174 by default are: |
175 keypress / keyRelease |
175 keypress / keyRelease |
176 buttonPress / buttonRelease / buttonMotion (i.e. motion with button pressed) |
176 buttonPress / buttonRelease / buttonMotion (i.e. motion with button pressed) |
177 pointerEnter / pointerLeave |
177 pointerEnter / pointerLeave |
178 |
178 |
179 other events have to be enabled by sending a corresponding #enableXXXEvent |
179 other events have to be enabled by sending a corresponding #enableXXXEvent |
180 message to the view which shall receive those events. |
180 message to the view which shall receive those events. |
181 For example, pointerMotion events (i.e. motion without button being pressed) |
181 For example, pointerMotion events (i.e. motion without button being pressed) |
182 are enabled by: 'aView enableMotionEvent' |
182 are enabled by: 'aView enableMotionEvent' |
197 this is the default graphics display, on which new views are created |
197 this is the default graphics display, on which new views are created |
198 (however, provisions exist for multi-display operation) |
198 (however, provisions exist for multi-display operation) |
199 |
199 |
200 Currently, there is are twoconcrete display classes (released to the public): |
200 Currently, there is are twoconcrete display classes (released to the public): |
201 |
201 |
202 XWorkstation - a plain X window interface |
202 XWorkstation - a plain X window interface |
203 |
203 |
204 GLXWorkstation - an X window interface with a GL(tm) (3D graphic library) |
204 GLXWorkstation - an X window interface with a GL(tm) (3D graphic library) |
205 extension; either simulated (VGL) or a real GL |
205 extension; either simulated (VGL) or a real GL |
206 (real GL is only available on SGI machines) |
206 (real GL is only available on SGI machines) |
207 |
207 |
208 the following are coming soon: |
208 the following are coming soon: |
209 |
209 |
210 OpenGLWorkstation |
210 OpenGLWorkstation |
211 - an X window interface with a openGL(tm) (3D graphic library) |
211 - an X window interface with a openGL(tm) (3D graphic library) |
212 extension; either simulated (MESA) or a real openGL |
212 extension; either simulated (MESA) or a real openGL |
213 (real openGL is only available on SGI/NT machines) |
213 (real openGL is only available on SGI/NT machines) |
214 |
214 |
215 WinWorkstation - what will that be ? |
215 WinWorkstation - what will that be ? |
216 |
216 |
217 An experimental version for a NeXTStep interface exists, but is currently |
217 An experimental version for a NeXTStep interface exists, but is currently |
218 no longer maintained and not released. |
218 no longer maintained and not released. |
219 |
219 |
220 DeviceWorkstation itself is an abstract class; the methods as defined |
220 DeviceWorkstation itself is an abstract class; the methods as defined |
232 If you want to experiment with multi-display applications, |
232 If you want to experiment with multi-display applications, |
233 you have to: |
233 you have to: |
234 |
234 |
235 - create a new instance of XWorkstation: |
235 - create a new instance of XWorkstation: |
236 |
236 |
237 Smalltalk at:#Display2 put:(XWorkstation new). |
237 Smalltalk at:#Display2 put:(XWorkstation new). |
238 or: |
238 or: |
239 Smalltalk at:#Display2 put:(GLXWorkstation new). |
239 Smalltalk at:#Display2 put:(GLXWorkstation new). |
240 |
240 |
241 |
241 |
242 - have it connect to the display (i.e. the xServer): |
242 - have it connect to the display (i.e. the xServer): |
243 (replace 'localhost' below with the name of your display) |
243 (replace 'localhost' below with the name of your display) |
244 |
244 |
245 Display2 := Display2 initializeFor:'localhost:0.0' |
245 Display2 := Display2 initializeFor:'localhost:0.0' |
246 |
246 |
247 returns nil, if connection is refused |
247 returns nil, if connection is refused |
248 - leaving you with Display2==nil in this case. |
248 - leaving you with Display2==nil in this case. |
249 |
249 |
250 |
250 |
251 - start an event dispatcher process for it: |
251 - start an event dispatcher process for it: |
252 (this is now no longer needed - the first opened view will do it for you) |
252 (this is now no longer needed - the first opened view will do it for you) |
253 |
253 |
254 Display2 startDispatch |
254 Display2 startDispatch |
255 |
255 |
256 |
256 |
257 - optionally set its keyboard map |
257 - optionally set its keyboard map |
258 (since this is usually done for Display in the startup-file, |
258 (since this is usually done for Display in the startup-file, |
259 the new display does not have all your added key bindings) |
259 the new display does not have all your added key bindings) |
260 |
260 |
261 Display2 keyboardMap:(Display keyboardMap) |
261 Display2 keyboardMap:(Display keyboardMap) |
262 |
262 |
263 |
263 |
264 - create a view for it: |
264 - create a view for it: |
265 |
265 |
266 (FileBrowser onDevice:Display2) open |
266 (FileBrowser onDevice:Display2) open |
267 |
267 |
268 (Workspace onDevice:Display2) open |
268 (Workspace onDevice:Display2) open |
269 |
269 |
270 (Launcher onDevice:Display2) open |
270 (Launcher onDevice:Display2) open |
271 does not work with Launcher, since its an ApplicationModel (not a view) |
271 does not work with Launcher, since its an ApplicationModel (not a view) |
272 use: |
272 use: |
273 Launcher openOnDevice:Display2 |
273 Launcher openOnDevice:Display2 |
274 instead. |
274 instead. |
275 |
275 |
276 For all of the above, there is now a convenient helper method in |
276 For all of the above, there is now a convenient helper method in |
277 ApplicationModel, which allows to write: |
277 ApplicationModel, which allows to write: |
278 Application openOnXScreenNamed:'foo:0' |
278 Application openOnXScreenNamed:'foo:0' |
279 |
279 |
280 However, as mentioned above, there may be a few places, where the default |
280 However, as mentioned above, there may be a few places, where the default |
281 display 'Display' is still hard-coded - especially, in contributed and |
281 display 'Display' is still hard-coded - especially, in contributed and |
282 Public domain code, you may find those. |
282 Public domain code, you may find those. |
283 |
283 |
300 a remote display is switched off). |
300 a remote display is switched off). |
301 The framework provides per-display signals, which are raised in the corresponding |
301 The framework provides per-display signals, which are raised in the corresponding |
302 event dispatchers context. |
302 event dispatchers context. |
303 For a save environment, you should add static exception handler blocks on those |
303 For a save environment, you should add static exception handler blocks on those |
304 signals; i.e. the setup for remote displays should look somewhat like: |
304 signals; i.e. the setup for remote displays should look somewhat like: |
305 |newDpy| |
305 |newDpy| |
306 |
306 |
307 newDpy := GLXWorkstation new. |
307 newDpy := GLXWorkstation new. |
308 newDpy := newDpy initializeFor:'localhost:0.0'. |
308 newDpy := newDpy initializeFor:'localhost:0.0'. |
309 newDpy isNil ifTrue:[ |
309 newDpy isNil ifTrue:[ |
310 self warn:'cannot connect ...'. |
310 self warn:'cannot connect ...'. |
311 ] ifFalse:[ |
311 ] ifFalse:[ |
312 newDpy deviceIOErrorSignal handlerBlock:[:ex | |
312 newDpy deviceIOErrorSignal handlerBlock:[:ex | |
313 Transcript beep. |
313 Transcript beep. |
314 Transcript showCR:'Display (' , newDpy displayName , '): connection broken.'. |
314 Transcript showCR:'Display (' , newDpy displayName , '): connection broken.'. |
315 AbortSignal raise. |
315 AbortSignal raise. |
316 ]. |
316 ]. |
317 newDpy startDispatch. |
317 newDpy startDispatch. |
318 Launcher openOnDevice:newDpy. |
318 Launcher openOnDevice:newDpy. |
319 ]. |
319 ]. |
320 |
320 |
321 There may still some problems to be expected, |
321 There may still some problems to be expected, |
322 if the screens have different display capabilities (b&w vs. greyscale vs. |
322 if the screens have different display capabilities (b&w vs. greyscale vs. |
323 color display). The current styleSheet approach keeps default values |
323 color display). The current styleSheet approach keeps default values |
324 only once (it should do so per display ...) |
324 only once (it should do so per display ...) |
332 |
332 |
333 initialize |
333 initialize |
334 "create local error signals; enable errorPrinting" |
334 "create local error signals; enable errorPrinting" |
335 |
335 |
336 DeviceErrorSignal isNil ifTrue:[ |
336 DeviceErrorSignal isNil ifTrue:[ |
337 DeviceErrorSignal := (Signal new) mayProceed:true. |
337 DeviceErrorSignal := (Signal new) mayProceed:true. |
338 DeviceErrorSignal notifierString:'device error'. |
338 DeviceErrorSignal notifierString:'device error'. |
339 DeviceErrorSignal nameClass:self message:#deviceErrorSignal. |
339 DeviceErrorSignal nameClass:self message:#deviceErrorSignal. |
340 |
340 |
341 DeviceIOErrorSignal := (Signal new) mayProceed:false. |
341 DeviceIOErrorSignal := (Signal new) mayProceed:false. |
342 DeviceIOErrorSignal notifierString:'device IO error'. |
342 DeviceIOErrorSignal notifierString:'device IO error'. |
343 DeviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal. |
343 DeviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal. |
344 |
344 |
345 DeviceIOTimeoutErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false. |
345 DeviceIOTimeoutErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false. |
346 DeviceIOTimeoutErrorSignal notifierString:'device IO timeout error'. |
346 DeviceIOTimeoutErrorSignal notifierString:'device IO timeout error'. |
347 DeviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal. |
347 DeviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal. |
348 |
348 |
349 CurrentScreenQuerySignal := QuerySignal new. |
349 CurrentScreenQuerySignal := QuerySignal new. |
350 CurrentScreenQuerySignal nameClass:self message:#currentScreenQuerySignal. |
350 CurrentScreenQuerySignal nameClass:self message:#currentScreenQuerySignal. |
351 CurrentScreenQuerySignal notifierString:'asking for current screen'. |
351 CurrentScreenQuerySignal notifierString:'asking for current screen'. |
352 |
352 |
353 DrawingOnClosedDeviceSignal := DeviceErrorSignal newSignalMayProceed:true. |
353 DrawingOnClosedDeviceSignal := DeviceErrorSignal newSignalMayProceed:true. |
354 DrawingOnClosedDeviceSignal nameClass:self message:#drawingOnClosedDeviceSignal. |
354 DrawingOnClosedDeviceSignal nameClass:self message:#drawingOnClosedDeviceSignal. |
355 DrawingOnClosedDeviceSignal notifierString:'drawing attempt on closed graphics device'. |
355 DrawingOnClosedDeviceSignal notifierString:'drawing attempt on closed graphics device'. |
356 ]. |
356 ]. |
357 |
357 |
358 ErrorPrinting := true. |
358 ErrorPrinting := true. |
359 |
359 |
360 self initializeConstants. |
360 self initializeConstants. |
429 "set the button translation, #(1 2 3) is no-translation, |
429 "set the button translation, #(1 2 3) is no-translation, |
430 #(3 2 1) is ok for left-handers" |
430 #(3 2 1) is ok for left-handers" |
431 |
431 |
432 ButtonTranslation := anArray. |
432 ButtonTranslation := anArray. |
433 Display notNil ifTrue:[ |
433 Display notNil ifTrue:[ |
434 Display buttonTranslation:anArray |
434 Display buttonTranslation:anArray |
435 ]. |
435 ]. |
436 ! ! |
436 ! ! |
437 |
437 |
438 !DeviceWorkstation class methodsFor:'error handling'! |
438 !DeviceWorkstation class methodsFor:'error handling'! |
439 |
439 |
440 errorInterrupt:errID with:aParameter |
440 errorInterrupt:errID with:aParameter |
441 "{ Pragma: +optSpace }" |
441 "{ Pragma: +optSpace }" |
442 |
442 |
443 "an error in the devices low level code (typically Xlib or XtLib) |
443 "an error in the devices low level code (typically Xlib or XtLib) |
444 This is invoked via |
444 This is invoked via |
445 XError->errorInterrupt:#DisplayError->registeredErrorInterruptHandlers |
445 XError->errorInterrupt:#DisplayError->registeredErrorInterruptHandlers |
446 or |
446 or |
447 XError->errorInterrupt:#DisplayIOError->registeredErrorInterruptHandlers |
447 XError->errorInterrupt:#DisplayIOError->registeredErrorInterruptHandlers |
448 |
448 |
449 looks if a signal handler for DeviceErrorSignal is present, |
449 looks if a signal handler for DeviceErrorSignal is present, |
450 and - if so raises the signal. |
450 and - if so raises the signal. |
451 If the signal not handled, simply output a message and continue. |
451 If the signal not handled, simply output a message and continue. |
452 This allows for non disrupted error reporting OR to catch and |
452 This allows for non disrupted error reporting OR to catch and |
456 |badId badResource msg theDevice theSignal p signalHolder| |
456 |badId badResource msg theDevice theSignal p signalHolder| |
457 |
457 |
458 'DeviceWorkstation [info]: errorInterrupt: ' infoPrint. errID infoPrintCR. |
458 'DeviceWorkstation [info]: errorInterrupt: ' infoPrint. errID infoPrintCR. |
459 |
459 |
460 errID notNil ifTrue:[ |
460 errID notNil ifTrue:[ |
461 "/ |
461 "/ |
462 "/ timeoutError passes the device; |
462 "/ timeoutError passes the device; |
463 "/ the others pass the devicesID |
463 "/ the others pass the devicesID |
464 "/ |
464 "/ |
465 errID == #DisplayIOTimeoutError ifTrue:[ |
465 errID == #DisplayIOTimeoutError ifTrue:[ |
466 theDevice := aParameter. |
466 theDevice := aParameter. |
467 "/ 'device timeout error' printCR. |
467 "/ 'device timeout error' printCR. |
468 ] ifFalse:[ |
468 ] ifFalse:[ |
469 AllScreens do:[:aDisplayDevice | |
469 AllScreens do:[:aDisplayDevice | |
470 aDisplayDevice id = aParameter ifTrue:[ |
470 aDisplayDevice id = aParameter ifTrue:[ |
471 theDevice := aDisplayDevice. |
471 theDevice := aDisplayDevice. |
472 ] |
472 ] |
473 ] |
473 ] |
474 ] |
474 ] |
475 ]. |
475 ]. |
476 'DeviceWorkstation [info]: device: ' infoPrint. theDevice infoPrintCR. |
476 'DeviceWorkstation [info]: device: ' infoPrint. theDevice infoPrintCR. |
477 |
477 |
478 "/ now, we have the bad guy at hand ... |
478 "/ now, we have the bad guy at hand ... |
479 "/ get a per-instance signal. |
479 "/ get a per-instance signal. |
480 |
480 |
481 signalHolder := theDevice ? self. |
481 signalHolder := theDevice ? self. |
482 errID == #DisplayIOError ifTrue:[ |
482 errID == #DisplayIOError ifTrue:[ |
483 "/ always raises an exception |
483 "/ always raises an exception |
484 msg := 'Display I/O Error'. |
484 msg := 'Display I/O Error'. |
485 badResource := theDevice. |
485 badResource := theDevice. |
486 theSignal := signalHolder deviceIOErrorSignal. |
486 theSignal := signalHolder deviceIOErrorSignal. |
487 ] ifFalse:[ |
487 ] ifFalse:[ |
488 errID == #DisplayIOTimeoutError ifTrue:[ |
488 errID == #DisplayIOTimeoutError ifTrue:[ |
489 "/ always raises an exception for the current process |
489 "/ always raises an exception for the current process |
490 msg := 'Display I/O timeout Error'. |
490 msg := 'Display I/O timeout Error'. |
491 badResource := theDevice. |
491 badResource := theDevice. |
492 theSignal := signalHolder deviceIOTimeoutErrorSignal |
492 theSignal := signalHolder deviceIOTimeoutErrorSignal |
493 ] ifFalse:[ |
493 ] ifFalse:[ |
494 theSignal := signalHolder deviceErrorSignal. |
494 theSignal := signalHolder deviceErrorSignal. |
495 "/ only raises an exception if handled |
495 "/ only raises an exception if handled |
496 |
496 |
497 "/ that will become instance-specific information in |
497 "/ that will become instance-specific information in |
498 "/ the near future ... |
498 "/ the near future ... |
499 |
499 |
500 badId := self resourceIdOfLastError. |
500 badId := self resourceIdOfLastError. |
501 badId ~~ 0 ifTrue:[ |
501 badId ~~ 0 ifTrue:[ |
502 badResource := self resourceOfId:badId. |
502 badResource := self resourceOfId:badId. |
503 ]. |
503 ]. |
504 msg := 'Display error: ' , (self lastErrorString). |
504 msg := 'Display error: ' , (self lastErrorString). |
505 |
505 |
506 theSignal isHandled ifFalse:[ |
506 theSignal isHandled ifFalse:[ |
507 ErrorPrinting ifTrue:[ |
507 ErrorPrinting ifTrue:[ |
508 ('DeviceWorkstation [error]: ' , msg) errorPrintCR |
508 ('DeviceWorkstation [error]: ' , msg) errorPrintCR |
509 ]. |
509 ]. |
510 ^ self |
510 ^ self |
511 ] |
511 ] |
512 ] |
512 ] |
513 ]. |
513 ]. |
514 |
514 |
515 |
515 |
516 "/ interrupt that displays dispatch process |
516 "/ interrupt that displays dispatch process |
517 "/ and force it to shutdown |
517 "/ and force it to shutdown |
518 |
518 |
519 theDevice notNil ifTrue:[ |
519 theDevice notNil ifTrue:[ |
520 "/ DiplayIOTimeoutError is a synchronous event, that should hit the process |
520 "/ DiplayIOTimeoutError is a synchronous event, that should hit the process |
521 "/ that caused the timeout. |
521 "/ that caused the timeout. |
522 |
522 |
523 errID ~~ #DisplayIOTimeoutError ifTrue:[ |
523 errID ~~ #DisplayIOTimeoutError ifTrue:[ |
524 p := theDevice dispatchProcess. |
524 p := theDevice dispatchProcess. |
525 (p notNil and:[p ~~ Processor activeProcess]) ifTrue:[ |
525 (p notNil and:[p ~~ Processor activeProcess]) ifTrue:[ |
526 'DeviceWorkstation [info]: interrupting: ' infoPrint. p displayString infoPrintCR. |
526 'DeviceWorkstation [info]: interrupting: ' infoPrint. p displayString infoPrintCR. |
527 p interruptWith:[ |
527 p interruptWith:[ |
528 'DeviceWorkstation [warning]: raising - exception' errorPrintCR. |
528 'DeviceWorkstation [warning]: raising - exception' errorPrintCR. |
529 theSignal mayProceed ifTrue:[ |
529 theSignal mayProceed ifTrue:[ |
530 theSignal raiseRequestWith:badResource errorString:msg. |
530 theSignal raiseRequestWith:badResource errorString:msg. |
531 ] ifFalse:[ |
531 ] ifFalse:[ |
532 theSignal raiseWith:badResource errorString:msg. |
532 theSignal raiseWith:badResource errorString:msg. |
533 ]. |
533 ]. |
534 'DeviceWorkstation [warning]: broken connection' errorPrintCR. |
534 'DeviceWorkstation [warning]: broken connection' errorPrintCR. |
535 theDevice brokenConnection. |
535 theDevice brokenConnection. |
536 'DeviceWorkstation [warning]: stopping dispatch' errorPrintCR. |
536 'DeviceWorkstation [warning]: stopping dispatch' errorPrintCR. |
537 theDevice stopDispatch. |
537 theDevice stopDispatch. |
538 ]. |
538 ]. |
539 ^ self. |
539 ^ self. |
540 "/ Processor reschedule. |
540 "/ Processor reschedule. |
541 "/ AbortSignal raise. |
541 "/ AbortSignal raise. |
542 ]. |
542 ]. |
543 ]. |
543 ]. |
544 ]. |
544 ]. |
545 |
545 |
546 (theSignal isHandled or:[theSignal handlerBlock notNil]) ifTrue:[ |
546 (theSignal isHandled or:[theSignal handlerBlock notNil]) ifTrue:[ |
547 "/ 'DeviceWorkstation [info]: interrupting current process: ' infoPrint. |
547 "/ 'DeviceWorkstation [info]: interrupting current process: ' infoPrint. |
548 "/ Processor activeProcess displayString infoPrintCR. |
548 "/ Processor activeProcess displayString infoPrintCR. |
549 |
549 |
550 'DeviceWorkstation [info]: raising signal in current process' infoPrintCR. |
550 'DeviceWorkstation [info]: raising signal in current process' infoPrintCR. |
551 theSignal mayProceed ifTrue:[ |
551 theSignal mayProceed ifTrue:[ |
552 theSignal raiseRequestWith:badResource errorString:msg. |
552 theSignal raiseRequestWith:badResource errorString:msg. |
553 ] ifFalse:[ |
553 ] ifFalse:[ |
554 theSignal raiseWith:badResource errorString:msg. |
554 theSignal raiseWith:badResource errorString:msg. |
555 ]. |
555 ]. |
556 ]. |
556 ]. |
557 |
557 |
558 theDevice notNil ifTrue:[ |
558 theDevice notNil ifTrue:[ |
559 "/ 'broken connection' printCR. |
559 "/ 'broken connection' printCR. |
560 'DeviceWorkstation [info]: sending #brokenConnection' infoPrintCR. |
560 'DeviceWorkstation [info]: sending #brokenConnection' infoPrintCR. |
561 theDevice brokenConnection. |
561 theDevice brokenConnection. |
562 theDevice dispatchProcess == Processor activeProcess ifTrue:[ |
562 theDevice dispatchProcess == Processor activeProcess ifTrue:[ |
563 "/ I am running in the dispatch process |
563 "/ I am running in the dispatch process |
564 "/ and nobody handles theSignal, so abort the dispatcher |
564 "/ and nobody handles theSignal, so abort the dispatcher |
565 |
565 |
566 'DeviceWorkstation [info]: raising abortSignal' infoPrintCR. |
566 'DeviceWorkstation [info]: raising abortSignal' infoPrintCR. |
567 AbortSignal raise. |
567 AbortSignal raise. |
568 ] ifFalse:[ |
568 ] ifFalse:[ |
569 "/ Some other process (probably not even guilty - like someone doing a draw after a change) ... |
569 "/ Some other process (probably not even guilty - like someone doing a draw after a change) ... |
570 "/ ... see if we can unwind out of the drawing operation |
570 "/ ... see if we can unwind out of the drawing operation |
571 'DeviceWorkstation [info]: should unwind the draw operation' infoPrintCR. |
571 'DeviceWorkstation [info]: should unwind the draw operation' infoPrintCR. |
572 thisContext fullPrintAll. |
572 thisContext fullPrintAll. |
573 ] |
573 ] |
574 ]. |
574 ]. |
575 'DeviceWorkstation [info]: proceeding after error' infoPrintCR. |
575 'DeviceWorkstation [info]: proceeding after error' infoPrintCR. |
576 |
576 |
577 "Modified: 11.4.1997 / 11:28:27 / cg" |
577 "Modified: 11.4.1997 / 11:28:27 / cg" |
578 ! |
578 ! |
611 |
611 |
612 "search thru all device stuff for a resource. |
612 "search thru all device stuff for a resource. |
613 Needed for error handling" |
613 Needed for error handling" |
614 |
614 |
615 Form allInstancesDo:[:f | |
615 Form allInstancesDo:[:f | |
616 f id == id ifTrue:[^ f] |
616 f id == id ifTrue:[^ f] |
617 ]. |
617 ]. |
618 |
618 |
619 self allInstancesDo:[:aDisplay | |
619 self allInstancesDo:[:aDisplay | |
620 aDisplay allViewsDo:[:aView | |
620 aDisplay allViewsDo:[:aView | |
621 aView id == id ifTrue:[^ aView]. |
621 aView id == id ifTrue:[^ aView]. |
622 aView gcId == id ifTrue:[^ aView] |
622 aView gcId == id ifTrue:[^ aView] |
623 ]. |
623 ]. |
624 |
624 |
625 "/ |views| |
625 "/ |views| |
626 "/ views := aDisplay knownViews. |
626 "/ views := aDisplay knownViews. |
627 "/ views notNil ifTrue:[ |
627 "/ views notNil ifTrue:[ |
628 "/ views do:[:v | |
628 "/ views do:[:v | |
631 "/ ]. |
631 "/ ]. |
632 "/ ]. |
632 "/ ]. |
633 ]. |
633 ]. |
634 |
634 |
635 Color allInstancesDo:[:c | |
635 Color allInstancesDo:[:c | |
636 c colorId == id ifTrue:[^ c] |
636 c colorId == id ifTrue:[^ c] |
637 ]. |
637 ]. |
638 |
638 |
639 Font allInstancesDo:[:f | |
639 Font allInstancesDo:[:f | |
640 f fontId == id ifTrue:[^ f] |
640 f fontId == id ifTrue:[^ f] |
641 ]. |
641 ]. |
642 ^ nil |
642 ^ nil |
643 |
643 |
644 "Modified: 24.4.1996 / 19:36:15 / cg" |
644 "Modified: 24.4.1996 / 19:36:15 / cg" |
645 ! ! |
645 ! ! |
826 |
826 |
827 zoom:startRect to:endRect |
827 zoom:startRect to:endRect |
828 "animate a rubber-rectangle from startRect to endRect. |
828 "animate a rubber-rectangle from startRect to endRect. |
829 Can be used by buttons, which open some dialog for nicer user feedback. |
829 Can be used by buttons, which open some dialog for nicer user feedback. |
830 Notice: since the displays window manager typically allows a topWindow |
830 Notice: since the displays window manager typically allows a topWindow |
831 to be placed by the user, this should not be used for modeless |
831 to be placed by the user, this should not be used for modeless |
832 topViews. |
832 topViews. |
833 " |
833 " |
834 |
834 |
835 ^ self zoom:startRect to:endRect duration:300 |
835 ^ self zoom:startRect to:endRect duration:300 |
836 |
836 |
837 " |
837 " |
844 |
844 |
845 zoom:startRect to:endRect duration:milliseconds |
845 zoom:startRect to:endRect duration:milliseconds |
846 "animate a rubber-rectangle from startRect to endRect. |
846 "animate a rubber-rectangle from startRect to endRect. |
847 Can be used by buttons, which open some dialog for nicer user feedback. |
847 Can be used by buttons, which open some dialog for nicer user feedback. |
848 Notice: since the displays window manager typically allows a topWindow |
848 Notice: since the displays window manager typically allows a topWindow |
849 to be placed by the user, this should not be used for modeless |
849 to be placed by the user, this should not be used for modeless |
850 topViews. |
850 topViews. |
851 " |
851 " |
852 |
852 |
853 |steps dExt dOrg org ext root| |
853 |steps dExt dOrg org ext root| |
854 |
854 |
855 root := self rootView. |
855 root := self rootView. |
856 |
856 |
857 steps := 10. |
857 steps := 10. |
858 dExt := (endRect extent - startRect extent) / steps. |
858 dExt := (endRect extent - startRect extent) / steps. |
859 dOrg := (endRect origin - startRect origin) / steps. |
859 dOrg := (endRect origin - startRect origin) / steps. |
860 0 to:steps do:[:step | |
860 0 to:steps do:[:step | |
861 org := (startRect origin + (dOrg * step)) rounded. |
861 org := (startRect origin + (dOrg * step)) rounded. |
862 ext := (startRect extent + (dExt * step)) rounded. |
862 ext := (startRect extent + (dExt * step)) rounded. |
863 rootView clippedByChildren:false. |
863 rootView clippedByChildren:false. |
864 rootView xoring:[ |
864 rootView xoring:[ |
865 rootView displayRectangleX:org x y:org y width:ext x height:ext y |
865 rootView displayRectangleX:org x y:org y width:ext x height:ext y |
866 ]. |
866 ]. |
867 Delay waitForMilliseconds:(milliseconds // steps). |
867 Delay waitForMilliseconds:(milliseconds // steps). |
868 rootView xoring:[ |
868 rootView xoring:[ |
869 rootView displayRectangleX:org x y:org y width:ext x height:ext y |
869 rootView displayRectangleX:org x y:org y width:ext x height:ext y |
870 ]. |
870 ]. |
871 ]. |
871 ]. |
872 rootView clippedByChildren:true. |
872 rootView clippedByChildren:true. |
873 |
873 |
874 " |
874 " |
875 Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) duration:1000 |
875 Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) duration:1000 |
882 zoom:startRect to:endRect speed:pixelsPerSecond |
882 zoom:startRect to:endRect speed:pixelsPerSecond |
883 "animate a rubber-rectangle from startRect to endRect. |
883 "animate a rubber-rectangle from startRect to endRect. |
884 Can be used by buttons, which open some dialog for nicer user feedback. |
884 Can be used by buttons, which open some dialog for nicer user feedback. |
885 The speed is computed for the longest edge to run at the given speed. |
885 The speed is computed for the longest edge to run at the given speed. |
886 Notice: since the displays window manager typically allows a topWindow |
886 Notice: since the displays window manager typically allows a topWindow |
887 to be placed by the user, this should not be used for modeless |
887 to be placed by the user, this should not be used for modeless |
888 topViews. |
888 topViews. |
889 " |
889 " |
890 |
890 |
891 |maxDistance| |
891 |maxDistance| |
892 |
892 |
893 maxDistance := (endRect origin - startRect origin). |
893 maxDistance := (endRect origin - startRect origin). |
894 maxDistance := maxDistance max:(endRect topRight - startRect topRight). |
894 maxDistance := maxDistance max:(endRect topRight - startRect topRight). |
895 maxDistance := maxDistance max:(endRect bottomLeft - startRect bottomLeft). |
895 maxDistance := maxDistance max:(endRect bottomLeft - startRect bottomLeft). |
896 maxDistance := maxDistance max:(endRect corner - startRect corner). |
896 maxDistance := maxDistance max:(endRect corner - startRect corner). |
897 maxDistance := maxDistance x max:(maxDistance y). |
897 maxDistance := maxDistance x max:(maxDistance y). |
898 ^ self |
898 ^ self |
899 zoom:startRect to:endRect duration:(maxDistance abs / pixelsPerSecond * 1000) |
899 zoom:startRect to:endRect duration:(maxDistance abs / pixelsPerSecond * 1000) |
900 |
900 |
901 " |
901 " |
902 Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) speed:1000 |
902 Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) speed:1000 |
903 Screen current zoom:(20@20 corner:1000@1000) to:(10@10 corner:20@20) speed:10 |
903 Screen current zoom:(20@20 corner:1000@1000) to:(10@10 corner:20@20) speed:10 |
904 " |
904 " |
917 |
917 |
918 rootView clippedByChildren:false. |
918 rootView clippedByChildren:false. |
919 rootView paint:Color black. |
919 rootView paint:Color black. |
920 r := aRectangle. |
920 r := aRectangle. |
921 0 to:bw-1 do:[:i | |
921 0 to:bw-1 do:[:i | |
922 rootView displayRectangle:r. |
922 rootView displayRectangle:r. |
923 r := r insetBy:1. |
923 r := r insetBy:1. |
924 ]. |
924 ]. |
925 rootView clippedByChildren:true. |
925 rootView clippedByChildren:true. |
926 |
926 |
927 " |
927 " |
928 Display restoreAfter:[ |
928 Display restoreAfter:[ |
929 Display border:(10@10 corner:100@100) width:2. |
929 Display border:(10@10 corner:100@100) width:2. |
930 ] |
930 ] |
931 " |
931 " |
932 |
932 |
933 "Modified: 15.10.1997 / 19:23:28 / cg" |
933 "Modified: 15.10.1997 / 19:23:28 / cg" |
934 ! |
934 ! |
946 rootView displayOpaqueString:s x:x y:y. |
946 rootView displayOpaqueString:s x:x y:y. |
947 rootView clippedByChildren:true. |
947 rootView clippedByChildren:true. |
948 |
948 |
949 " |
949 " |
950 Display restoreAfter:[ |
950 Display restoreAfter:[ |
951 Display displayOpaqueString:'hello' x:10 y:10. |
951 Display displayOpaqueString:'hello' x:10 y:10. |
952 ] |
952 ] |
953 " |
953 " |
954 |
954 |
955 "Created: 15.10.1997 / 19:25:09 / cg" |
955 "Created: 15.10.1997 / 19:25:09 / cg" |
956 "Modified: 15.10.1997 / 19:29:05 / cg" |
956 "Modified: 15.10.1997 / 19:29:05 / cg" |
965 rootView displayString:s x:x y:y. |
965 rootView displayString:s x:x y:y. |
966 rootView clippedByChildren:true. |
966 rootView clippedByChildren:true. |
967 |
967 |
968 " |
968 " |
969 Display restoreAfter:[ |
969 Display restoreAfter:[ |
970 Display displayString:'hello' x:10 y:10. |
970 Display displayString:'hello' x:10 y:10. |
971 ] |
971 ] |
972 " |
972 " |
973 |
973 |
974 "Modified: 15.10.1997 / 19:29:10 / cg" |
974 "Modified: 15.10.1997 / 19:29:10 / cg" |
975 ! |
975 ! |
1162 |
1162 |
1163 |buttonNr| |
1163 |buttonNr| |
1164 |
1164 |
1165 "reverse buttonTranslation" |
1165 "reverse buttonTranslation" |
1166 buttonTranslation notNil ifTrue:[ |
1166 buttonTranslation notNil ifTrue:[ |
1167 buttonNr := buttonTranslation indexOf:aButton ifAbsent:[1]. |
1167 buttonNr := buttonTranslation indexOf:aButton ifAbsent:[1]. |
1168 ] ifFalse:[ |
1168 ] ifFalse:[ |
1169 buttonNr := aButton. |
1169 buttonNr := aButton. |
1170 ]. |
1170 ]. |
1171 ^ (aMask bitTest:(self buttonMotionMask:buttonNr)) |
1171 ^ (aMask bitTest:(self buttonMotionMask:buttonNr)) |
1172 ! |
1172 ! |
1173 |
1173 |
1174 dispatchProcess |
1174 dispatchProcess |
1245 rootView |
1245 rootView |
1246 "return the rootView (i.e. the background window) on the receiver screen. |
1246 "return the rootView (i.e. the background window) on the receiver screen. |
1247 It is not guaranteed, that a particular display device supports this." |
1247 It is not guaranteed, that a particular display device supports this." |
1248 |
1248 |
1249 rootView isNil ifTrue:[ |
1249 rootView isNil ifTrue:[ |
1250 rootView := DisplayRootView onDevice:self |
1250 rootView := DisplayRootView onDevice:self |
1251 ]. |
1251 ]. |
1252 ^ rootView |
1252 ^ rootView |
1253 |
1253 |
1254 " |
1254 " |
1255 |v| |
1255 |v| |
1339 |view id| |
1339 |view id| |
1340 |
1340 |
1341 id := self viewIdFromPoint:aPoint. |
1341 id := self viewIdFromPoint:aPoint. |
1342 view := self viewFromId:id. |
1342 view := self viewFromId:id. |
1343 view isNil ifTrue:[ |
1343 view isNil ifTrue:[ |
1344 "/ search on other devices (if present). |
1344 "/ search on other devices (if present). |
1345 "/ This may find the view, in case another device |
1345 "/ This may find the view, in case another device |
1346 "/ has its views on the same display screen |
1346 "/ has its views on the same display screen |
1347 Screen allScreens do:[:aScreen | |
1347 Screen allScreens do:[:aScreen | |
1348 |v| |
1348 |v| |
1349 |
1349 |
1350 aScreen ~~ self ifTrue:[ |
1350 aScreen ~~ self ifTrue:[ |
1351 (v := aScreen viewFromId:id) notNil ifTrue:[ |
1351 (v := aScreen viewFromId:id) notNil ifTrue:[ |
1352 ^ v |
1352 ^ v |
1353 ] |
1353 ] |
1354 ] |
1354 ] |
1355 ] |
1355 ] |
1356 ]. |
1356 ]. |
1357 ^ view |
1357 ^ view |
1358 ! |
1358 ! |
1359 |
1359 |
1360 viewIdFromPoint:aPoint |
1360 viewIdFromPoint:aPoint |
1368 |
1368 |
1369 "/ this is required, since X raises a bad error, when we come |
1369 "/ this is required, since X raises a bad error, when we come |
1370 "/ along with an illegal id (which happens, if a view from another |
1370 "/ along with an illegal id (which happens, if a view from another |
1371 "/ screen-device is picked ...) |
1371 "/ screen-device is picked ...) |
1372 self class deviceErrorSignal handle:[:ex | |
1372 self class deviceErrorSignal handle:[:ex | |
1373 ^ nil |
1373 ^ nil |
1374 ] do:[ |
1374 ] do:[ |
1375 [searchId notNil] whileTrue:[ |
1375 [searchId notNil] whileTrue:[ |
1376 id := self viewIdFromPoint:aPoint in:searchId. |
1376 id := self viewIdFromPoint:aPoint in:searchId. |
1377 foundId := searchId. |
1377 foundId := searchId. |
1378 searchId := id |
1378 searchId := id |
1379 ] |
1379 ] |
1380 ]. |
1380 ]. |
1381 ^ foundId |
1381 ^ foundId |
1382 ! |
1382 ! |
1383 |
1383 |
1384 viewIdFromPoint:aPoint in:windowId |
1384 viewIdFromPoint:aPoint in:windowId |
1406 |
1406 |
1407 bitsBlue |
1407 bitsBlue |
1408 "return the number of valid bits in the blue component." |
1408 "return the number of valid bits in the blue component." |
1409 |
1409 |
1410 bitsBlue isNil ifTrue:[ |
1410 bitsBlue isNil ifTrue:[ |
1411 "/ not a truecolor display |
1411 "/ not a truecolor display |
1412 ^ bitsPerRGB |
1412 ^ bitsPerRGB |
1413 ]. |
1413 ]. |
1414 ^ bitsBlue |
1414 ^ bitsBlue |
1415 |
1415 |
1416 " |
1416 " |
1417 Display bitsBlue |
1417 Display bitsBlue |
1423 |
1423 |
1424 bitsGreen |
1424 bitsGreen |
1425 "return the number of valid bits in the green component." |
1425 "return the number of valid bits in the green component." |
1426 |
1426 |
1427 bitsGreen isNil ifTrue:[ |
1427 bitsGreen isNil ifTrue:[ |
1428 "/ not a truecolor display |
1428 "/ not a truecolor display |
1429 ^ bitsPerRGB |
1429 ^ bitsPerRGB |
1430 ]. |
1430 ]. |
1431 ^ bitsGreen |
1431 ^ bitsGreen |
1432 |
1432 |
1433 " |
1433 " |
1434 Display bitsGreen |
1434 Display bitsGreen |
1457 |
1457 |
1458 bitsRed |
1458 bitsRed |
1459 "return the number of valid bits in the red component." |
1459 "return the number of valid bits in the red component." |
1460 |
1460 |
1461 bitsRed isNil ifTrue:[ |
1461 bitsRed isNil ifTrue:[ |
1462 "/ not a truecolor display |
1462 "/ not a truecolor display |
1463 ^ bitsPerRGB |
1463 ^ bitsPerRGB |
1464 ]. |
1464 ]. |
1465 ^ bitsRed |
1465 ^ bitsRed |
1466 |
1466 |
1467 " |
1467 " |
1468 Display bitsRed |
1468 Display bitsRed |
1651 (of which the server knows nothing). |
1651 (of which the server knows nothing). |
1652 So, this should be used from a display-specific startup file only." |
1652 So, this should be used from a display-specific startup file only." |
1653 |
1653 |
1654 visualType := aSymbol. |
1654 visualType := aSymbol. |
1655 (visualType == #StaticGray or:[visualType == #GrayScale]) ifTrue:[ |
1655 (visualType == #StaticGray or:[visualType == #GrayScale]) ifTrue:[ |
1656 hasColors := false |
1656 hasColors := false |
1657 ] ifFalse:[ |
1657 ] ifFalse:[ |
1658 hasColors := true |
1658 hasColors := true |
1659 ] |
1659 ] |
1660 ! |
1660 ! |
1661 |
1661 |
1662 whiteColor |
1662 whiteColor |
1663 "return the white color on this device. |
1663 "return the white color on this device. |
1902 We return nil here (as if there are no special size preferences)." |
1902 We return nil here (as if there are no special size preferences)." |
1903 |
1903 |
1904 |sizes spec sz sz2| |
1904 |sizes spec sz sz2| |
1905 |
1905 |
1906 preferredIconSize isNil ifTrue:[ |
1906 preferredIconSize isNil ifTrue:[ |
1907 sizes := self iconSizes. |
1907 sizes := self iconSizes. |
1908 sizes notNil ifTrue:[ |
1908 sizes notNil ifTrue:[ |
1909 spec := sizes first. |
1909 spec := sizes first. |
1910 |
1910 |
1911 "/ we prefer square icons ... |
1911 "/ we prefer square icons ... |
1912 |
1912 |
1913 sz := (spec at:#maxWidth) min: (spec at:#maxHeight). |
1913 sz := (spec at:#maxWidth) min: (spec at:#maxHeight). |
1914 sz > 64 ifTrue:[ |
1914 sz > 64 ifTrue:[ |
1915 sz2 := (spec at:#minWidth) max: (spec at:#minHeight). |
1915 sz2 := (spec at:#minWidth) max: (spec at:#minHeight). |
1916 sz2 <= 48 ifTrue:[ |
1916 sz2 <= 48 ifTrue:[ |
1917 sz := 48 |
1917 sz := 48 |
1918 ] |
1918 ] |
1919 ]. |
1919 ]. |
1920 preferredIconSize := sz @ sz |
1920 preferredIconSize := sz @ sz |
1921 ]. |
1921 ]. |
1922 preferredIconSize isNil ifTrue:[ |
1922 preferredIconSize isNil ifTrue:[ |
1923 preferredIconSize := 48@48 |
1923 preferredIconSize := 48@48 |
1924 ]. |
1924 ]. |
1925 ]. |
1925 ]. |
1926 |
1926 |
1927 ^ preferredIconSize |
1927 ^ preferredIconSize |
1928 |
1928 |
1929 " |
1929 " |
1964 "given a depth, return the devices image format info, |
1964 "given a depth, return the devices image format info, |
1965 which provides padding info. If the given depth is not |
1965 which provides padding info. If the given depth is not |
1966 supported, return nil." |
1966 supported, return nil." |
1967 |
1967 |
1968 self supportedImageFormats do:[:fmt | |
1968 self supportedImageFormats do:[:fmt | |
1969 (fmt at:#depth) == aDepth ifTrue:[ |
1969 (fmt at:#depth) == aDepth ifTrue:[ |
1970 ^fmt |
1970 ^fmt |
1971 ] |
1971 ] |
1972 ]. |
1972 ]. |
1973 ^ nil |
1973 ^ nil |
1974 ! |
1974 ! |
1975 |
1975 |
1976 supportedImageFormats |
1976 supportedImageFormats |
2238 heightInMillimeter:aNumber |
2238 heightInMillimeter:aNumber |
2239 "set the height in millimeter of the display |
2239 "set the height in millimeter of the display |
2240 - needed since some displays do not tell the truth or do not know it" |
2240 - needed since some displays do not tell the truth or do not know it" |
2241 |
2241 |
2242 aNumber > 0 ifTrue:[ |
2242 aNumber > 0 ifTrue:[ |
2243 heightMM := aNumber. |
2243 heightMM := aNumber. |
2244 resolutionVer := nil. |
2244 resolutionVer := nil. |
2245 ] |
2245 ] |
2246 |
2246 |
2247 "Modified: 10.9.1996 / 14:25:39 / cg" |
2247 "Modified: 10.9.1996 / 14:25:39 / cg" |
2248 ! |
2248 ! |
2249 |
2249 |
2255 |
2255 |
2256 horizontalPixelPerMillimeter |
2256 horizontalPixelPerMillimeter |
2257 "return the number of horizontal pixels per millimeter of the display" |
2257 "return the number of horizontal pixels per millimeter of the display" |
2258 |
2258 |
2259 resolutionHor notNil ifTrue:[ |
2259 resolutionHor notNil ifTrue:[ |
2260 ^ resolutionHor |
2260 ^ resolutionHor |
2261 ]. |
2261 ]. |
2262 resolutionHor := (width / widthMM) asFloat. |
2262 resolutionHor := (width / widthMM) asFloat. |
2263 ^ resolutionHor |
2263 ^ resolutionHor |
2264 ! |
2264 ! |
2265 |
2265 |
2325 |
2325 |
2326 verticalPixelPerMillimeter |
2326 verticalPixelPerMillimeter |
2327 "return the number of vertical pixels per millimeter of the display" |
2327 "return the number of vertical pixels per millimeter of the display" |
2328 |
2328 |
2329 resolutionVer notNil ifTrue:[ |
2329 resolutionVer notNil ifTrue:[ |
2330 ^ resolutionVer |
2330 ^ resolutionVer |
2331 ]. |
2331 ]. |
2332 resolutionVer := (height / heightMM) asFloat. |
2332 resolutionVer := (height / heightMM) asFloat. |
2333 ^ resolutionVer |
2333 ^ resolutionVer |
2334 ! |
2334 ! |
2335 |
2335 |
2383 widthInMillimeter:aNumber |
2383 widthInMillimeter:aNumber |
2384 "set the width in millimeter of the display |
2384 "set the width in millimeter of the display |
2385 - needed since some displays do not tell the truth or do not know it" |
2385 - needed since some displays do not tell the truth or do not know it" |
2386 |
2386 |
2387 aNumber > 0 ifTrue:[ |
2387 aNumber > 0 ifTrue:[ |
2388 widthMM := aNumber. |
2388 widthMM := aNumber. |
2389 resolutionHor := nil. |
2389 resolutionHor := nil. |
2390 ]. |
2390 ]. |
2391 |
2391 |
2392 "Modified: 10.9.1996 / 14:25:27 / cg" |
2392 "Modified: 10.9.1996 / 14:25:27 / cg" |
2393 ! ! |
2393 ! ! |
2394 |
2394 |
2524 |
2524 |
2525 ^ self subclassResponsibility |
2525 ^ self subclassResponsibility |
2526 ! |
2526 ! |
2527 |
2527 |
2528 createWindowFor:aView type:typeSymbol origin:org extent:ext |
2528 createWindowFor:aView type:typeSymbol origin:org extent:ext |
2529 minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv |
2529 minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv |
2530 style:styleSymbol inputOnly:inp |
2530 style:styleSymbol inputOnly:inp |
2531 label:label owner:owner |
2531 label:label owner:owner |
2532 icon:icn iconMask:icnM iconView:icnV |
2532 icon:icn iconMask:icnM iconView:icnV |
2533 "must be implemented by a concrete class" |
2533 "must be implemented by a concrete class" |
2534 |
2534 |
2535 ^ self subclassResponsibility |
2535 ^ self subclassResponsibility |
2536 ! |
2536 ! |
2537 |
2537 |
2613 |
2613 |
2614 |s| |
2614 |s| |
2615 |
2615 |
2616 s := IdentitySet new. |
2616 s := IdentitySet new. |
2617 fixColors notNil ifTrue:[ |
2617 fixColors notNil ifTrue:[ |
2618 s addAll:fixColors. |
2618 s addAll:fixColors. |
2619 ]. |
2619 ]. |
2620 fixGrayColors notNil ifTrue:[ |
2620 fixGrayColors notNil ifTrue:[ |
2621 s addAll:fixGrayColors. |
2621 s addAll:fixGrayColors. |
2622 ]. |
2622 ]. |
2623 ditherColors notNil ifTrue:[ |
2623 ditherColors notNil ifTrue:[ |
2624 s addAll:ditherColors. |
2624 s addAll:ditherColors. |
2625 ]. |
2625 ]. |
2626 ^ s asArray |
2626 ^ s asArray |
2627 |
2627 |
2628 "Created: 11.7.1996 / 18:13:30 / cg" |
2628 "Created: 11.7.1996 / 18:13:30 / cg" |
2629 "Modified: 24.6.1997 / 16:23:50 / cg" |
2629 "Modified: 24.6.1997 / 16:23:50 / cg" |
2649 |
2649 |
2650 |mapSize "{ Class: SmallInteger }" |
2650 |mapSize "{ Class: SmallInteger }" |
2651 depthUsed mapArray| |
2651 depthUsed mapArray| |
2652 |
2652 |
2653 visualType == #DirectColor ifTrue:[ |
2653 visualType == #DirectColor ifTrue:[ |
2654 'DeviceWorkstation [info]: directColor displays not fully supported.' infoPrintCR. |
2654 'DeviceWorkstation [info]: directColor displays not fully supported.' infoPrintCR. |
2655 ^ nil |
2655 ^ nil |
2656 ]. |
2656 ]. |
2657 |
2657 |
2658 (visualType == #StaticGray or:[visualType == #TrueColor]) ifTrue:[ |
2658 (visualType == #StaticGray or:[visualType == #TrueColor]) ifTrue:[ |
2659 " |
2659 " |
2660 those have no colorMap - we're done |
2660 those have no colorMap - we're done |
2661 " |
2661 " |
2662 ^ nil |
2662 ^ nil |
2663 ]. |
2663 ]. |
2664 |
2664 |
2665 " |
2665 " |
2666 get some attributes of the display device |
2666 get some attributes of the display device |
2667 " |
2667 " |
2670 "/ kludge for 15bit XFree server |
2670 "/ kludge for 15bit XFree server |
2671 "/ (but: I have never encountered a PseudoColor display with more |
2671 "/ (but: I have never encountered a PseudoColor display with more |
2672 "/ than 8 bits ...) |
2672 "/ than 8 bits ...) |
2673 |
2673 |
2674 depthUsed == 15 ifTrue:[ |
2674 depthUsed == 15 ifTrue:[ |
2675 depthUsed := 16 |
2675 depthUsed := 16 |
2676 ]. |
2676 ]. |
2677 depthUsed > 16 ifTrue:[ |
2677 depthUsed > 16 ifTrue:[ |
2678 "/ do not allocate zillions of colors ... |
2678 "/ do not allocate zillions of colors ... |
2679 self error:'unreasonably large colorMap ...'. |
2679 self error:'unreasonably large colorMap ...'. |
2680 ^ nil |
2680 ^ nil |
2681 ]. |
2681 ]. |
2682 |
2682 |
2683 mapSize := (1 bitShift:depthUsed). |
2683 mapSize := (1 bitShift:depthUsed). |
2684 |
2684 |
2685 "/ get the palette |
2685 "/ get the palette |
2686 mapArray := Array new:mapSize. |
2686 mapArray := Array new:mapSize. |
2687 1 to:mapSize do:[:i | |
2687 1 to:mapSize do:[:i | |
2688 self getRGBFrom:(i-1) into:[:r :g :b | |
2688 self getRGBFrom:(i-1) into:[:r :g :b | |
2689 mapArray at:i put:(Color red:r green:g blue:b) |
2689 mapArray at:i put:(Color red:r green:g blue:b) |
2690 ] |
2690 ] |
2691 ]. |
2691 ]. |
2692 ^ mapArray. |
2692 ^ mapArray. |
2693 |
2693 |
2694 " |
2694 " |
2695 Display colorMap |
2695 Display colorMap |
2702 colorNamed:aString |
2702 colorNamed:aString |
2703 "allocate a color with color name - return the color index (i.e. colorID). |
2703 "allocate a color with color name - return the color index (i.e. colorID). |
2704 Dont use this method, colornames are mostly X specific" |
2704 Dont use this method, colornames are mostly X specific" |
2705 |
2705 |
2706 ^ self getScaledRGBFromName:aString into:[:r :g :b | |
2706 ^ self getScaledRGBFromName:aString into:[:r :g :b | |
2707 self colorScaledRed:r scaledGreen:g scaledBlue:b |
2707 self colorScaledRed:r scaledGreen:g scaledBlue:b |
2708 ] |
2708 ] |
2709 |
2709 |
2710 ! |
2710 ! |
2711 |
2711 |
2712 colorRed:redVal green:greenVal blue:blueVal |
2712 colorRed:redVal green:greenVal blue:blueVal |
2721 ^ self colorScaledRed:r scaledGreen:g scaledBlue:b |
2721 ^ self colorScaledRed:r scaledGreen:g scaledBlue:b |
2722 ! |
2722 ! |
2723 |
2723 |
2724 colorScaledRed:red scaledGreen:green scaledBlue:blue |
2724 colorScaledRed:red scaledGreen:green scaledBlue:blue |
2725 visualType == #TrueColor ifTrue:[ |
2725 visualType == #TrueColor ifTrue:[ |
2726 ^ (((red bitShift:-8) bitShift:redShift) |
2726 ^ (((red bitShift:-8) bitShift:redShift) |
2727 bitOr:((green bitShift:-8) bitShift:greenShift)) |
2727 bitOr:((green bitShift:-8) bitShift:greenShift)) |
2728 bitOr:((blue bitShift:-8) bitShift:blueShift) |
2728 bitOr:((blue bitShift:-8) bitShift:blueShift) |
2729 ]. |
2729 ]. |
2730 self subclassResponsibility |
2730 self subclassResponsibility |
2731 ! |
2731 ! |
2732 |
2732 |
2733 deviceColorValueToPercent:deviceColorValue |
2733 deviceColorValueToPercent:deviceColorValue |
2772 |
2772 |
2773 |triple| |
2773 |triple| |
2774 |
2774 |
2775 triple := self getScaledRGBFrom:index. |
2775 triple := self getScaledRGBFrom:index. |
2776 triple notNil ifTrue:[ |
2776 triple notNil ifTrue:[ |
2777 ^ triple collect:[:val | self deviceColorValueToPercent:val] |
2777 ^ triple collect:[:val | self deviceColorValueToPercent:val] |
2778 ]. |
2778 ]. |
2779 ^ nil |
2779 ^ nil |
2780 ! |
2780 ! |
2781 |
2781 |
2782 getRGBFrom:index into:aBlock |
2782 getRGBFrom:index into:aBlock |
2785 |
2785 |
2786 |triple| |
2786 |triple| |
2787 |
2787 |
2788 triple := self getRGBFrom:index. |
2788 triple := self getRGBFrom:index. |
2789 triple notNil ifTrue:[ |
2789 triple notNil ifTrue:[ |
2790 ^ aBlock valueWithArguments:triple. |
2790 ^ aBlock valueWithArguments:triple. |
2791 ]. |
2791 ]. |
2792 ^ nil |
2792 ^ nil |
2793 |
2793 |
2794 ! |
2794 ! |
2795 |
2795 |
2801 than those below are X specific." |
2801 than those below are X specific." |
2802 |
2802 |
2803 |idx names triple r g b| |
2803 |idx names triple r g b| |
2804 |
2804 |
2805 (colorName startsWith:$#) ifTrue:[ |
2805 (colorName startsWith:$#) ifTrue:[ |
2806 "/ color in r/g/b hex notation |
2806 "/ color in r/g/b hex notation |
2807 r := Integer readFrom:(colorName copyFrom:2 to:3) radix:16. |
2807 r := Integer readFrom:(colorName copyFrom:2 to:3) radix:16. |
2808 g := Integer readFrom:(colorName copyFrom:4 to:5) radix:16. |
2808 g := Integer readFrom:(colorName copyFrom:4 to:5) radix:16. |
2809 b := Integer readFrom:(colorName copyFrom:6 to:7) radix:16. |
2809 b := Integer readFrom:(colorName copyFrom:6 to:7) radix:16. |
2810 r := (r * 100 / 255). |
2810 r := (r * 100 / 255). |
2811 g := (g * 100 / 255). |
2811 g := (g * 100 / 255). |
2812 b := (b * 100 / 255). |
2812 b := (b * 100 / 255). |
2813 ^ Array with:r with:g with:b |
2813 ^ Array with:r with:g with:b |
2814 ]. |
2814 ]. |
2815 |
2815 |
2816 names := #( |
2816 names := #( |
2817 'red' |
2817 'red' |
2818 'green' |
2818 'green' |
2819 'blue' |
2819 'blue' |
2820 'yellow' |
2820 'yellow' |
2821 'magenta' |
2821 'magenta' |
2822 'cyan' |
2822 'cyan' |
2823 'white' |
2823 'white' |
2824 'black' |
2824 'black' |
2825 |
2825 |
2826 'olive' |
2826 'olive' |
2827 'teal' |
2827 'teal' |
2828 'silver' |
2828 'silver' |
2829 'lime' |
2829 'lime' |
2830 'fuchsia' |
2830 'fuchsia' |
2831 'aqua' |
2831 'aqua' |
2832 ). |
2832 ). |
2833 idx := names indexOf:colorName. |
2833 idx := names indexOf:colorName. |
2834 idx == 0 ifTrue:[ |
2834 idx == 0 ifTrue:[ |
2835 idx := names indexOf:colorName asLowercase. |
2835 idx := names indexOf:colorName asLowercase. |
2836 ]. |
2836 ]. |
2837 idx ~~ 0 ifTrue:[ |
2837 idx ~~ 0 ifTrue:[ |
2838 triple := #( |
2838 triple := #( |
2839 (100 0 0) "red" |
2839 (100 0 0) "red" |
2840 ( 0 100 0) "green" |
2840 ( 0 100 0) "green" |
2841 ( 0 0 100) "blue" |
2841 ( 0 0 100) "blue" |
2842 (100 100 0) "yellow" |
2842 (100 100 0) "yellow" |
2843 (100 0 100) "magenta" |
2843 (100 0 100) "magenta" |
2844 ( 0 100 100) "cyan" |
2844 ( 0 100 100) "cyan" |
2845 (100 100 100) "white" |
2845 (100 100 100) "white" |
2846 ( 0 0 0) "black" |
2846 ( 0 0 0) "black" |
2847 |
2847 |
2848 ( 50 50 0) "olive" |
2848 ( 50 50 0) "olive" |
2849 ( 0 50 50) "teal" |
2849 ( 0 50 50) "teal" |
2850 ( 40 40 40) "silver" |
2850 ( 40 40 40) "silver" |
2851 ( 20 100 0) "lime" |
2851 ( 20 100 0) "lime" |
2852 ( 60 3 100) "fuchsia" |
2852 ( 60 3 100) "fuchsia" |
2853 ( 10 100 100) "aqua" |
2853 ( 10 100 100) "aqua" |
2854 ) at:idx. |
2854 ) at:idx. |
2855 |
2855 |
2856 ^ triple |
2856 ^ triple |
2857 ]. |
2857 ]. |
2858 ^ nil |
2858 ^ nil |
2859 |
2859 |
2860 ! |
2860 ! |
2861 |
2861 |
2865 |
2865 |
2866 |triple| |
2866 |triple| |
2867 |
2867 |
2868 triple := self getScaledRGBFromName:colorName. |
2868 triple := self getScaledRGBFromName:colorName. |
2869 triple notNil ifTrue:[ |
2869 triple notNil ifTrue:[ |
2870 ^ aBlock value:(self deviceColorValueToPercent:(triple at:1)) |
2870 ^ aBlock value:(self deviceColorValueToPercent:(triple at:1)) |
2871 value:(self deviceColorValueToPercent:(triple at:2)) |
2871 value:(self deviceColorValueToPercent:(triple at:2)) |
2872 value:(self deviceColorValueToPercent:(triple at:3)) |
2872 value:(self deviceColorValueToPercent:(triple at:3)) |
2873 ]. |
2873 ]. |
2874 ^ nil |
2874 ^ nil |
2875 |
2875 |
2876 " |
2876 " |
2877 Display getRGBFromName:'red' into:[:r :g :b | r printCR. g printCR. b printCR.] |
2877 Display getRGBFromName:'red' into:[:r :g :b | r printCR. g printCR. b printCR.] |
2891 |
2891 |
2892 |triple| |
2892 |triple| |
2893 |
2893 |
2894 triple := self getScaledRGBFrom:index. |
2894 triple := self getScaledRGBFrom:index. |
2895 triple notNil ifTrue:[ |
2895 triple notNil ifTrue:[ |
2896 ^ aBlock valueWithArguments:triple. |
2896 ^ aBlock valueWithArguments:triple. |
2897 ]. |
2897 ]. |
2898 ^ nil |
2898 ^ nil |
2899 |
2899 |
2900 ! |
2900 ! |
2901 |
2901 |
2905 |
2905 |
2906 |triple| |
2906 |triple| |
2907 |
2907 |
2908 triple := self getRGBFromName:colorName. |
2908 triple := self getRGBFromName:colorName. |
2909 triple notNil ifTrue:[ |
2909 triple notNil ifTrue:[ |
2910 ^ triple collect:[:val | self percentToDeviceColorValue:val]. |
2910 ^ triple collect:[:val | self percentToDeviceColorValue:val]. |
2911 ]. |
2911 ]. |
2912 ^ nil. |
2912 ^ nil. |
2913 |
2913 |
2914 ! |
2914 ! |
2915 |
2915 |
2919 |
2919 |
2920 |triple| |
2920 |triple| |
2921 |
2921 |
2922 triple := self getScaledRGBFromName:colorName. |
2922 triple := self getScaledRGBFromName:colorName. |
2923 triple notNil ifTrue:[ |
2923 triple notNil ifTrue:[ |
2924 ^ aBlock valueWithArguments:triple. |
2924 ^ aBlock valueWithArguments:triple. |
2925 ]. |
2925 ]. |
2926 ^ nil |
2926 ^ nil |
2927 ! |
2927 ! |
2928 |
2928 |
2929 greenComponentOfColor:colorId |
2929 greenComponentOfColor:colorId |
3151 |
3151 |
3152 ^ self copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
3152 ^ self copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
3153 ! |
3153 ! |
3154 |
3154 |
3155 displayArcX:x y:y width:width height:height from:startAngle angle:angle |
3155 displayArcX:x y:y width:width height:height from:startAngle angle:angle |
3156 in:aDrawableId with:aGCId |
3156 in:aDrawableId with:aGCId |
3157 "draw an arc" |
3157 "draw an arc" |
3158 |
3158 |
3159 ^ self subclassResponsibility |
3159 ^ self subclassResponsibility |
3160 |
3160 |
3161 "Created: 8.5.1996 / 08:44:43 / cg" |
3161 "Created: 8.5.1996 / 08:44:43 / cg" |
3181 ydata size == 0 ifTrue:[^ self]. |
3181 ydata size == 0 ifTrue:[^ self]. |
3182 |
3182 |
3183 xLast := xStart. |
3183 xLast := xStart. |
3184 yLast := (ydata at:1) * yScale + yTrans. |
3184 yLast := (ydata at:1) * yScale + yTrans. |
3185 ydata from:2 do:[:y | |yT| |
3185 ydata from:2 do:[:y | |yT| |
3186 x := xLast + xStep. |
3186 x := xLast + xStep. |
3187 yT := y * yScale + yTrans. |
3187 yT := y * yScale + yTrans. |
3188 self displayLineFromX:xLast rounded y:yLast rounded toX:x rounded y:yT rounded in:drawableId with:gcId. |
3188 self displayLineFromX:xLast rounded y:yLast rounded toX:x rounded y:yT rounded in:drawableId with:gcId. |
3189 xLast := x. |
3189 xLast := x. |
3190 yLast := y. |
3190 yLast := y. |
3191 ] |
3191 ] |
3192 ! |
3192 ! |
3193 |
3193 |
3194 displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
3194 displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
3195 "draw a sub-string - draw foreground on background. |
3195 "draw a sub-string - draw foreground on background. |
3196 If the coordinates are not integers, retry with rounded." |
3196 If the coordinates are not integers, retry with rounded." |
3197 |
3197 |
3198 self displayString:aString |
3198 self displayString:aString |
3199 from:index1 |
3199 from:index1 |
3200 to:index2 |
3200 to:index2 |
3201 x:x |
3201 x:x |
3202 y:y |
3202 y:y |
3203 in:aDrawableId |
3203 in:aDrawableId |
3204 with:aGCId |
3204 with:aGCId |
3205 opaque:true |
3205 opaque:true |
3206 ! |
3206 ! |
3207 |
3207 |
3208 displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId |
3208 displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId |
3209 "draw a string - draw foreground on background. |
3209 "draw a string - draw foreground on background. |
3210 If the coordinates are not integers, retry with rounded." |
3210 If the coordinates are not integers, retry with rounded." |
3211 |
3211 |
3212 self displayString:aString |
3212 self displayString:aString |
3213 x:x |
3213 x:x |
3214 y:y |
3214 y:y |
3215 in:aDrawableId |
3215 in:aDrawableId |
3216 with:aGCId |
3216 with:aGCId |
3217 opaque:true |
3217 opaque:true |
3218 ! |
3218 ! |
3219 |
3219 |
3220 displayPointX:x y:y in:aDrawableId with:aGCId |
3220 displayPointX:x y:y in:aDrawableId with:aGCId |
3221 "draw a point" |
3221 "draw a point" |
3222 |
3222 |
3243 "draw a bunch of lines" |
3243 "draw a bunch of lines" |
3244 |
3244 |
3245 |startPoint p| |
3245 |startPoint p| |
3246 |
3246 |
3247 1 to:arrayOfPoints size by:2 do:[:idx | |
3247 1 to:arrayOfPoints size by:2 do:[:idx | |
3248 p := arrayOfPoints at:idx. |
3248 p := arrayOfPoints at:idx. |
3249 idx odd ifTrue:[ |
3249 idx odd ifTrue:[ |
3250 startPoint := p |
3250 startPoint := p |
3251 ] ifFalse:[ |
3251 ] ifFalse:[ |
3252 self |
3252 self |
3253 displayLineFromX:startPoint x |
3253 displayLineFromX:startPoint x |
3254 y:startPoint y |
3254 y:startPoint y |
3255 toX:p x |
3255 toX:p x |
3256 y:p y |
3256 y:p y |
3257 in:aDrawableId |
3257 in:aDrawableId |
3258 with:aGCId |
3258 with:aGCId |
3259 ] |
3259 ] |
3260 ] |
3260 ] |
3261 ! |
3261 ! |
3262 |
3262 |
3263 displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
3263 displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
3264 "draw a rectangle" |
3264 "draw a rectangle" |
3273 displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
3273 displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
3274 "draw a sub-string - draw foreground only. |
3274 "draw a sub-string - draw foreground only. |
3275 If the coordinates are not integers, retry with rounded." |
3275 If the coordinates are not integers, retry with rounded." |
3276 |
3276 |
3277 self |
3277 self |
3278 displayString:aString |
3278 displayString:aString |
3279 from:index1 |
3279 from:index1 |
3280 to:index2 |
3280 to:index2 |
3281 x:x |
3281 x:x |
3282 y:y |
3282 y:y |
3283 in:aDrawableId |
3283 in:aDrawableId |
3284 with:aGCId |
3284 with:aGCId |
3285 opaque:false |
3285 opaque:false |
3286 ! |
3286 ! |
3287 |
3287 |
3288 displayString:aString from:i1 to:i2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
3288 displayString:aString from:i1 to:i2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
3289 "draw part of a string" |
3289 "draw part of a string" |
3290 |
3290 |
3294 displayString:aString x:x y:y in:aDrawableId with:aGCId |
3294 displayString:aString x:x y:y in:aDrawableId with:aGCId |
3295 "draw a string - draw foreground only. |
3295 "draw a string - draw foreground only. |
3296 If the coordinates are not integers, retry with rounded." |
3296 If the coordinates are not integers, retry with rounded." |
3297 |
3297 |
3298 self |
3298 self |
3299 displayString:aString |
3299 displayString:aString |
3300 x:x |
3300 x:x |
3301 y:y |
3301 y:y |
3302 in:aDrawableId |
3302 in:aDrawableId |
3303 with:aGCId |
3303 with:aGCId |
3304 opaque:false |
3304 opaque:false |
3305 ! |
3305 ! |
3306 |
3306 |
3307 displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
3307 displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
3308 "draw a string" |
3308 "draw a string" |
3309 |
3309 |
3310 self displayString:aString |
3310 self displayString:aString |
3311 from:1 |
3311 from:1 |
3312 to:aString size |
3312 to:aString size |
3313 x:x |
3313 x:x |
3314 y:y |
3314 y:y |
3315 in:aDrawableId |
3315 in:aDrawableId |
3316 with:aGCId |
3316 with:aGCId |
3317 opaque:opaque |
3317 opaque:opaque |
3318 ! |
3318 ! |
3319 |
3319 |
3320 drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:pad |
3320 drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:pad |
3321 width:imageWidth height:imageHeight |
3321 width:imageWidth height:imageHeight |
3322 x:srcx y:srcy |
3322 x:srcx y:srcy |
3323 into:aDrawableId |
3323 into:aDrawableId |
3324 x:dstx y:dsty |
3324 x:dstx y:dsty |
3325 width:w height:h |
3325 width:w height:h |
3326 with:aGCId |
3326 with:aGCId |
3327 "draw a bitimage which has depth id, width iw and height ih into |
3327 "draw a bitimage which has depth id, width iw and height ih into |
3328 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
3328 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
3329 It has to be checked elsewhere, that server can do it with the given |
3329 It has to be checked elsewhere, that server can do it with the given |
3330 depth; also it is assumed, that the colormap is setup correctly. |
3330 depth; also it is assumed, that the colormap is setup correctly. |
3331 The actual bits per pixel may be different from the depth (for example, |
3331 The actual bits per pixel may be different from the depth (for example, |
3334 |
3334 |
3335 ^ self subclassResponsibility |
3335 ^ self subclassResponsibility |
3336 ! |
3336 ! |
3337 |
3337 |
3338 drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
3338 drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
3339 width:imageWidth height:imageHeight |
3339 width:imageWidth height:imageHeight |
3340 x:srcx y:srcy |
3340 x:srcx y:srcy |
3341 into:aDrawableId |
3341 into:aDrawableId |
3342 x:dstx y:dsty |
3342 x:dstx y:dsty |
3343 width:w height:h |
3343 width:w height:h |
3344 with:aGCId |
3344 with:aGCId |
3345 |
3345 |
3346 "draw a bitimage which has depth id, width iw and height ih into |
3346 "draw a bitimage which has depth id, width iw and height ih into |
3347 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
3347 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
3348 It has to be checked elsewhere, that server can do it with the given |
3348 It has to be checked elsewhere, that server can do it with the given |
3349 depth; also it is assumed, that the colormap is setup correctly. |
3349 depth; also it is assumed, that the colormap is setup correctly. |
3352 systems actually use 32 bits/pixel). |
3352 systems actually use 32 bits/pixel). |
3353 This assumes a padding of 8-bits (i.e. byte-boundary), |
3353 This assumes a padding of 8-bits (i.e. byte-boundary), |
3354 which is the natural padding within ST/X." |
3354 which is the natural padding within ST/X." |
3355 |
3355 |
3356 ^ self |
3356 ^ self |
3357 drawBits:imageBits |
3357 drawBits:imageBits |
3358 bitsPerPixel:bitsPerPixel |
3358 bitsPerPixel:bitsPerPixel |
3359 depth:imageDepth |
3359 depth:imageDepth |
3360 padding:8 |
3360 padding:8 |
3361 width:imageWidth height:imageHeight |
3361 width:imageWidth height:imageHeight |
3362 x:srcx y:srcy |
3362 x:srcx y:srcy |
3363 into:aDrawableId |
3363 into:aDrawableId |
3364 x:dstx y:dsty |
3364 x:dstx y:dsty |
3365 width:w height:h |
3365 width:w height:h |
3366 with:aGCId |
3366 with:aGCId |
3367 |
3367 |
3368 "Created: / 16.4.1997 / 14:55:57 / cg" |
3368 "Created: / 16.4.1997 / 14:55:57 / cg" |
3369 "Modified: / 21.1.1998 / 13:27:58 / cg" |
3369 "Modified: / 21.1.1998 / 13:27:58 / cg" |
3370 ! |
3370 ! |
3371 |
3371 |
3372 drawBits:imageBits depth:imageDepth padding:pad width:imageWidth height:imageHeight |
3372 drawBits:imageBits depth:imageDepth padding:pad width:imageWidth height:imageHeight |
3373 x:srcx y:srcy into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
3373 x:srcx y:srcy into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
3374 |
3374 |
3375 "draw a bitimage which has depth id, width iw and height ih into |
3375 "draw a bitimage which has depth id, width iw and height ih into |
3376 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
3376 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
3377 It has to be checked elsewhere, that server can do it with the given |
3377 It has to be checked elsewhere, that server can do it with the given |
3378 depth; also it is assumed, that the colormap is setup correctly" |
3378 depth; also it is assumed, that the colormap is setup correctly" |
3379 |
3379 |
3380 ^ self |
3380 ^ self |
3381 drawBits:imageBits |
3381 drawBits:imageBits |
3382 bitsPerPixel:imageDepth |
3382 bitsPerPixel:imageDepth |
3383 depth:imageDepth |
3383 depth:imageDepth |
3384 padding:pad |
3384 padding:pad |
3385 width:imageWidth height:imageHeight |
3385 width:imageWidth height:imageHeight |
3386 x:srcx y:srcy |
3386 x:srcx y:srcy |
3387 into:aDrawableId |
3387 into:aDrawableId |
3388 x:dstx y:dsty |
3388 x:dstx y:dsty |
3389 width:w height:h |
3389 width:w height:h |
3390 with:aGCId |
3390 with:aGCId |
3391 ! |
3391 ! |
3392 |
3392 |
3393 drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight |
3393 drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight |
3394 x:srcx y:srcy |
3394 x:srcx y:srcy |
3395 into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
3395 into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
3396 |
3396 |
3397 "draw a bitimage which has depth id, width iw and height ih into |
3397 "draw a bitimage which has depth id, width iw and height ih into |
3398 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
3398 the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
3399 It has to be checked elsewhere, that server can do it with the given |
3399 It has to be checked elsewhere, that server can do it with the given |
3400 depth; also it is assumed, that the colormap is setup correctly. |
3400 depth; also it is assumed, that the colormap is setup correctly. |
3401 This assumes a padding of 8-bits (i.e. byte-boundary), |
3401 This assumes a padding of 8-bits (i.e. byte-boundary), |
3402 which is the natural padding within ST/X." |
3402 which is the natural padding within ST/X." |
3403 |
3403 |
3404 ^ self |
3404 ^ self |
3405 drawBits:imageBits |
3405 drawBits:imageBits |
3406 bitsPerPixel:imageDepth |
3406 bitsPerPixel:imageDepth |
3407 depth:imageDepth |
3407 depth:imageDepth |
3408 width:imageWidth height:imageHeight |
3408 width:imageWidth height:imageHeight |
3409 x:srcx y:srcy |
3409 x:srcx y:srcy |
3410 into:aDrawableId |
3410 into:aDrawableId |
3411 x:dstx y:dsty |
3411 x:dstx y:dsty |
3412 width:w height:h |
3412 width:w height:h |
3413 with:aGCId |
3413 with:aGCId |
3414 |
3414 |
3415 "Modified: / 21.1.1998 / 13:28:34 / cg" |
3415 "Modified: / 21.1.1998 / 13:28:34 / cg" |
3416 ! |
3416 ! |
3417 |
3417 |
3418 fillArcX:x y:y width:width height:height from:startAngle angle:angle |
3418 fillArcX:x y:y width:width height:height from:startAngle angle:angle |
3419 in:aDrawableId with:aGCId |
3419 in:aDrawableId with:aGCId |
3420 "fill an arc" |
3420 "fill an arc" |
3421 |
3421 |
3422 ^ self subclassResponsibility |
3422 ^ self subclassResponsibility |
3423 |
3423 |
3424 "Created: 8.5.1996 / 08:45:11 / cg" |
3424 "Created: 8.5.1996 / 08:45:11 / cg" |
3451 |setOfViews| |
3451 |setOfViews| |
3452 |
3452 |
3453 setOfViews := IdentitySet new. |
3453 setOfViews := IdentitySet new. |
3454 |
3454 |
3455 knownViews notNil ifTrue:[ |
3455 knownViews notNil ifTrue:[ |
3456 knownViews validElementsDo:[:v | setOfViews add:v]. |
3456 knownViews validElementsDo:[:v | setOfViews add:v]. |
3457 ]. |
3457 ]. |
3458 ^ setOfViews |
3458 ^ setOfViews |
3459 |
3459 |
3460 "Created: / 14.2.1997 / 14:29:43 / cg" |
3460 "Created: / 14.2.1997 / 14:29:43 / cg" |
3461 "Modified: / 19.1.2000 / 10:07:05 / cg" |
3461 "Modified: / 19.1.2000 / 10:07:05 / cg" |
3472 "/ aBlock value:aView |
3472 "/ aBlock value:aView |
3473 "/ ] |
3473 "/ ] |
3474 "/ ] |
3474 "/ ] |
3475 |
3475 |
3476 knownViews notNil ifTrue:[ |
3476 knownViews notNil ifTrue:[ |
3477 knownViews validElementsDo:aBlock |
3477 knownViews validElementsDo:aBlock |
3478 ] |
3478 ] |
3479 |
3479 |
3480 " |
3480 " |
3481 View defaultStyle:#iris. |
3481 View defaultStyle:#iris. |
3482 Display allViewsDo:[:v | v initStyle. v redraw] |
3482 Display allViewsDo:[:v | v initStyle. v redraw] |
3495 |
3495 |
3496 !DeviceWorkstation methodsFor:'error handling'! |
3496 !DeviceWorkstation methodsFor:'error handling'! |
3497 |
3497 |
3498 primitiveFailedOrClosedConnection |
3498 primitiveFailedOrClosedConnection |
3499 self isOpen ifFalse:[ |
3499 self isOpen ifFalse:[ |
3500 DrawingOnClosedDeviceSignal raiseRequestWith:self. |
3500 DrawingOnClosedDeviceSignal raiseRequestWith:self. |
3501 ^ nil |
3501 ^ nil |
3502 ]. |
3502 ]. |
3503 ^ super primitiveFailed |
3503 ^ super primitiveFailed |
3504 ! ! |
3504 ! ! |
3505 |
3505 |
3506 !DeviceWorkstation methodsFor:'event forwarding'! |
3506 !DeviceWorkstation methodsFor:'event forwarding'! |
3509 "forward a button-motion for some view" |
3509 "forward a button-motion for some view" |
3510 |
3510 |
3511 |sensor| |
3511 |sensor| |
3512 |
3512 |
3513 aView isNil ifTrue:[ |
3513 aView isNil ifTrue:[ |
3514 "/ event arrived, after I destroyed it myself |
3514 "/ event arrived, after I destroyed it myself |
3515 ^ self |
3515 ^ self |
3516 ]. |
3516 ]. |
3517 (sensor := aView sensor) notNil ifTrue:[ |
3517 (sensor := aView sensor) notNil ifTrue:[ |
3518 sensor buttonMotion:button x:x y:y view:aView |
3518 sensor buttonMotion:button x:x y:y view:aView |
3519 ] ifFalse:[ |
3519 ] ifFalse:[ |
3520 aView shown ifTrue:[ "/ could be a late event arrival |
3520 aView shown ifTrue:[ "/ could be a late event arrival |
3521 " |
3521 " |
3522 if there is no sensor ... |
3522 if there is no sensor ... |
3523 " |
3523 " |
3524 aView |
3524 aView |
3525 dispatchEvent:#buttonMotion:x:y: |
3525 dispatchEvent:#buttonMotion:x:y: |
3526 arguments:(Array with:button with:x with:y) |
3526 arguments:(Array with:button with:x with:y) |
3527 |
3527 |
3528 "/ WindowEvent |
3528 "/ WindowEvent |
3529 "/ sendEvent:#buttonMotion:x:y: |
3529 "/ sendEvent:#buttonMotion:x:y: |
3530 "/ arguments:(Array with:button with:x with:y) |
3530 "/ arguments:(Array with:button with:x with:y) |
3531 "/ view:aView |
3531 "/ view:aView |
3532 ] |
3532 ] |
3533 ] |
3533 ] |
3534 |
3534 |
3535 "Modified: / 20.5.1998 / 22:50:32 / cg" |
3535 "Modified: / 20.5.1998 / 22:50:32 / cg" |
3536 ! |
3536 ! |
3537 |
3537 |
3539 "forward a button-multi-press event for some view" |
3539 "forward a button-multi-press event for some view" |
3540 |
3540 |
3541 |sensor| |
3541 |sensor| |
3542 |
3542 |
3543 aView isNil ifTrue:[ |
3543 aView isNil ifTrue:[ |
3544 "/ event arrived, after I destroyed it myself |
3544 "/ event arrived, after I destroyed it myself |
3545 ^ self |
3545 ^ self |
3546 ]. |
3546 ]. |
3547 (sensor := aView sensor) notNil ifTrue:[ |
3547 (sensor := aView sensor) notNil ifTrue:[ |
3548 sensor buttonMultiPress:button x:x y:y view:aView |
3548 sensor buttonMultiPress:button x:x y:y view:aView |
3549 ] ifFalse:[ |
3549 ] ifFalse:[ |
3550 aView shown ifTrue:[ "/ could be a late event arrival |
3550 aView shown ifTrue:[ "/ could be a late event arrival |
3551 " |
3551 " |
3552 if there is no sensor ... |
3552 if there is no sensor ... |
3553 " |
3553 " |
3554 aView |
3554 aView |
3555 dispatchEvent:#buttonMultiPress:x:y: |
3555 dispatchEvent:#buttonMultiPress:x:y: |
3556 arguments:(Array with:button with:x with:y) |
3556 arguments:(Array with:button with:x with:y) |
3557 |
3557 |
3558 "/ WindowEvent |
3558 "/ WindowEvent |
3559 "/ sendEvent:#buttonMultiPress:x:y: |
3559 "/ sendEvent:#buttonMultiPress:x:y: |
3560 "/ arguments:(Array with:button with:x with:y) |
3560 "/ arguments:(Array with:button with:x with:y) |
3561 "/ view:aView |
3561 "/ view:aView |
3562 ] |
3562 ] |
3563 ] |
3563 ] |
3564 |
3564 |
3565 "Modified: / 20.5.1998 / 22:50:49 / cg" |
3565 "Modified: / 20.5.1998 / 22:50:49 / cg" |
3566 ! |
3566 ! |
3567 |
3567 |
3569 "forward a button-press event for some view" |
3569 "forward a button-press event for some view" |
3570 |
3570 |
3571 |sensor| |
3571 |sensor| |
3572 |
3572 |
3573 aView isNil ifTrue:[ |
3573 aView isNil ifTrue:[ |
3574 "/ event arrived, after I destroyed it myself |
3574 "/ event arrived, after I destroyed it myself |
3575 ^ self |
3575 ^ self |
3576 ]. |
3576 ]. |
3577 (sensor := aView sensor) notNil ifTrue:[ |
3577 (sensor := aView sensor) notNil ifTrue:[ |
3578 WindowsRightButtonBehavior == true ifTrue:[ |
3578 WindowsRightButtonBehavior == true ifTrue:[ |
3579 button >= 2 ifTrue:[ |
3579 button >= 2 ifTrue:[ |
3580 sensor buttonPress:1 x:x y:y view:aView. |
3580 sensor buttonPress:1 x:x y:y view:aView. |
3581 ^ self. |
3581 ^ self. |
3582 ] |
3582 ] |
3583 ]. |
3583 ]. |
3584 |
3584 |
3585 sensor buttonPress:button x:x y:y view:aView |
3585 sensor buttonPress:button x:x y:y view:aView |
3586 ] ifFalse:[ |
3586 ] ifFalse:[ |
3587 aView shown ifTrue:[ "/ could be a late event arrival |
3587 aView shown ifTrue:[ "/ could be a late event arrival |
3588 " |
3588 " |
3589 if there is no sensor ... |
3589 if there is no sensor ... |
3590 " |
3590 " |
3591 aView |
3591 aView |
3592 dispatchEvent:#buttonPress:x:y: |
3592 dispatchEvent:#buttonPress:x:y: |
3593 arguments:(Array with:button with:x with:y) |
3593 arguments:(Array with:button with:x with:y) |
3594 |
3594 |
3595 "/ WindowEvent |
3595 "/ WindowEvent |
3596 "/ sendEvent:#buttonPress:x:y: |
3596 "/ sendEvent:#buttonPress:x:y: |
3597 "/ arguments:(Array with:button with:x with:y) |
3597 "/ arguments:(Array with:button with:x with:y) |
3598 "/ view:aView |
3598 "/ view:aView |
3599 ] |
3599 ] |
3600 ] |
3600 ] |
3601 |
3601 |
3602 "Modified: / 20.5.1998 / 22:51:02 / cg" |
3602 "Modified: / 20.5.1998 / 22:51:02 / cg" |
3603 ! |
3603 ! |
3604 |
3604 |
3606 "forward a button-release event for some view" |
3606 "forward a button-release event for some view" |
3607 |
3607 |
3608 |sensor| |
3608 |sensor| |
3609 |
3609 |
3610 aView isNil ifTrue:[ |
3610 aView isNil ifTrue:[ |
3611 "/ event arrived, after I destroyed it myself |
3611 "/ event arrived, after I destroyed it myself |
3612 ^ self |
3612 ^ self |
3613 ]. |
3613 ]. |
3614 (sensor := aView sensor) notNil ifTrue:[ |
3614 (sensor := aView sensor) notNil ifTrue:[ |
3615 WindowsRightButtonBehavior == true ifTrue:[ |
3615 WindowsRightButtonBehavior == true ifTrue:[ |
3616 button >= 2 ifTrue:[ |
3616 button >= 2 ifTrue:[ |
3617 sensor buttonRelease:1 x:x y:y view:aView. |
3617 sensor buttonRelease:1 x:x y:y view:aView. |
3618 sensor buttonPress:button x:x y:y view:aView. |
3618 sensor buttonPress:button x:x y:y view:aView. |
3619 sensor buttonRelease:button x:x y:y view:aView. |
3619 sensor buttonRelease:button x:x y:y view:aView. |
3620 ^ self. |
3620 ^ self. |
3621 ]. |
3621 ]. |
3622 ]. |
3622 ]. |
3623 sensor buttonRelease:button x:x y:y view:aView |
3623 sensor buttonRelease:button x:x y:y view:aView |
3624 ] ifFalse:[ |
3624 ] ifFalse:[ |
3625 aView shown ifTrue:[ "/ could be a late event arrival |
3625 aView shown ifTrue:[ "/ could be a late event arrival |
3626 " |
3626 " |
3627 if there is no sensor ... |
3627 if there is no sensor ... |
3628 " |
3628 " |
3629 aView |
3629 aView |
3630 dispatchEvent:#buttonRelease:x:y: |
3630 dispatchEvent:#buttonRelease:x:y: |
3631 arguments:(Array with:button with:x with:y) |
3631 arguments:(Array with:button with:x with:y) |
3632 |
3632 |
3633 "/ WindowEvent |
3633 "/ WindowEvent |
3634 "/ sendEvent:#buttonRelease:x:y: |
3634 "/ sendEvent:#buttonRelease:x:y: |
3635 "/ arguments:(Array with:button with:x with:y) |
3635 "/ arguments:(Array with:button with:x with:y) |
3636 "/ view:aView |
3636 "/ view:aView |
3637 ] |
3637 ] |
3638 ] |
3638 ] |
3639 |
3639 |
3640 "Modified: / 20.5.1998 / 22:51:13 / cg" |
3640 "Modified: / 20.5.1998 / 22:51:13 / cg" |
3641 ! |
3641 ! |
3642 |
3642 |
3644 "forward a configure for some view" |
3644 "forward a configure for some view" |
3645 |
3645 |
3646 |sensor| |
3646 |sensor| |
3647 |
3647 |
3648 aView isNil ifTrue:[ |
3648 aView isNil ifTrue:[ |
3649 "/ event arrived, after I destroyed it myself |
3649 "/ event arrived, after I destroyed it myself |
3650 ^ self |
3650 ^ self |
3651 ]. |
3651 ]. |
3652 (sensor := aView sensor) notNil ifTrue:[ |
3652 (sensor := aView sensor) notNil ifTrue:[ |
3653 sensor configureX:x y:y width:w height:h view:aView |
3653 sensor configureX:x y:y width:w height:h view:aView |
3654 ] ifFalse:[ |
3654 ] ifFalse:[ |
3655 " |
3655 " |
3656 if there is no sensor ... |
3656 if there is no sensor ... |
3657 " |
3657 " |
3658 aView configureX:x y:y width:w height:h |
3658 aView configureX:x y:y width:w height:h |
3659 ] |
3659 ] |
3660 ! |
3660 ! |
3661 |
3661 |
3662 coveredBy:otherView view:aView |
3662 coveredBy:otherView view:aView |
3663 "forward a covered for some view" |
3663 "forward a covered for some view" |
3664 |
3664 |
3665 aView isNil ifTrue:[ |
3665 aView isNil ifTrue:[ |
3666 "/ event arrived, after I destroyed it myself |
3666 "/ event arrived, after I destroyed it myself |
3667 ^ self |
3667 ^ self |
3668 ]. |
3668 ]. |
3669 "/ |sensor| |
3669 "/ |sensor| |
3670 "/ |
3670 "/ |
3671 "/ (sensor := aView sensor) notNil ifTrue:[ |
3671 "/ (sensor := aView sensor) notNil ifTrue:[ |
3672 "/ sensor coveredBy:otherView view:aView |
3672 "/ sensor coveredBy:otherView view:aView |
3673 "/ ] ifFalse:[ |
3673 "/ ] ifFalse:[ |
3674 "/ " |
3674 "/ " |
3675 "/ if there is no sensor ... |
3675 "/ if there is no sensor ... |
3676 "/ " |
3676 "/ " |
3677 aView coveredBy:otherView |
3677 aView coveredBy:otherView |
3678 "/ ] |
3678 "/ ] |
3679 |
3679 |
3680 "Modified: / 8.2.1999 / 15:24:52 / cg" |
3680 "Modified: / 8.2.1999 / 15:24:52 / cg" |
3681 ! |
3681 ! |
3682 |
3682 |
3684 "forward a destroyed event for some view" |
3684 "forward a destroyed event for some view" |
3685 |
3685 |
3686 |sensor| |
3686 |sensor| |
3687 |
3687 |
3688 aView isNil ifTrue:[ |
3688 aView isNil ifTrue:[ |
3689 "/ event arrived, after I destroyed it myself |
3689 "/ event arrived, after I destroyed it myself |
3690 ^ self |
3690 ^ self |
3691 ]. |
3691 ]. |
3692 (sensor := aView sensor) notNil ifTrue:[ |
3692 (sensor := aView sensor) notNil ifTrue:[ |
3693 sensor destroyedView:aView |
3693 sensor destroyedView:aView |
3694 ] ifFalse:[ |
3694 ] ifFalse:[ |
3695 " |
3695 " |
3696 if there is no sensor ... |
3696 if there is no sensor ... |
3697 " |
3697 " |
3698 aView destroyed |
3698 aView destroyed |
3699 ] |
3699 ] |
3700 ! |
3700 ! |
3701 |
3701 |
3702 exposeX:x y:y width:w height:h view:aView |
3702 exposeX:x y:y width:w height:h view:aView |
3703 "forward an expose for some view" |
3703 "forward an expose for some view" |
3704 |
3704 |
3705 |sensor| |
3705 |sensor| |
3706 |
3706 |
3707 aView isNil ifTrue:[ |
3707 aView isNil ifTrue:[ |
3708 "/ event arrived, after I destroyed it myself |
3708 "/ event arrived, after I destroyed it myself |
3709 ^ self |
3709 ^ self |
3710 ]. |
3710 ]. |
3711 (sensor := aView sensor) notNil ifTrue:[ |
3711 (sensor := aView sensor) notNil ifTrue:[ |
3712 sensor exposeX:x y:y width:w height:h view:aView |
3712 sensor exposeX:x y:y width:w height:h view:aView |
3713 ] ifFalse:[ |
3713 ] ifFalse:[ |
3714 " |
3714 " |
3715 if there is no sensor ... |
3715 if there is no sensor ... |
3716 " |
3716 " |
3717 aView |
3717 aView |
3718 dispatchEvent:#exposeX:y:width:height: |
3718 dispatchEvent:#exposeX:y:width:height: |
3719 arguments:(Array with:x with:y with:w with:h) |
3719 arguments:(Array with:x with:y with:w with:h) |
3720 |
3720 |
3721 "/ WindowEvent |
3721 "/ WindowEvent |
3722 "/ sendEvent:#exposeX:y:width:height: |
3722 "/ sendEvent:#exposeX:y:width:height: |
3723 "/ arguments:(Array with:x with:y with:w with:h) |
3723 "/ arguments:(Array with:x with:y with:w with:h) |
3724 "/ view:aView |
3724 "/ view:aView |
3731 "forward a focusIn event for some view" |
3731 "forward a focusIn event for some view" |
3732 |
3732 |
3733 |sensor| |
3733 |sensor| |
3734 |
3734 |
3735 aView isNil ifTrue:[ |
3735 aView isNil ifTrue:[ |
3736 "/ event arrived, after I destroyed it myself |
3736 "/ event arrived, after I destroyed it myself |
3737 ^ self |
3737 ^ self |
3738 ]. |
3738 ]. |
3739 (sensor := aView sensor) notNil ifTrue:[ |
3739 (sensor := aView sensor) notNil ifTrue:[ |
3740 sensor focusInView:aView |
3740 sensor focusInView:aView |
3741 ] ifFalse:[ |
3741 ] ifFalse:[ |
3742 " |
3742 " |
3743 if there is no sensor ... |
3743 if there is no sensor ... |
3744 " |
3744 " |
3745 aView |
3745 aView |
3746 dispatchEvent:#focusIn |
3746 dispatchEvent:#focusIn |
3747 arguments:nil |
3747 arguments:nil |
3748 |
3748 |
3749 "/ WindowEvent |
3749 "/ WindowEvent |
3750 "/ sendEvent:#focusIn |
3750 "/ sendEvent:#focusIn |
3751 "/ arguments:nil |
3751 "/ arguments:nil |
3752 "/ view:aView |
3752 "/ view:aView |
3759 "forward a focusOut event for some view" |
3759 "forward a focusOut event for some view" |
3760 |
3760 |
3761 |sensor| |
3761 |sensor| |
3762 |
3762 |
3763 aView isNil ifTrue:[ |
3763 aView isNil ifTrue:[ |
3764 "/ event arrived, after I destroyed it myself |
3764 "/ event arrived, after I destroyed it myself |
3765 ^ self |
3765 ^ self |
3766 ]. |
3766 ]. |
3767 (sensor := aView sensor) notNil ifTrue:[ |
3767 (sensor := aView sensor) notNil ifTrue:[ |
3768 sensor focusOutView:aView |
3768 sensor focusOutView:aView |
3769 ] ifFalse:[ |
3769 ] ifFalse:[ |
3770 " |
3770 " |
3771 if there is no sensor ... |
3771 if there is no sensor ... |
3772 " |
3772 " |
3773 aView |
3773 aView |
3774 dispatchEvent:#focusOut |
3774 dispatchEvent:#focusOut |
3775 arguments:nil |
3775 arguments:nil |
3776 |
3776 |
3777 "/ WindowEvent |
3777 "/ WindowEvent |
3778 "/ sendEvent:#focusOut |
3778 "/ sendEvent:#focusOut |
3779 "/ arguments:nil |
3779 "/ arguments:nil |
3780 "/ view:aView |
3780 "/ view:aView |
3787 "forward a graphic expose for some view" |
3787 "forward a graphic expose for some view" |
3788 |
3788 |
3789 |sensor| |
3789 |sensor| |
3790 |
3790 |
3791 aView isNil ifTrue:[ |
3791 aView isNil ifTrue:[ |
3792 "/ event arrived, after I destroyed it myself |
3792 "/ event arrived, after I destroyed it myself |
3793 ^ self |
3793 ^ self |
3794 ]. |
3794 ]. |
3795 (sensor := aView sensor) notNil ifTrue:[ |
3795 (sensor := aView sensor) notNil ifTrue:[ |
3796 sensor graphicsExposeX:x y:y width:w height:h final:final view:aView |
3796 sensor graphicsExposeX:x y:y width:w height:h final:final view:aView |
3797 ] ifFalse:[ |
3797 ] ifFalse:[ |
3798 " |
3798 " |
3799 if there is no sensor ... |
3799 if there is no sensor ... |
3800 " |
3800 " |
3801 aView |
3801 aView |
3802 dispatchEvent:#graphicsExposeX:y:width:height:final: |
3802 dispatchEvent:#graphicsExposeX:y:width:height:final: |
3803 arguments:(Array with:x with:y with:w with:h with:final) |
3803 arguments:(Array with:x with:y with:w with:h with:final) |
3804 |
3804 |
3805 "/ WindowEvent |
3805 "/ WindowEvent |
3806 "/ sendEvent:#graphicsExposeX:y:width:height:final: |
3806 "/ sendEvent:#graphicsExposeX:y:width:height:final: |
3807 "/ arguments:(Array with:x with:y with:w with:h with:final) |
3807 "/ arguments:(Array with:x with:y with:w with:h with:final) |
3808 "/ view:aView |
3808 "/ view:aView |
3820 |
3820 |
3821 "/ |
3821 "/ |
3822 "/ ctrl-Esc gives up focus |
3822 "/ ctrl-Esc gives up focus |
3823 "/ |
3823 "/ |
3824 untranslatedKey == #Escape ifTrue:[ |
3824 untranslatedKey == #Escape ifTrue:[ |
3825 ctrlDown ifTrue:[ |
3825 ctrlDown ifTrue:[ |
3826 self ungrabPointer. |
3826 self ungrabPointer. |
3827 self setInputFocusTo:nil |
3827 self setInputFocusTo:nil |
3828 ] |
3828 ] |
3829 ]. |
3829 ]. |
3830 |
3830 |
3831 self modifierKeyProcessing:untranslatedKey down:true. |
3831 self modifierKeyProcessing:untranslatedKey down:true. |
3832 |
3832 |
3833 aView isNil ifTrue:[ |
3833 aView isNil ifTrue:[ |
3834 "/ event arrived, after I destroyed it myself |
3834 "/ event arrived, after I destroyed it myself |
3835 ^ self |
3835 ^ self |
3836 ]. |
3836 ]. |
3837 (sensor := aView sensor) notNil ifTrue:[ |
3837 (sensor := aView sensor) notNil ifTrue:[ |
3838 sensor keyPress:untranslatedKey x:x y:y view:aView |
3838 sensor keyPress:untranslatedKey x:x y:y view:aView |
3839 ] ifFalse:[ |
3839 ] ifFalse:[ |
3840 aView shown ifTrue:[ "/ could be a late event arrival |
3840 aView shown ifTrue:[ "/ could be a late event arrival |
3841 " |
3841 " |
3842 if there is no sensor ... |
3842 if there is no sensor ... |
3843 " |
3843 " |
3844 xlatedKey := self translateKey:untranslatedKey forView:aView. |
3844 xlatedKey := self translateKey:untranslatedKey forView:aView. |
3845 xlatedKey notNil ifTrue:[ |
3845 xlatedKey notNil ifTrue:[ |
3846 aView |
3846 aView |
3847 dispatchEvent:#keyPress:x:y: |
3847 dispatchEvent:#keyPress:x:y: |
3848 arguments:(Array with:xlatedKey with:x with:y) |
3848 arguments:(Array with:xlatedKey with:x with:y) |
3849 |
3849 |
3850 "/ WindowEvent |
3850 "/ WindowEvent |
3851 "/ sendEvent:#keyPress:x:y: |
3851 "/ sendEvent:#keyPress:x:y: |
3852 "/ arguments:(Array with:xlatedKey with:x with:y) |
3852 "/ arguments:(Array with:xlatedKey with:x with:y) |
3853 "/ view:aView |
3853 "/ view:aView |
3854 ] |
3854 ] |
3855 ] |
3855 ] |
3856 ] |
3856 ] |
3857 |
3857 |
3858 "Modified: / 20.5.1998 / 22:52:36 / cg" |
3858 "Modified: / 20.5.1998 / 22:52:36 / cg" |
3859 ! |
3859 ! |
3860 |
3860 |
3864 |xlatedKey sensor| |
3864 |xlatedKey sensor| |
3865 |
3865 |
3866 self modifierKeyProcessing:untranslatedKey down:false. |
3866 self modifierKeyProcessing:untranslatedKey down:false. |
3867 |
3867 |
3868 aView isNil ifTrue:[ |
3868 aView isNil ifTrue:[ |
3869 "/ event arrived, after I destroyed it myself |
3869 "/ event arrived, after I destroyed it myself |
3870 ^ self |
3870 ^ self |
3871 ]. |
3871 ]. |
3872 (sensor := aView sensor) notNil ifTrue:[ |
3872 (sensor := aView sensor) notNil ifTrue:[ |
3873 sensor keyRelease:untranslatedKey x:x y:y view:aView |
3873 sensor keyRelease:untranslatedKey x:x y:y view:aView |
3874 ] ifFalse:[ |
3874 ] ifFalse:[ |
3875 aView shown ifTrue:[ "/ could be a late event arrival |
3875 aView shown ifTrue:[ "/ could be a late event arrival |
3876 " |
3876 " |
3877 if there is no sensor ... |
3877 if there is no sensor ... |
3878 " |
3878 " |
3879 xlatedKey := self translateKey:untranslatedKey forView:aView. |
3879 xlatedKey := self translateKey:untranslatedKey forView:aView. |
3880 xlatedKey notNil ifTrue:[ |
3880 xlatedKey notNil ifTrue:[ |
3881 aView |
3881 aView |
3882 dispatchEvent:#keyRelease:x:y: |
3882 dispatchEvent:#keyRelease:x:y: |
3883 arguments:(Array with:xlatedKey with:x with:y) |
3883 arguments:(Array with:xlatedKey with:x with:y) |
3884 |
3884 |
3885 "/ WindowEvent |
3885 "/ WindowEvent |
3886 "/ sendEvent:#keyRelease:x:y: |
3886 "/ sendEvent:#keyRelease:x:y: |
3887 "/ arguments:(Array with:xlatedKey with:x with:y) |
3887 "/ arguments:(Array with:xlatedKey with:x with:y) |
3888 "/ view:aView |
3888 "/ view:aView |
3889 ] |
3889 ] |
3890 ] |
3890 ] |
3891 ] |
3891 ] |
3892 |
3892 |
3893 "Modified: / 20.5.1998 / 22:52:52 / cg" |
3893 "Modified: / 20.5.1998 / 22:52:52 / cg" |
3894 ! |
3894 ! |
3895 |
3895 |
3897 "forward a mapped event for some view" |
3897 "forward a mapped event for some view" |
3898 |
3898 |
3899 |sensor| |
3899 |sensor| |
3900 |
3900 |
3901 aView isNil ifTrue:[ |
3901 aView isNil ifTrue:[ |
3902 "/ event arrived, after I destroyed it myself |
3902 "/ event arrived, after I destroyed it myself |
3903 ^ self |
3903 ^ self |
3904 ]. |
3904 ]. |
3905 (sensor := aView sensor) notNil ifTrue:[ |
3905 (sensor := aView sensor) notNil ifTrue:[ |
3906 sensor mappedView:aView |
3906 sensor mappedView:aView |
3907 ] ifFalse:[ |
3907 ] ifFalse:[ |
3908 " |
3908 " |
3909 if there is no sensor ... |
3909 if there is no sensor ... |
3910 " |
3910 " |
3911 aView mapped |
3911 aView mapped |
3912 ] |
3912 ] |
3913 ! |
3913 ! |
3914 |
3914 |
3915 mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime view:aView |
3915 mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime view:aView |
3916 "the mousewheel was moved by some amount (signed). |
3916 "the mousewheel was moved by some amount (signed). |
3917 This event is sent to the current pointer view (like keyPress/release)." |
3917 This event is sent to the current pointer view (like keyPress/release)." |
3918 |
3918 |
3919 |sensor| |
3919 |sensor| |
3920 |
3920 |
3921 aView isNil ifTrue:[ |
3921 aView isNil ifTrue:[ |
3922 "/ event arrived, after I destroyed it myself |
3922 "/ event arrived, after I destroyed it myself |
3923 ^ self |
3923 ^ self |
3924 ]. |
3924 ]. |
3925 (sensor := aView sensor) notNil ifTrue:[ |
3925 (sensor := aView sensor) notNil ifTrue:[ |
3926 sensor mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime view:aView |
3926 sensor mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime view:aView |
3927 ] ifFalse:[ |
3927 ] ifFalse:[ |
3928 aView shown ifTrue:[ "/ could be a late event arrival |
3928 aView shown ifTrue:[ "/ could be a late event arrival |
3929 " |
3929 " |
3930 if there is no sensor ... |
3930 if there is no sensor ... |
3931 " |
3931 " |
3932 aView |
3932 aView |
3933 dispatchEvent:#mouseWheelMotion:x:y:amount:deltaTime: |
3933 dispatchEvent:#mouseWheelMotion:x:y:amount:deltaTime: |
3934 arguments:(Array with:buttonState with:x with:y with:amount with:dTime ) |
3934 arguments:(Array with:buttonState with:x with:y with:amount with:dTime ) |
3935 ] |
3935 ] |
3936 ] |
3936 ] |
3937 |
3937 |
3938 "Modified: / 21.5.1999 / 13:05:53 / cg" |
3938 "Modified: / 21.5.1999 / 13:05:53 / cg" |
3939 ! |
3939 ! |
3940 |
3940 |
3942 "forward a noExpose event for some view" |
3942 "forward a noExpose event for some view" |
3943 |
3943 |
3944 |sensor| |
3944 |sensor| |
3945 |
3945 |
3946 aView isNil ifTrue:[ |
3946 aView isNil ifTrue:[ |
3947 "/ event arrived, after I destroyed it myself |
3947 "/ event arrived, after I destroyed it myself |
3948 ^ self |
3948 ^ self |
3949 ]. |
3949 ]. |
3950 (sensor := aView sensor) notNil ifTrue:[ |
3950 (sensor := aView sensor) notNil ifTrue:[ |
3951 sensor noExposeView:aView |
3951 sensor noExposeView:aView |
3952 ] ifFalse:[ |
3952 ] ifFalse:[ |
3953 " |
3953 " |
3954 if there is no sensor ... |
3954 if there is no sensor ... |
3955 " |
3955 " |
3956 aView noExpose |
3956 aView noExpose |
3957 ] |
3957 ] |
3958 ! |
3958 ! |
3959 |
3959 |
3960 pointerEnter:buttonState x:x y:y view:aView |
3960 pointerEnter:buttonState x:x y:y view:aView |
3961 "forward a pointer enter for some view" |
3961 "forward a pointer enter for some view" |
3962 |
3962 |
3963 |sensor| |
3963 |sensor| |
3964 |
3964 |
3965 aView isNil ifTrue:[ |
3965 aView isNil ifTrue:[ |
3966 "/ event arrived, after I destroyed it myself |
3966 "/ event arrived, after I destroyed it myself |
3967 ^ self |
3967 ^ self |
3968 ]. |
3968 ]. |
3969 (sensor := aView sensor) notNil ifTrue:[ |
3969 (sensor := aView sensor) notNil ifTrue:[ |
3970 sensor pointerEnter:buttonState x:x y:y view:aView |
3970 sensor pointerEnter:buttonState x:x y:y view:aView |
3971 ] ifFalse:[ |
3971 ] ifFalse:[ |
3972 " |
3972 " |
3973 if there is no sensor ... |
3973 if there is no sensor ... |
3974 " |
3974 " |
3975 aView |
3975 aView |
3976 dispatchEvent:#pointerEnter:x:y: |
3976 dispatchEvent:#pointerEnter:x:y: |
3977 arguments:(Array with:buttonState with:x with:y) |
3977 arguments:(Array with:buttonState with:x with:y) |
3978 |
3978 |
3979 "/ WindowEvent |
3979 "/ WindowEvent |
3980 "/ sendEvent:#pointerEnter:x:y: |
3980 "/ sendEvent:#pointerEnter:x:y: |
3981 "/ arguments:(Array with:buttonState with:x with:y) |
3981 "/ arguments:(Array with:buttonState with:x with:y) |
3982 "/ view:aView |
3982 "/ view:aView |
3989 "forward a pointer leave for some view" |
3989 "forward a pointer leave for some view" |
3990 |
3990 |
3991 |sensor| |
3991 |sensor| |
3992 |
3992 |
3993 aView isNil ifTrue:[ |
3993 aView isNil ifTrue:[ |
3994 "/ event arrived, after I destroyed it myself |
3994 "/ event arrived, after I destroyed it myself |
3995 ^ self |
3995 ^ self |
3996 ]. |
3996 ]. |
3997 (sensor := aView sensor) notNil ifTrue:[ |
3997 (sensor := aView sensor) notNil ifTrue:[ |
3998 sensor pointerLeave:buttonState view:aView |
3998 sensor pointerLeave:buttonState view:aView |
3999 ] ifFalse:[ |
3999 ] ifFalse:[ |
4000 " |
4000 " |
4001 if there is no sensor ... |
4001 if there is no sensor ... |
4002 " |
4002 " |
4003 aView |
4003 aView |
4004 dispatchEvent:#pointerLeave: |
4004 dispatchEvent:#pointerLeave: |
4005 arguments:(Array with:buttonState) |
4005 arguments:(Array with:buttonState) |
4006 |
4006 |
4007 "/ WindowEvent |
4007 "/ WindowEvent |
4008 "/ sendEvent:#pointerLeave: |
4008 "/ sendEvent:#pointerLeave: |
4009 "/ arguments:(Array with:buttonState) |
4009 "/ arguments:(Array with:buttonState) |
4010 "/ view:aView |
4010 "/ view:aView |
4017 "forward a saveAndTerminate event for some view" |
4017 "forward a saveAndTerminate event for some view" |
4018 |
4018 |
4019 |sensor| |
4019 |sensor| |
4020 |
4020 |
4021 aView isNil ifTrue:[ |
4021 aView isNil ifTrue:[ |
4022 "/ event arrived, after I destroyed it myself |
4022 "/ event arrived, after I destroyed it myself |
4023 ^ self |
4023 ^ self |
4024 ]. |
4024 ]. |
4025 (sensor := aView sensor) notNil ifTrue:[ |
4025 (sensor := aView sensor) notNil ifTrue:[ |
4026 sensor saveAndTerminateView:aView |
4026 sensor saveAndTerminateView:aView |
4027 ] ifFalse:[ |
4027 ] ifFalse:[ |
4028 " |
4028 " |
4029 if there is no sensor ... |
4029 if there is no sensor ... |
4030 " |
4030 " |
4031 aView saveAndTerminate |
4031 aView saveAndTerminate |
4032 ] |
4032 ] |
4033 ! |
4033 ! |
4034 |
4034 |
4035 terminateView:aView |
4035 terminateView:aView |
4036 "forward a terminate event for some view" |
4036 "forward a terminate event for some view" |
4037 |
4037 |
4038 |sensor| |
4038 |sensor| |
4039 |
4039 |
4040 aView isNil ifTrue:[ |
4040 aView isNil ifTrue:[ |
4041 "/ event arrived, after I destroyed it myself |
4041 "/ event arrived, after I destroyed it myself |
4042 ^ self |
4042 ^ self |
4043 ]. |
4043 ]. |
4044 (sensor := aView sensor) notNil ifTrue:[ |
4044 (sensor := aView sensor) notNil ifTrue:[ |
4045 sensor terminateView:aView |
4045 sensor terminateView:aView |
4046 ] ifFalse:[ |
4046 ] ifFalse:[ |
4047 " |
4047 " |
4048 if there is no sensor ... |
4048 if there is no sensor ... |
4049 " |
4049 " |
4050 aView terminate |
4050 aView terminate |
4051 ] |
4051 ] |
4052 ! |
4052 ! |
4053 |
4053 |
4054 unmappedView:aView |
4054 unmappedView:aView |
4055 "forward an unmapped event for some view" |
4055 "forward an unmapped event for some view" |
4056 |
4056 |
4057 |sensor| |
4057 |sensor| |
4058 |
4058 |
4059 aView isNil ifTrue:[ |
4059 aView isNil ifTrue:[ |
4060 "/ event arrived, after I destroyed it myself |
4060 "/ event arrived, after I destroyed it myself |
4061 ^ self |
4061 ^ self |
4062 ]. |
4062 ]. |
4063 (sensor := aView sensor) notNil ifTrue:[ |
4063 (sensor := aView sensor) notNil ifTrue:[ |
4064 sensor unmappedView:aView |
4064 sensor unmappedView:aView |
4065 ] ifFalse:[ |
4065 ] ifFalse:[ |
4066 " |
4066 " |
4067 if there is no sensor ... |
4067 if there is no sensor ... |
4068 " |
4068 " |
4069 aView unmapped |
4069 aView unmapped |
4070 ] |
4070 ] |
4071 ! ! |
4071 ! ! |
4072 |
4072 |
4073 !DeviceWorkstation methodsFor:'event handling'! |
4073 !DeviceWorkstation methodsFor:'event handling'! |
4074 |
4074 |
4079 We only do this for displays other that the default Display." |
4079 We only do this for displays other that the default Display." |
4080 |
4080 |
4081 dispatching ifFalse:[^ self]. |
4081 dispatching ifFalse:[^ self]. |
4082 |
4082 |
4083 self == Display ifTrue:[ |
4083 self == Display ifTrue:[ |
4084 ExitOnLastClose == true ifFalse:[^ self]. |
4084 ExitOnLastClose == true ifFalse:[^ self]. |
4085 ]. |
4085 ]. |
4086 exitOnLastClose == true ifFalse:[^ self]. |
4086 exitOnLastClose == true ifFalse:[^ self]. |
4087 |
4087 |
4088 knownViews notNil ifTrue:[ |
4088 knownViews notNil ifTrue:[ |
4089 (knownViews findFirst:[:slot | |
4089 (knownViews findFirst:[:slot | |
4090 slot notNil |
4090 slot notNil |
4091 and:[slot ~~ 0 "/ if there is no non-popup |
4091 and:[slot ~~ 0 "/ if there is no non-popup |
4092 and:[slot isRootView not "/ non-dialog ... |
4092 and:[slot isRootView not "/ non-dialog ... |
4093 and:[slot isTopView "/ stop dispatching. |
4093 and:[slot isTopView "/ stop dispatching. |
4094 and:[slot isPopUpView not |
4094 and:[slot isPopUpView not |
4095 and:[slot isModal not |
4095 and:[slot isModal not |
4096 "and:[slot realized]"]]]]]]) == 0 ifTrue:[ |
4096 "and:[slot realized]"]]]]]]) == 0 ifTrue:[ |
4097 "/ my last view was closed |
4097 "/ my last view was closed |
4098 dispatching := false. |
4098 dispatching := false. |
4099 'DeviceWorkstation [info]: finished dispatch (last view closed)' infoPrintCR. |
4099 'DeviceWorkstation [info]: finished dispatch (last view closed)' infoPrintCR. |
4100 LastActiveScreen == self ifTrue:[ |
4100 LastActiveScreen == self ifTrue:[ |
4101 LastActiveScreen := nil. |
4101 LastActiveScreen := nil. |
4102 LastActiveProcess := nil. |
4102 LastActiveProcess := nil. |
4103 ]. |
4103 ]. |
4104 ] |
4104 ] |
4105 ]. |
4105 ]. |
4106 |
4106 |
4107 "Modified: 19.9.1995 / 11:31:54 / claus" |
4107 "Modified: 19.9.1995 / 11:31:54 / claus" |
4108 "Modified: 18.3.1997 / 10:42:11 / cg" |
4108 "Modified: 18.3.1997 / 10:42:11 / cg" |
4109 ! |
4109 ! |
4142 it is used; otherwise we poll (with a delay to not lock up |
4142 it is used; otherwise we poll (with a delay to not lock up |
4143 the workstation) |
4143 the workstation) |
4144 " |
4144 " |
4145 myFd := self displayFileDescriptor. |
4145 myFd := self displayFileDescriptor. |
4146 [aBlock value] whileTrue:[ |
4146 [aBlock value] whileTrue:[ |
4147 self eventPending ifFalse:[ |
4147 self eventPending ifFalse:[ |
4148 myFd isNil ifTrue:[ |
4148 myFd isNil ifTrue:[ |
4149 OperatingSystem millisecondDelay:50 |
4149 OperatingSystem millisecondDelay:50 |
4150 ] ifFalse:[ |
4150 ] ifFalse:[ |
4151 OperatingSystem selectOn:myFd withTimeOut:50. |
4151 OperatingSystem selectOn:myFd withTimeOut:50. |
4152 ]. |
4152 ]. |
4153 Processor evaluateTimeouts. |
4153 Processor evaluateTimeouts. |
4154 ]. |
4154 ]. |
4155 self eventPending ifTrue:[ |
4155 self eventPending ifTrue:[ |
4156 self dispatchEvent |
4156 self dispatchEvent |
4157 ]. |
4157 ]. |
4158 ] |
4158 ] |
4159 ! |
4159 ! |
4160 |
4160 |
4161 dispatchPendingEvents |
4161 dispatchPendingEvents |
4162 "go dispatch events as long as there is one. |
4162 "go dispatch events as long as there is one. |
4163 This is only used with modal operation. |
4163 This is only used with modal operation. |
4164 (i.e. when in the modal debugger)" |
4164 (i.e. when in the modal debugger)" |
4165 |
4165 |
4166 Object osSignalInterruptSignal handle:[:ex | |
4166 Object osSignalInterruptSignal handle:[:ex | |
4167 ex return |
4167 ex return |
4168 ] do:[ |
4168 ] do:[ |
4169 [self eventPending] whileTrue:[ |
4169 [self eventPending] whileTrue:[ |
4170 self dispatchEventFor:nil withMask:nil |
4170 self dispatchEventFor:nil withMask:nil |
4171 ] |
4171 ] |
4172 ] |
4172 ] |
4173 ! |
4173 ! |
4174 |
4174 |
4175 disposeButtonEventsFor:aViewIdOrNil |
4175 disposeButtonEventsFor:aViewIdOrNil |
4176 "dispose (i.e. forget) all pending button events on this display" |
4176 "dispose (i.e. forget) all pending button events on this display" |
4185 |
4185 |
4186 disposeEvents |
4186 disposeEvents |
4187 "dispose (i.e. forget) all events pending on this display" |
4187 "dispose (i.e. forget) all events pending on this display" |
4188 |
4188 |
4189 [self eventPending] whileTrue:[ |
4189 [self eventPending] whileTrue:[ |
4190 self getEventFor:nil withMask:nil |
4190 self getEventFor:nil withMask:nil |
4191 ]. |
4191 ]. |
4192 ! |
4192 ! |
4193 |
4193 |
4194 disposeEventsWithMask:aMask for:aWindowId |
4194 disposeEventsWithMask:aMask for:aWindowId |
4195 "dispose (throw away) specific events" |
4195 "dispose (throw away) specific events" |
4268 "/ |
4268 "/ |
4269 dispatching ifTrue:[^ self]. |
4269 dispatching ifTrue:[^ self]. |
4270 dispatching := true. |
4270 dispatching := true. |
4271 |
4271 |
4272 AllScreens isNil ifTrue:[ |
4272 AllScreens isNil ifTrue:[ |
4273 AllScreens := IdentitySet new:1 |
4273 AllScreens := IdentitySet new:1 |
4274 ]. |
4274 ]. |
4275 AllScreens add:self. |
4275 AllScreens add:self. |
4276 |
4276 |
4277 fd := self displayFileDescriptor. |
4277 fd := self displayFileDescriptor. |
4278 |
4278 |
4284 "/ on the eventQ (i.e. windows). |
4284 "/ on the eventQ (i.e. windows). |
4285 |
4285 |
4286 inputSema := Semaphore new name:'display inputSema'. |
4286 inputSema := Semaphore new name:'display inputSema'. |
4287 |
4287 |
4288 p := [ |
4288 p := [ |
4289 self initializeDeviceResources. |
4289 self initializeDeviceResources. |
4290 |
4290 |
4291 DeviceIOErrorSignal handle:[:ex | |
4291 DeviceIOErrorSignal handle:[:ex | |
4292 "/ test for handlerBlock until the signal is changed to be classed based. |
4292 "/ test for handlerBlock until the signal is changed to be classed based. |
4293 ex signal handlerBlock notNil ifTrue:[ |
4293 ex signal handlerBlock notNil ifTrue:[ |
4294 ex defaultAction. |
4294 ex defaultAction. |
4295 ] ifFalse:[ |
4295 ] ifFalse:[ |
4296 'DeviceWorkstation [warning]: stop dispatch due to I/O error' errorPrintCR. |
4296 'DeviceWorkstation [warning]: stop dispatch due to I/O error' errorPrintCR. |
4297 self brokenConnection. |
4297 self brokenConnection. |
4298 ]. |
4298 ]. |
4299 ex return. |
4299 ex return. |
4300 ] do:[ |
4300 ] do:[ |
4301 [ |
4301 [ |
4302 [dispatching] whileTrue:[ |
4302 [dispatching] whileTrue:[ |
4303 AbortSignal handle:[:ex | |
4303 AbortSignal handle:[:ex | |
4304 ex return |
4304 ex return |
4305 ] do:[ |
4305 ] do:[ |
4306 self eventPending ifFalse:[ |
4306 self eventPending ifFalse:[ |
4307 Processor activeProcess setStateTo:#ioWait if:#active. |
4307 Processor activeProcess setStateTo:#ioWait if:#active. |
4308 inputSema wait. |
4308 inputSema wait. |
4309 ]. |
4309 ]. |
4310 dispatching ifTrue:[ |
4310 dispatching ifTrue:[ |
4311 self dispatchPendingEvents. |
4311 self dispatchPendingEvents. |
4312 ]. |
4312 ]. |
4313 ] |
4313 ] |
4314 ] |
4314 ] |
4315 ] valueOnUnwindDo:[ |
4315 ] valueOnUnwindDo:[ |
4316 inputSema notNil ifTrue:[ |
4316 inputSema notNil ifTrue:[ |
4317 Processor disableSemaphore:inputSema. |
4317 Processor disableSemaphore:inputSema. |
4318 inputSema := nil. |
4318 inputSema := nil. |
4319 ]. |
4319 ]. |
4320 dispatchProcess := nil. |
4320 dispatchProcess := nil. |
4321 self emergencyCloseConnection. |
4321 self emergencyCloseConnection. |
4322 ]. |
4322 ]. |
4323 inputSema notNil ifTrue:[ |
4323 inputSema notNil ifTrue:[ |
4324 Processor disableSemaphore:inputSema. |
4324 Processor disableSemaphore:inputSema. |
4325 inputSema := nil. |
4325 inputSema := nil. |
4326 ]. |
4326 ]. |
4327 dispatchProcess := nil. |
4327 dispatchProcess := nil. |
4328 self close. |
4328 self close. |
4329 ]. |
4329 ]. |
4330 ] newProcess. |
4330 ] newProcess. |
4331 |
4331 |
4332 "/ |
4332 "/ |
4333 "/ give the process a nice name (for the processMonitor) |
4333 "/ give the process a nice name (for the processMonitor) |
4334 "/ |
4334 "/ |
4335 (nm := self displayName) notNil ifTrue:[ |
4335 (nm := self displayName) notNil ifTrue:[ |
4336 nm := 'event dispatcher (' , nm , ')'. |
4336 nm := 'event dispatcher (' , nm , ')'. |
4337 ] ifFalse:[ |
4337 ] ifFalse:[ |
4338 nm := 'event dispatcher'. |
4338 nm := 'event dispatcher'. |
4339 ]. |
4339 ]. |
4340 p name:nm. |
4340 p name:nm. |
4341 p priority:(Processor userInterruptPriority). |
4341 p priority:(Processor userInterruptPriority). |
4342 p beSystemProcess. |
4342 p beSystemProcess. |
4343 dispatchProcess := p. |
4343 dispatchProcess := p. |
4345 |
4345 |
4346 "/ finally, arrange for the processor to signal that semaphore when input |
4346 "/ finally, arrange for the processor to signal that semaphore when input |
4347 "/ is available or #eventPending returns true |
4347 "/ is available or #eventPending returns true |
4348 |
4348 |
4349 fd isNil ifTrue:[ |
4349 fd isNil ifTrue:[ |
4350 "no fd -- so have to check for input also" |
4350 "no fd -- so have to check for input also" |
4351 checkBlock := [self eventPending]. |
4351 checkBlock := [self eventPending]. |
4352 ] ifFalse:[ |
4352 ] ifFalse:[ |
4353 "there is a fd, so checkblock has to check only the internal queue" |
4353 "there is a fd, so checkblock has to check only the internal queue" |
4354 checkBlock := [self eventQueued]. |
4354 checkBlock := [self eventQueued]. |
4355 ]. |
4355 ]. |
4356 |
4356 |
4357 Processor signal:inputSema onInput:fd orCheck:checkBlock. |
4357 Processor signal:inputSema onInput:fd orCheck:checkBlock. |
4358 |
4358 |
4359 "Modified: / 12.12.1995 / 20:52:57 / stefan" |
4359 "Modified: / 12.12.1995 / 20:52:57 / stefan" |
4364 "stop the dispatch process" |
4364 "stop the dispatch process" |
4365 |
4365 |
4366 |p| |
4366 |p| |
4367 |
4367 |
4368 LastActiveScreen == self ifTrue:[ |
4368 LastActiveScreen == self ifTrue:[ |
4369 LastActiveScreen := nil. |
4369 LastActiveScreen := nil. |
4370 LastActiveProcess := nil. |
4370 LastActiveProcess := nil. |
4371 ]. |
4371 ]. |
4372 |
4372 |
4373 (p := dispatchProcess) notNil ifTrue:[ |
4373 (p := dispatchProcess) notNil ifTrue:[ |
4374 dispatchProcess := nil. |
4374 dispatchProcess := nil. |
4375 p terminateWithAllSubprocesses. |
4375 p terminateWithAllSubprocesses. |
4376 p terminateNoSignal. "/ just in case |
4376 p terminateNoSignal. "/ just in case |
4377 ] |
4377 ] |
4378 ! ! |
4378 ! ! |
4379 |
4379 |
4380 !DeviceWorkstation methodsFor:'event sending'! |
4380 !DeviceWorkstation methodsFor:'event sending'! |
4381 |
4381 |
4395 simulateKeyboardInput:aCharacterOrString inViewId:viewId |
4395 simulateKeyboardInput:aCharacterOrString inViewId:viewId |
4396 "send input to some other view, by simulating keyPress/keyRelease |
4396 "send input to some other view, by simulating keyPress/keyRelease |
4397 events. |
4397 events. |
4398 Only a few control characters are supported. |
4398 Only a few control characters are supported. |
4399 Notice: not all alien views allow this kind of synthetic input; |
4399 Notice: not all alien views allow this kind of synthetic input; |
4400 some simply ignore it." |
4400 some simply ignore it." |
4401 |
4401 |
4402 |control code state| |
4402 |control code state| |
4403 |
4403 |
4404 aCharacterOrString isString ifTrue:[ |
4404 aCharacterOrString isString ifTrue:[ |
4405 aCharacterOrString do:[:char | |
4405 aCharacterOrString do:[:char | |
4406 self simulateKeyboardInput:char inViewId:viewId |
4406 self simulateKeyboardInput:char inViewId:viewId |
4407 ]. |
4407 ]. |
4408 ^ self |
4408 ^ self |
4409 ]. |
4409 ]. |
4410 |
4410 |
4411 control := false. |
4411 control := false. |
4412 code := aCharacterOrString asciiValue. |
4412 code := aCharacterOrString asciiValue. |
4413 |
4413 |
4414 (aCharacterOrString == Character cr) ifTrue:[ |
4414 (aCharacterOrString == Character cr) ifTrue:[ |
4415 code := #Return |
4415 code := #Return |
4416 ] ifFalse:[ |
4416 ] ifFalse:[ |
4417 (aCharacterOrString == Character tab) ifTrue:[ |
4417 (aCharacterOrString == Character tab) ifTrue:[ |
4418 code := #Tab |
4418 code := #Tab |
4419 ] ifFalse:[ |
4419 ] ifFalse:[ |
4420 (aCharacterOrString == Character esc) ifTrue:[ |
4420 (aCharacterOrString == Character esc) ifTrue:[ |
4421 code := #Escape |
4421 code := #Escape |
4422 ] |
4422 ] |
4423 ] |
4423 ] |
4424 ]. |
4424 ]. |
4425 |
4425 |
4426 control ifTrue:[ |
4426 control ifTrue:[ |
4427 state := self ctrlModifierMask |
4427 state := self ctrlModifierMask |
4428 ]. |
4428 ]. |
4429 |
4429 |
4430 |
4430 |
4431 "/ the stuff below should not be needed |
4431 "/ the stuff below should not be needed |
4432 "/ (sendKeyOrButtonevent should be able to figure out things itself) |
4432 "/ (sendKeyOrButtonevent should be able to figure out things itself) |
4433 "/ however, on some linux systems it seems to not work correctly. |
4433 "/ however, on some linux systems it seems to not work correctly. |
4434 "/ Hopefully, this is correct ... |
4434 "/ Hopefully, this is correct ... |
4435 |
4435 |
4436 code isNumber ifTrue:[ |
4436 code isNumber ifTrue:[ |
4437 code >= $A asciiValue ifTrue:[ |
4437 code >= $A asciiValue ifTrue:[ |
4438 code <= $Z asciiValue ifTrue:[ |
4438 code <= $Z asciiValue ifTrue:[ |
4439 state := self shiftModifierMask |
4439 state := self shiftModifierMask |
4440 ] |
4440 ] |
4441 ] |
4441 ] |
4442 ]. |
4442 ]. |
4443 |
4443 |
4444 self sendKeyOrButtonEvent:#keyPress x:0 y:0 keyOrButton:code state:state toViewId:viewId. |
4444 self sendKeyOrButtonEvent:#keyPress x:0 y:0 keyOrButton:code state:state toViewId:viewId. |
4445 self sendKeyOrButtonEvent:#keyRelease x:0 y:0 keyOrButton:code state:state toViewId:viewId |
4445 self sendKeyOrButtonEvent:#keyRelease x:0 y:0 keyOrButton:code state:state toViewId:viewId |
4446 |
4446 |
4533 |
4533 |
4534 ^ (fonts collect:[:descr | descr face]) asSortedCollection |
4534 ^ (fonts collect:[:descr | descr face]) asSortedCollection |
4535 |
4535 |
4536 " |
4536 " |
4537 Display facesInFamily:'fixed' filtering:[:f | |
4537 Display facesInFamily:'fixed' filtering:[:f | |
4538 f encoding notNil and:[f encoding startsWith:'jis']] |
4538 f encoding notNil and:[f encoding startsWith:'jis']] |
4539 " |
4539 " |
4540 |
4540 |
4541 "Created: 27.2.1996 / 01:33:25 / cg" |
4541 "Created: 27.2.1996 / 01:33:25 / cg" |
4542 "Modified: 29.2.1996 / 04:29:01 / cg" |
4542 "Modified: 29.2.1996 / 04:29:01 / cg" |
4543 ! |
4543 ! |
4575 |
4575 |
4576 ^ (fonts collect:[:descr | descr family]) asSortedCollection |
4576 ^ (fonts collect:[:descr | descr family]) asSortedCollection |
4577 |
4577 |
4578 " |
4578 " |
4579 Display fontFamiliesFiltering:[:f | |
4579 Display fontFamiliesFiltering:[:f | |
4580 f encoding notNil and:[f encoding startsWith:'jis']] |
4580 f encoding notNil and:[f encoding startsWith:'jis']] |
4581 " |
4581 " |
4582 |
4582 |
4583 "Modified: 29.2.1996 / 04:31:51 / cg" |
4583 "Modified: 29.2.1996 / 04:31:51 / cg" |
4584 ! |
4584 ! |
4585 |
4585 |
4596 maxDescent := self maxDescentOf:fontId. |
4596 maxDescent := self maxDescentOf:fontId. |
4597 minWidth := self minWidthOfFont:fontId. |
4597 minWidth := self minWidthOfFont:fontId. |
4598 maxWidth := self maxWidthOfFont:fontId. |
4598 maxWidth := self maxWidthOfFont:fontId. |
4599 avgWidth := self widthOf:' ' inFont:fontId. |
4599 avgWidth := self widthOf:' ' inFont:fontId. |
4600 aBlock value:encoding |
4600 aBlock value:encoding |
4601 value:avgAscent |
4601 value:avgAscent |
4602 value:avgDescent |
4602 value:avgDescent |
4603 value:maxAscent |
4603 value:maxAscent |
4604 value:maxDescent |
4604 value:maxDescent |
4605 value:minWidth |
4605 value:minWidth |
4606 value:maxWidth |
4606 value:maxWidth |
4607 value:avgWidth |
4607 value:avgWidth |
4608 ! |
4608 ! |
4609 |
4609 |
4610 fontResolutionOf:fontId |
4610 fontResolutionOf:fontId |
4611 "return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution, |
4611 "return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution, |
4612 but due to errors in some XServer installations, some use 75dpi fonts on higher |
4612 but due to errors in some XServer installations, some use 75dpi fonts on higher |
4624 allFonts := self listOfAvailableFonts. |
4624 allFonts := self listOfAvailableFonts. |
4625 allFonts isNil ifTrue:[^ nil]. |
4625 allFonts isNil ifTrue:[^ nil]. |
4626 |
4626 |
4627 fonts := Set new. |
4627 fonts := Set new. |
4628 allFonts do:[:fntDescr | |
4628 allFonts do:[:fntDescr | |
4629 (aFilterBlock isNil or:[aFilterBlock value:fntDescr]) ifTrue:[ |
4629 (aFilterBlock isNil or:[aFilterBlock value:fntDescr]) ifTrue:[ |
4630 fntDescr family notNil ifTrue:[ |
4630 fntDescr family notNil ifTrue:[ |
4631 fonts add:fntDescr |
4631 fonts add:fntDescr |
4632 ] |
4632 ] |
4633 ] |
4633 ] |
4634 ]. |
4634 ]. |
4635 ^ fonts |
4635 ^ fonts |
4636 |
4636 |
4637 " |
4637 " |
4638 Display fontsFiltering:[:f | |
4638 Display fontsFiltering:[:f | |
4639 f encoding notNil and:[f encoding startsWith:'jis']] |
4639 f encoding notNil and:[f encoding startsWith:'jis']] |
4640 " |
4640 " |
4641 |
4641 |
4642 "Modified: 29.2.1996 / 04:30:35 / cg" |
4642 "Modified: 29.2.1996 / 04:30:35 / cg" |
4643 ! |
4643 ! |
4644 |
4644 |
4651 allFonts := self listOfAvailableFonts. |
4651 allFonts := self listOfAvailableFonts. |
4652 allFonts isNil ifTrue:[^ nil]. |
4652 allFonts isNil ifTrue:[^ nil]. |
4653 |
4653 |
4654 fonts := Set new. |
4654 fonts := Set new. |
4655 allFonts do:[:fntDescr | |
4655 allFonts do:[:fntDescr | |
4656 (aFamilyName match:fntDescr family) ifTrue:[ |
4656 (aFamilyName match:fntDescr family) ifTrue:[ |
4657 (aFaceName match:fntDescr face) ifTrue:[ |
4657 (aFaceName match:fntDescr face) ifTrue:[ |
4658 (filter isNil or:[filter value:fntDescr]) ifTrue:[ |
4658 (filter isNil or:[filter value:fntDescr]) ifTrue:[ |
4659 fonts add:fntDescr |
4659 fonts add:fntDescr |
4660 ] |
4660 ] |
4661 ] |
4661 ] |
4662 ] |
4662 ] |
4663 ]. |
4663 ]. |
4664 ^ fonts |
4664 ^ fonts |
4665 |
4665 |
4666 " |
4666 " |
4667 Display fontsInFamily:'fixed' face:'medium' filtering:[:f | |
4667 Display fontsInFamily:'fixed' face:'medium' filtering:[:f | |
4668 f encoding notNil and:[f encoding startsWith:'jis']] |
4668 f encoding notNil and:[f encoding startsWith:'jis']] |
4669 " |
4669 " |
4670 |
4670 |
4671 "Created: 29.2.1996 / 04:32:56 / cg" |
4671 "Created: 29.2.1996 / 04:32:56 / cg" |
4672 "Modified: 30.6.1997 / 11:07:21 / cg" |
4672 "Modified: 30.6.1997 / 11:07:21 / cg" |
4673 ! |
4673 ! |
4682 allFonts := self listOfAvailableFonts. |
4682 allFonts := self listOfAvailableFonts. |
4683 allFonts isNil ifTrue:[^ nil]. |
4683 allFonts isNil ifTrue:[^ nil]. |
4684 |
4684 |
4685 fonts := Set new. |
4685 fonts := Set new. |
4686 allFonts do:[:fntDescr | |
4686 allFonts do:[:fntDescr | |
4687 (aFamilyName match:fntDescr family) ifTrue:[ |
4687 (aFamilyName match:fntDescr family) ifTrue:[ |
4688 (aFaceName match:fntDescr face) ifTrue:[ |
4688 (aFaceName match:fntDescr face) ifTrue:[ |
4689 (aStyleName match:fntDescr style) ifTrue:[ |
4689 (aStyleName match:fntDescr style) ifTrue:[ |
4690 (filter isNil or:[filter value:fntDescr]) ifTrue:[ |
4690 (filter isNil or:[filter value:fntDescr]) ifTrue:[ |
4691 fonts add:fntDescr |
4691 fonts add:fntDescr |
4692 ] |
4692 ] |
4693 ] |
4693 ] |
4694 ] |
4694 ] |
4695 ] |
4695 ] |
4696 ]. |
4696 ]. |
4697 ^ fonts |
4697 ^ fonts |
4698 |
4698 |
4699 " |
4699 " |
4700 Display fontsInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
4700 Display fontsInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
4701 f encoding notNil and:[f encoding startsWith:'jis']] |
4701 f encoding notNil and:[f encoding startsWith:'jis']] |
4702 " |
4702 " |
4703 " |
4703 " |
4704 Display fontsInFamily:'fixed' face:'*' style:'roman' filtering:[:f | |
4704 Display fontsInFamily:'fixed' face:'*' style:'roman' filtering:[:f | |
4705 f encoding notNil and:[f encoding startsWith:'jis']] |
4705 f encoding notNil and:[f encoding startsWith:'jis']] |
4706 " |
4706 " |
4707 |
4707 |
4708 "Created: 29.2.1996 / 04:25:30 / cg" |
4708 "Created: 29.2.1996 / 04:25:30 / cg" |
4709 "Modified: 30.6.1997 / 11:07:08 / cg" |
4709 "Modified: 30.6.1997 / 11:07:08 / cg" |
4710 ! |
4710 ! |
4718 allFonts := self listOfAvailableFonts. |
4718 allFonts := self listOfAvailableFonts. |
4719 allFonts isNil ifTrue:[^ nil]. |
4719 allFonts isNil ifTrue:[^ nil]. |
4720 |
4720 |
4721 fonts := Set new. |
4721 fonts := Set new. |
4722 allFonts do:[:fntDescr | |
4722 allFonts do:[:fntDescr | |
4723 (aFamilyName match:fntDescr family) ifTrue:[ |
4723 (aFamilyName match:fntDescr family) ifTrue:[ |
4724 (filterBlock isNil or:[filterBlock value:fntDescr]) ifTrue:[ |
4724 (filterBlock isNil or:[filterBlock value:fntDescr]) ifTrue:[ |
4725 fonts add:fntDescr |
4725 fonts add:fntDescr |
4726 ] |
4726 ] |
4727 ] |
4727 ] |
4728 ]. |
4728 ]. |
4729 ^ fonts |
4729 ^ fonts |
4730 |
4730 |
4731 " |
4731 " |
4732 Display fontsInFamily:'fixed' filtering:[:f | |
4732 Display fontsInFamily:'fixed' filtering:[:f | |
4733 f encoding notNil and:[f encoding startsWith:'jis']] |
4733 f encoding notNil and:[f encoding startsWith:'jis']] |
4734 " |
4734 " |
4735 " |
4735 " |
4736 Display fontsInFamily:'*' filtering:[:f | |
4736 Display fontsInFamily:'*' filtering:[:f | |
4737 f encoding notNil and:[f encoding startsWith:'jis']] |
4737 f encoding notNil and:[f encoding startsWith:'jis']] |
4738 " |
4738 " |
4739 |
4739 |
4740 "Created: 29.2.1996 / 04:27:49 / cg" |
4740 "Created: 29.2.1996 / 04:27:49 / cg" |
4741 "Modified: 30.6.1997 / 11:06:36 / cg" |
4741 "Modified: 30.6.1997 / 11:06:36 / cg" |
4742 ! |
4742 ! |
4805 |
4805 |
4806 ^ fonts collect:[:descr | descr size]. |
4806 ^ fonts collect:[:descr | descr size]. |
4807 |
4807 |
4808 " |
4808 " |
4809 Display sizesInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
4809 Display sizesInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
4810 f encoding notNil and:[f encoding startsWith:'jis']] |
4810 f encoding notNil and:[f encoding startsWith:'jis']] |
4811 " |
4811 " |
4812 |
4812 |
4813 "Created: 27.2.1996 / 01:37:56 / cg" |
4813 "Created: 27.2.1996 / 01:37:56 / cg" |
4814 "Modified: 29.2.1996 / 04:26:52 / cg" |
4814 "Modified: 29.2.1996 / 04:26:52 / cg" |
4815 ! |
4815 ! |
4838 |
4838 |
4839 ^ (fonts collect:[:descr | descr style]) asSortedCollection |
4839 ^ (fonts collect:[:descr | descr style]) asSortedCollection |
4840 |
4840 |
4841 " |
4841 " |
4842 Display stylesInFamily:'fixed' face:'medium' filtering:[:f | |
4842 Display stylesInFamily:'fixed' face:'medium' filtering:[:f | |
4843 f encoding notNil and:[f encoding startsWith:'jis']] |
4843 f encoding notNil and:[f encoding startsWith:'jis']] |
4844 " |
4844 " |
4845 |
4845 |
4846 "Created: 27.2.1996 / 01:35:22 / cg" |
4846 "Created: 27.2.1996 / 01:35:22 / cg" |
4847 "Modified: 29.2.1996 / 04:33:59 / cg" |
4847 "Modified: 29.2.1996 / 04:33:59 / cg" |
4848 ! |
4848 ! |
4885 grabKeyboardInView:aView |
4885 grabKeyboardInView:aView |
4886 "grab the keyboard - all keyboard input will be sent to aView. |
4886 "grab the keyboard - all keyboard input will be sent to aView. |
4887 Return true if ok, false if it failed for some reason." |
4887 Return true if ok, false if it failed for some reason." |
4888 |
4888 |
4889 activeKeyboardGrab notNil ifTrue:[ |
4889 activeKeyboardGrab notNil ifTrue:[ |
4890 self ungrabKeyboard. |
4890 self ungrabKeyboard. |
4891 activeKeyboardGrab := nil |
4891 activeKeyboardGrab := nil |
4892 ]. |
4892 ]. |
4893 (self grabKeyboardIn:(aView id)) ifTrue:[ |
4893 (self grabKeyboardIn:(aView id)) ifTrue:[ |
4894 activeKeyboardGrab := aView. |
4894 activeKeyboardGrab := aView. |
4895 ^ true |
4895 ^ true |
4896 ]. |
4896 ]. |
4897 ^ false |
4897 ^ false |
4898 ! |
4898 ! |
4899 |
4899 |
4900 grabPointerIn:aWindowId |
4900 grabPointerIn:aWindowId |
4922 grabPointerInView:aView |
4922 grabPointerInView:aView |
4923 "grap the pointer; all pointer events will be reported to |
4923 "grap the pointer; all pointer events will be reported to |
4924 aView. Return true if ok, false if it failed for some reason." |
4924 aView. Return true if ok, false if it failed for some reason." |
4925 |
4925 |
4926 activePointerGrab notNil ifTrue:[ |
4926 activePointerGrab notNil ifTrue:[ |
4927 self ungrabPointer. |
4927 self ungrabPointer. |
4928 activePointerGrab := nil |
4928 activePointerGrab := nil |
4929 ]. |
4929 ]. |
4930 (self grabPointerIn:(aView id)) ifTrue:[ |
4930 (self grabPointerIn:(aView id)) ifTrue:[ |
4931 activePointerGrab := aView. |
4931 activePointerGrab := aView. |
4932 ^ true |
4932 ^ true |
4933 ]. |
4933 ]. |
4934 ^ false |
4934 ^ false |
4935 ! |
4935 ! |
4936 |
4936 |
4937 grabPointerInView:aView withCursor:aCursor |
4937 grabPointerInView:aView withCursor:aCursor |
4939 aView. Return true if ok, false if it failed for some reason." |
4939 aView. Return true if ok, false if it failed for some reason." |
4940 |
4940 |
4941 |cId| |
4941 |cId| |
4942 |
4942 |
4943 activePointerGrab notNil ifTrue:[ |
4943 activePointerGrab notNil ifTrue:[ |
4944 self ungrabPointer. |
4944 self ungrabPointer. |
4945 activePointerGrab := nil |
4945 activePointerGrab := nil |
4946 ]. |
4946 ]. |
4947 aCursor notNil ifTrue:[ |
4947 aCursor notNil ifTrue:[ |
4948 cId := aCursor id. |
4948 cId := aCursor id. |
4949 ]. |
4949 ]. |
4950 (self grabPointerIn:(aView id) withCursorId:cId) ifTrue:[ |
4950 (self grabPointerIn:(aView id) withCursorId:cId) ifTrue:[ |
4951 activePointerGrab := aView. |
4951 activePointerGrab := aView. |
4952 ^ true |
4952 ^ true |
4953 ]. |
4953 ]. |
4954 ^ false |
4954 ^ false |
4955 ! |
4955 ! |
4956 |
4956 |
4957 setActivePointerGrab:aView |
4957 setActivePointerGrab:aView |
5070 dispatching := false. |
5070 dispatching := false. |
5071 self emergencyCloseConnection. |
5071 self emergencyCloseConnection. |
5072 displayId := nil. |
5072 displayId := nil. |
5073 |
5073 |
5074 LastActiveScreen == self ifTrue:[ |
5074 LastActiveScreen == self ifTrue:[ |
5075 LastActiveScreen := nil. |
5075 LastActiveScreen := nil. |
5076 LastActiveProcess := nil. |
5076 LastActiveProcess := nil. |
5077 ]. |
5077 ]. |
5078 |
5078 |
5079 "/ tell all of my views about this. |
5079 "/ tell all of my views about this. |
5080 "/ first, all topViews get a notification ... |
5080 "/ first, all topViews get a notification ... |
5081 |
5081 |
5082 self allViews do:[:aView | |
5082 self allViews do:[:aView | |
5083 |wg sensor| |
5083 |wg sensor| |
5084 |
5084 |
5085 aView isTopView ifTrue:[ |
5085 aView isTopView ifTrue:[ |
5086 "/ notice: we must manually wakeup the |
5086 "/ notice: we must manually wakeup the |
5087 "/ windowGroup process here (it might be waiting on |
5087 "/ windowGroup process here (it might be waiting on |
5088 "/ an event, and the destroy below is executed by |
5088 "/ an event, and the destroy below is executed by |
5089 "/ another thread. |
5089 "/ another thread. |
5090 "/ Otherwise, the windowGroup process would |
5090 "/ Otherwise, the windowGroup process would |
5091 "/ not terminate itself in this case. |
5091 "/ not terminate itself in this case. |
5092 (wg := aView windowGroup) notNil ifTrue:[ |
5092 (wg := aView windowGroup) notNil ifTrue:[ |
5093 sensor := wg sensor |
5093 sensor := wg sensor |
5094 ]. |
5094 ]. |
5095 aView destroyed. |
5095 aView destroyed. |
5096 sensor notNil ifTrue:[ |
5096 sensor notNil ifTrue:[ |
5097 sensor eventSemaphore signal. |
5097 sensor eventSemaphore signal. |
5098 ]. |
5098 ]. |
5099 ] |
5099 ] |
5100 ]. |
5100 ]. |
5101 |
5101 |
5102 self releaseDeviceResources. |
5102 self releaseDeviceResources. |
5103 |
5103 |
5104 "Modified: / 19.1.2000 / 10:36:02 / cg" |
5104 "Modified: / 19.1.2000 / 10:36:02 / cg" |
5134 exitOnLastClose:aBoolean |
5134 exitOnLastClose:aBoolean |
5135 "set/clear the flag which controls if the |
5135 "set/clear the flag which controls if the |
5136 event dispatching should stop when the last view is closed." |
5136 event dispatching should stop when the last view is closed." |
5137 |
5137 |
5138 self == Display ifTrue:[ |
5138 self == Display ifTrue:[ |
5139 ExitOnLastClose := aBoolean |
5139 ExitOnLastClose := aBoolean |
5140 ]. |
5140 ]. |
5141 exitOnLastClose := aBoolean |
5141 exitOnLastClose := aBoolean |
5142 |
5142 |
5143 "Modified: 23.4.1996 / 22:01:28 / cg" |
5143 "Modified: 23.4.1996 / 22:01:28 / cg" |
5144 ! |
5144 ! |
5145 |
5145 |
5146 initialize |
5146 initialize |
5147 "initialize the receiver for a connection to the default display" |
5147 "initialize the receiver for a connection to the default display" |
5148 |
5148 |
5149 idToTableIndexMapping notNil ifTrue:[ |
5149 idToTableIndexMapping notNil ifTrue:[ |
5150 "/ assume, I am already initialized ... |
5150 "/ assume, I am already initialized ... |
5151 ^ self. |
5151 ^ self. |
5152 ]. |
5152 ]. |
5153 |
5153 |
5154 idToTableIndexMapping := Dictionary new:100. |
5154 idToTableIndexMapping := Dictionary new:100. |
5155 |
5155 |
5156 ^ self initializeFor:nil |
5156 ^ self initializeFor:nil |
5176 |
5176 |
5177 initializeDeviceResources |
5177 initializeDeviceResources |
5178 "initialize heavily used device resources - to avoid looking them up later" |
5178 "initialize heavily used device resources - to avoid looking them up later" |
5179 |
5179 |
5180 blackColor isNil ifTrue:[ |
5180 blackColor isNil ifTrue:[ |
5181 blackColor := Color black onDevice:self. |
5181 blackColor := Color black onDevice:self. |
5182 whiteColor := Color white onDevice:self. |
5182 whiteColor := Color white onDevice:self. |
5183 Color getPrimaryColorsOn:self. |
5183 Color getPrimaryColorsOn:self. |
5184 ] |
5184 ] |
5185 |
5185 |
5186 "Modified: 24.2.1997 / 22:07:50 / cg" |
5186 "Modified: 24.2.1997 / 22:07:50 / cg" |
5187 ! |
5187 ! |
5188 |
5188 |
5211 Here, an empty (no-translation) keyboard map is setup initially; |
5211 Here, an empty (no-translation) keyboard map is setup initially; |
5212 this is usually filled via the keyboard.rc startup file. |
5212 this is usually filled via the keyboard.rc startup file. |
5213 " |
5213 " |
5214 |
5214 |
5215 keyboardMap isNil ifTrue:[ |
5215 keyboardMap isNil ifTrue:[ |
5216 keyboardMap := KeyboardMap new. |
5216 keyboardMap := KeyboardMap new. |
5217 ]. |
5217 ]. |
5218 |
5218 |
5219 " |
5219 " |
5220 no more setup here - moved everything out into 'display.rc' file |
5220 no more setup here - moved everything out into 'display.rc' file |
5221 " |
5221 " |
5234 |
5234 |
5235 initializeScreenProperties |
5235 initializeScreenProperties |
5236 "setup screen specific properties." |
5236 "setup screen specific properties." |
5237 |
5237 |
5238 supportsDeepIcons isNil ifTrue:[ |
5238 supportsDeepIcons isNil ifTrue:[ |
5239 supportsDeepIcons := false. |
5239 supportsDeepIcons := false. |
5240 ]. |
5240 ]. |
5241 |
5241 |
5242 fixColors := fixGrayColors := ditherColors := nil. |
5242 fixColors := fixGrayColors := ditherColors := nil. |
5243 numFixRed := numFixGreen := numFixBlue := 0. |
5243 numFixRed := numFixGreen := numFixBlue := 0. |
5244 |
5244 |
5247 |
5247 |
5248 initializeViewStyle |
5248 initializeViewStyle |
5249 "late viewStyle init - if no viewStyle has been read yet." |
5249 "late viewStyle init - if no viewStyle has been read yet." |
5250 |
5250 |
5251 View styleSheet isNil ifTrue:[ |
5251 View styleSheet isNil ifTrue:[ |
5252 CurrentScreenQuerySignal answer:self do:[ |
5252 CurrentScreenQuerySignal answer:self do:[ |
5253 View readStyleSheetAndUpdateAllStyleCaches |
5253 View readStyleSheetAndUpdateAllStyleCaches |
5254 ] |
5254 ] |
5255 ]. |
5255 ]. |
5256 ! |
5256 ! |
5257 |
5257 |
5258 invalidateConnection |
5258 invalidateConnection |
5259 "clear my connection handle - sent after an imageRestart to |
5259 "clear my connection handle - sent after an imageRestart to |
5268 "reinit after snapin" |
5268 "reinit after snapin" |
5269 |
5269 |
5270 |prevKnownViews prevMapping prevWidth prevHeight| |
5270 |prevKnownViews prevMapping prevWidth prevHeight| |
5271 |
5271 |
5272 blackColor notNil ifTrue:[ |
5272 blackColor notNil ifTrue:[ |
5273 blackColor releaseFromDevice. |
5273 blackColor releaseFromDevice. |
5274 ]. |
5274 ]. |
5275 whiteColor notNil ifTrue:[ |
5275 whiteColor notNil ifTrue:[ |
5276 whiteColor releaseFromDevice. |
5276 whiteColor releaseFromDevice. |
5277 ]. |
5277 ]. |
5278 self releaseDeviceFonts. |
5278 self releaseDeviceFonts. |
5279 self releaseDeviceCursors. |
5279 self releaseDeviceCursors. |
5280 self releaseDeviceColors. |
5280 self releaseDeviceColors. |
5281 Color flushDeviceColorsFor:self. |
5281 Color flushDeviceColorsFor:self. |
5297 lastId := nil. |
5297 lastId := nil. |
5298 lastView := nil. |
5298 lastView := nil. |
5299 |
5299 |
5300 self initializeFor:nil. |
5300 self initializeFor:nil. |
5301 displayId isNil ifTrue:[ |
5301 displayId isNil ifTrue:[ |
5302 'DevWorkstation [error]: could not connect to display' errorPrintCR. |
5302 'DevWorkstation [error]: could not connect to display' errorPrintCR. |
5303 Smalltalk exit. |
5303 Smalltalk exit. |
5304 ^ self |
5304 ^ self |
5305 ]. |
5305 ]. |
5306 |
5306 |
5307 " |
5307 " |
5308 first, all Forms must be recreated |
5308 first, all Forms must be recreated |
5309 (since they may be needed for view recreation as |
5309 (since they may be needed for view recreation as |
5311 " |
5311 " |
5312 Form reinitializeAllOn:self. |
5312 Form reinitializeAllOn:self. |
5313 |
5313 |
5314 "/ prevMapping notNil ifTrue:[ |
5314 "/ prevMapping notNil ifTrue:[ |
5315 prevKnownViews notNil ifTrue:[ |
5315 prevKnownViews notNil ifTrue:[ |
5316 " |
5316 " |
5317 first round: flush all device specific stuff |
5317 first round: flush all device specific stuff |
5318 " |
5318 " |
5319 "/ prevMapping keysAndValuesDo:[:anId :aView | |
5319 "/ prevMapping keysAndValuesDo:[:anId :aView | |
5320 prevKnownViews do:[:aView | |
5320 prevKnownViews do:[:aView | |
5321 (aView notNil and:[aView ~~ 0]) ifTrue:[ |
5321 (aView notNil and:[aView ~~ 0]) ifTrue:[ |
5322 aView prepareForReinit |
5322 aView prepareForReinit |
5323 ] |
5323 ] |
5324 ]. |
5324 ]. |
5325 |
5325 |
5326 " |
5326 " |
5327 2nd round: all views should reinstall themself |
5327 2nd round: all views should reinstall themself |
5328 on the new display |
5328 on the new display |
5329 " |
5329 " |
5330 "/ prevMapping keysAndValuesDo:[:anId :aView | |
5330 "/ prevMapping keysAndValuesDo:[:anId :aView | |
5331 |
5331 |
5332 prevKnownViews do:[:aView | |
5332 prevKnownViews do:[:aView | |
5333 (aView notNil and:[aView ~~ 0]) ifTrue:[ |
5333 (aView notNil and:[aView ~~ 0]) ifTrue:[ |
5334 "have to re-create the view" |
5334 "have to re-create the view" |
5335 UserInterruptSignal catch:[ |
5335 UserInterruptSignal catch:[ |
5336 AbortSignal catch:[ |
5336 AbortSignal catch:[ |
5337 GraphicsContext drawingOnClosedDrawableSignal handle:[:ex | |
5337 GraphicsContext drawingOnClosedDrawableSignal handle:[:ex | |
5338 'DeviceWorkstation [warning]: drawing attempt on closed drawable during reinit' errorPrintCR. |
5338 'DeviceWorkstation [warning]: drawing attempt on closed drawable during reinit' errorPrintCR. |
5339 ex return |
5339 ex return |
5340 ] do:[ |
5340 ] do:[ |
5341 aView reinitialize |
5341 aView reinitialize |
5342 ] |
5342 ] |
5343 ] |
5343 ] |
5344 ] |
5344 ] |
5345 ] |
5345 ] |
5346 ]. |
5346 ]. |
5347 |
5347 |
5348 (prevWidth ~~ width |
5348 (prevWidth ~~ width |
5349 or:[prevHeight ~~ height]) ifTrue:[ |
5349 or:[prevHeight ~~ height]) ifTrue:[ |
5350 " |
5350 " |
5351 3rd round: all views get a chance to handle |
5351 3rd round: all views get a chance to handle |
5352 changed environment (colors, font sizes etc) |
5352 changed environment (colors, font sizes etc) |
5353 " |
5353 " |
5354 "/ prevMapping keysAndValuesDo:[:anId :aView | |
5354 "/ prevMapping keysAndValuesDo:[:anId :aView | |
5355 prevKnownViews do:[:aView | |
5355 prevKnownViews do:[:aView | |
5356 (aView notNil and:[aView ~~ 0]) ifTrue:[ |
5356 (aView notNil and:[aView ~~ 0]) ifTrue:[ |
5357 aView reAdjustGeometry |
5357 aView reAdjustGeometry |
5358 ] |
5358 ] |
5359 ]. |
5359 ]. |
5360 ] |
5360 ] |
5361 ]. |
5361 ]. |
5362 dispatching := false. |
5362 dispatching := false. |
5363 |
5363 |
5364 "Modified: / 7.6.1998 / 02:45:13 / cg" |
5364 "Modified: / 7.6.1998 / 02:45:13 / cg" |
5365 ! |
5365 ! |
5368 "release any cached device resources. |
5368 "release any cached device resources. |
5369 This is invoked when closed or when the display connection is broken |
5369 This is invoked when closed or when the display connection is broken |
5370 (i.e. be prepared to not be able to release resources regularily)" |
5370 (i.e. be prepared to not be able to release resources regularily)" |
5371 |
5371 |
5372 blackColor notNil ifTrue:[ |
5372 blackColor notNil ifTrue:[ |
5373 blackColor releaseFromDevice. |
5373 blackColor releaseFromDevice. |
5374 ]. |
5374 ]. |
5375 whiteColor notNil ifTrue:[ |
5375 whiteColor notNil ifTrue:[ |
5376 whiteColor releaseFromDevice. |
5376 whiteColor releaseFromDevice. |
5377 ]. |
5377 ]. |
5378 |
5378 |
5379 LastActiveScreen == self ifTrue:[ |
5379 LastActiveScreen == self ifTrue:[ |
5380 LastActiveScreen := nil. |
5380 LastActiveScreen := nil. |
5381 LastActiveProcess := nil. |
5381 LastActiveProcess := nil. |
5382 ]. |
5382 ]. |
5383 |
5383 |
5384 blackColor := whiteColor := nil. |
5384 blackColor := whiteColor := nil. |
5385 |
5385 |
5386 Image releaseResourcesOnDevice:self. |
5386 Image releaseResourcesOnDevice:self. |
5441 |
5441 |
5442 root clippedByChildren:false. |
5442 root clippedByChildren:false. |
5443 root foreground:blackColor background:whiteColor. |
5443 root foreground:blackColor background:whiteColor. |
5444 |
5444 |
5445 root xoring:[ |
5445 root xoring:[ |
5446 |left right top bottom newOrigin newCorner p| |
5446 |left right top bottom newOrigin newCorner p| |
5447 |
5447 |
5448 rect := origin extent:extent. |
5448 rect := origin extent:extent. |
5449 root displayRectangle:rect. |
5449 root displayRectangle:rect. |
5450 |
5450 |
5451 prevGrab := activePointerGrab. |
5451 prevGrab := activePointerGrab. |
5452 self grabPointerInView:root withCursor:curs. |
5452 self grabPointerInView:root withCursor:curs. |
5453 |
5453 |
5454 [self leftButtonPressed] whileTrue:[ |
5454 [self leftButtonPressed] whileTrue:[ |
5455 newOrigin := self pointerPosition. |
5455 newOrigin := self pointerPosition. |
5456 |
5456 |
5457 (newOrigin ~= origin) ifTrue:[ |
5457 (newOrigin ~= origin) ifTrue:[ |
5458 root displayRectangle:rect. |
5458 root displayRectangle:rect. |
5459 |
5459 |
5460 self |
5460 self |
5461 grabPointerIn:root id |
5461 grabPointerIn:root id |
5462 withCursor:curs id |
5462 withCursor:curs id |
5463 pointerMode:#async |
5463 pointerMode:#async |
5464 keyboardMode:#sync |
5464 keyboardMode:#sync |
5465 confineTo:nil. |
5465 confineTo:nil. |
5466 |
5466 |
5467 rect := newOrigin extent:extent. |
5467 rect := newOrigin extent:extent. |
5468 root displayRectangle:rect. |
5468 root displayRectangle:rect. |
5469 self disposeButtonEventsFor:nil. |
5469 self disposeButtonEventsFor:nil. |
5470 self flush. |
5470 self flush. |
5471 origin := newOrigin. |
5471 origin := newOrigin. |
5472 ] ifFalse:[ |
5472 ] ifFalse:[ |
5473 Delay waitForSeconds:0.05 |
5473 Delay waitForSeconds:0.05 |
5474 ] |
5474 ] |
5475 ]. |
5475 ]. |
5476 root displayRectangle:rect. |
5476 root displayRectangle:rect. |
5477 ]. |
5477 ]. |
5478 |
5478 |
5479 self ungrabPointer. |
5479 self ungrabPointer. |
5480 prevGrab notNil ifTrue:[ |
5480 prevGrab notNil ifTrue:[ |
5481 self grabPointerInView:prevGrab. |
5481 self grabPointerInView:prevGrab. |
5482 ]. |
5482 ]. |
5483 |
5483 |
5484 "flush all events pending on my display" |
5484 "flush all events pending on my display" |
5485 |
5485 |
5486 root clippedByChildren:true. |
5486 root clippedByChildren:true. |
5529 |
5529 |
5530 p := self pointerPosition. |
5530 p := self pointerPosition. |
5531 |
5531 |
5532 self ungrabPointer. |
5532 self ungrabPointer. |
5533 prevGrab notNil ifTrue:[ |
5533 prevGrab notNil ifTrue:[ |
5534 self grabPointerInView:prevGrab |
5534 self grabPointerInView:prevGrab |
5535 ]. |
5535 ]. |
5536 |
5536 |
5537 "flush all events pending on myself" |
5537 "flush all events pending on myself" |
5538 self disposeButtonEventsFor:nil. |
5538 self disposeButtonEventsFor:nil. |
5539 ^ p |
5539 ^ p |
5601 "/ events being sent to applications under the mouse. |
5601 "/ events being sent to applications under the mouse. |
5602 "/ on windows displays. |
5602 "/ on windows displays. |
5603 doRegrab := self class ~~ WinWorkstation. |
5603 doRegrab := self class ~~ WinWorkstation. |
5604 |
5604 |
5605 keepExtent ifTrue:[ |
5605 keepExtent ifTrue:[ |
5606 curs1 := Cursor origin |
5606 curs1 := Cursor origin |
5607 ] ifFalse:[ |
5607 ] ifFalse:[ |
5608 curs1 := Cursor corner |
5608 curs1 := Cursor corner |
5609 ]. |
5609 ]. |
5610 curs1 := curs1 onDevice:self. |
5610 curs1 := curs1 onDevice:self. |
5611 root := self rootView. |
5611 root := self rootView. |
5612 |
5612 |
5613 " |
5613 " |
5617 |
5617 |
5618 root clippedByChildren:false. |
5618 root clippedByChildren:false. |
5619 root foreground:blackColor background:whiteColor. |
5619 root foreground:blackColor background:whiteColor. |
5620 |
5620 |
5621 root xoring:[ |
5621 root xoring:[ |
5622 |left right top bottom newOrigin newCorner p curs| |
5622 |left right top bottom newOrigin newCorner p curs| |
5623 |
5623 |
5624 keepExtent ifFalse:[ |
5624 keepExtent ifFalse:[ |
5625 corner := origin. |
5625 corner := origin. |
5626 rect := origin corner:corner. |
5626 rect := origin corner:corner. |
5627 root displayRectangle:rect. |
5627 root displayRectangle:rect. |
5628 ]. |
5628 ]. |
5629 |
5629 |
5630 prevGrab := activePointerGrab. |
5630 prevGrab := activePointerGrab. |
5631 self grabPointerInView:root withCursor:curs1. |
5631 self grabPointerInView:root withCursor:curs1. |
5632 |
5632 |
5633 " |
5633 " |
5634 just in case; wait for button to be down ... |
5634 just in case; wait for button to be down ... |
5635 " |
5635 " |
5636 [self leftButtonPressed] whileFalse:[Delay waitForSeconds:0.05]. |
5636 [self leftButtonPressed] whileFalse:[Delay waitForSeconds:0.05]. |
5637 |
5637 |
5638 keepExtent ifTrue:[ |
5638 keepExtent ifTrue:[ |
5639 p := self pointerPosition. |
5639 p := self pointerPosition. |
5640 origin := p. |
5640 origin := p. |
5641 corner := origin + initialRectangle extent. |
5641 corner := origin + initialRectangle extent. |
5642 rect := origin corner:corner. |
5642 rect := origin corner:corner. |
5643 root displayRectangle:rect. |
5643 root displayRectangle:rect. |
5644 ]. |
5644 ]. |
5645 |
5645 |
5646 [self leftButtonPressed] whileTrue:[ |
5646 [self leftButtonPressed] whileTrue:[ |
5647 left := initialRectangle origin x. |
5647 left := initialRectangle origin x. |
5648 top := initialRectangle origin y. |
5648 top := initialRectangle origin y. |
5649 right := initialRectangle corner x. |
5649 right := initialRectangle corner x. |
5650 bottom := initialRectangle corner y. |
5650 bottom := initialRectangle corner y. |
5651 |
5651 |
5652 p := self pointerPosition. |
5652 p := self pointerPosition. |
5653 keepExtent ifTrue:[ |
5653 keepExtent ifTrue:[ |
5654 newOrigin := p. |
5654 newOrigin := p. |
5655 newCorner := newOrigin + initialRectangle extent. |
5655 newCorner := newOrigin + initialRectangle extent. |
5656 curs := curs1. |
5656 curs := curs1. |
5657 ] ifFalse:[ |
5657 ] ifFalse:[ |
5658 p x < initialRectangle left ifTrue:[ |
5658 p x < initialRectangle left ifTrue:[ |
5659 p y < initialRectangle top ifTrue:[ |
5659 p y < initialRectangle top ifTrue:[ |
5660 curs := Cursor topLeft. |
5660 curs := Cursor topLeft. |
5661 left := p x. |
5661 left := p x. |
5662 top := p y. |
5662 top := p y. |
5663 ] ifFalse:[ |
5663 ] ifFalse:[ |
5664 curs := Cursor bottomLeft. |
5664 curs := Cursor bottomLeft. |
5665 left := p x. |
5665 left := p x. |
5666 bottom := p y |
5666 bottom := p y |
5667 ] |
5667 ] |
5668 ] ifFalse:[ |
5668 ] ifFalse:[ |
5669 p y < initialRectangle top ifTrue:[ |
5669 p y < initialRectangle top ifTrue:[ |
5670 curs := Cursor topRight. |
5670 curs := Cursor topRight. |
5671 right := p x. |
5671 right := p x. |
5672 top := p y |
5672 top := p y |
5673 ] ifFalse:[ |
5673 ] ifFalse:[ |
5674 curs := Cursor bottomRight. |
5674 curs := Cursor bottomRight. |
5675 right := p x. |
5675 right := p x. |
5676 bottom := p y |
5676 bottom := p y |
5677 ] |
5677 ] |
5678 ]. |
5678 ]. |
5679 |
5679 |
5680 newOrigin := left @ top. |
5680 newOrigin := left @ top. |
5681 newCorner := right @ bottom. |
5681 newCorner := right @ bottom. |
5682 ]. |
5682 ]. |
5683 |
5683 |
5684 ((newOrigin ~= origin) or:[newCorner ~= corner]) ifTrue:[ |
5684 ((newOrigin ~= origin) or:[newCorner ~= corner]) ifTrue:[ |
5685 root displayRectangle:rect. |
5685 root displayRectangle:rect. |
5686 doRegrab ifTrue:[ |
5686 doRegrab ifTrue:[ |
5687 self grabPointerInView:root withCursor:curs1. |
5687 self grabPointerInView:root withCursor:curs1. |
5688 ]. |
5688 ]. |
5689 |
5689 |
5690 origin := newOrigin. |
5690 origin := newOrigin. |
5691 corner := newCorner. |
5691 corner := newCorner. |
5692 rect := origin corner:corner. |
5692 rect := origin corner:corner. |
5693 root displayRectangle:rect. |
5693 root displayRectangle:rect. |
5694 self disposeButtonEventsFor:nil. |
5694 self disposeButtonEventsFor:nil. |
5695 self flush. |
5695 self flush. |
5696 ] ifFalse:[ |
5696 ] ifFalse:[ |
5697 Delay waitForSeconds:0.05 |
5697 Delay waitForSeconds:0.05 |
5698 ] |
5698 ] |
5699 ]. |
5699 ]. |
5700 root displayRectangle:rect. |
5700 root displayRectangle:rect. |
5701 ]. |
5701 ]. |
5702 |
5702 |
5703 |
5703 |
5704 self ungrabPointer. |
5704 self ungrabPointer. |
5705 prevGrab notNil ifTrue:[ |
5705 prevGrab notNil ifTrue:[ |
5706 self grabPointerInView:prevGrab |
5706 self grabPointerInView:prevGrab |
5707 ]. |
5707 ]. |
5708 |
5708 |
5709 "flush all events pending on my display" |
5709 "flush all events pending on my display" |
5710 |
5710 |
5711 root clippedByChildren:true. |
5711 root clippedByChildren:true. |
5734 |
5734 |
5735 |v| |
5735 |v| |
5736 |
5736 |
5737 v := self viewFromUser. |
5737 v := self viewFromUser. |
5738 v notNil ifTrue:[ |
5738 v notNil ifTrue:[ |
5739 v := v topView |
5739 v := v topView |
5740 ]. |
5740 ]. |
5741 ^ v |
5741 ^ v |
5742 |
5742 |
5743 " |
5743 " |
5744 Display topviewFromUser |
5744 Display topviewFromUser |
5839 modifierKeyProcessing:key down:pressed |
5839 modifierKeyProcessing:key down:pressed |
5840 "internal, private method. |
5840 "internal, private method. |
5841 Called with every keyPress/keyRelease to update the xxxDown flags." |
5841 Called with every keyPress/keyRelease to update the xxxDown flags." |
5842 |
5842 |
5843 (altModifiers notNil and:[altModifiers includes:key]) ifTrue:[ |
5843 (altModifiers notNil and:[altModifiers includes:key]) ifTrue:[ |
5844 altDown := pressed |
5844 altDown := pressed |
5845 ] ifFalse:[ |
5845 ] ifFalse:[ |
5846 (metaModifiers notNil and:[metaModifiers includes:key]) ifTrue:[ |
5846 (metaModifiers notNil and:[metaModifiers includes:key]) ifTrue:[ |
5847 metaDown := pressed |
5847 metaDown := pressed |
5848 ] ifFalse:[ |
5848 ] ifFalse:[ |
5849 (shiftModifiers notNil and:[shiftModifiers includes:key]) ifTrue:[ |
5849 (shiftModifiers notNil and:[shiftModifiers includes:key]) ifTrue:[ |
5850 shiftDown := pressed |
5850 shiftDown := pressed |
5851 ] ifFalse:[ |
5851 ] ifFalse:[ |
5852 (ctrlModifiers notNil and:[ctrlModifiers includes:key]) ifTrue:[ |
5852 (ctrlModifiers notNil and:[ctrlModifiers includes:key]) ifTrue:[ |
5853 ctrlDown := pressed |
5853 ctrlDown := pressed |
5854 ] |
5854 ] |
5855 ] |
5855 ] |
5856 ] |
5856 ] |
5857 ] |
5857 ] |
5858 |
5858 |
5859 "Modified: 2.1.1996 / 15:00:25 / cg" |
5859 "Modified: 2.1.1996 / 15:00:25 / cg" |
5860 ! |
5860 ! |
5861 |
5861 |
5864 (i.e. to get the keyTop from a modifier)" |
5864 (i.e. to get the keyTop from a modifier)" |
5865 |
5865 |
5866 |t modifiers| |
5866 |t modifiers| |
5867 |
5867 |
5868 key == #Alt ifTrue:[ |
5868 key == #Alt ifTrue:[ |
5869 modifiers := altModifiers |
5869 modifiers := altModifiers |
5870 ] ifFalse:[ |
5870 ] ifFalse:[ |
5871 key == #Cmd ifTrue:[ |
5871 key == #Cmd ifTrue:[ |
5872 modifiers := metaModifiers |
5872 modifiers := metaModifiers |
5873 ] |
5873 ] |
5874 ]. |
5874 ]. |
5875 |
5875 |
5876 "/ temporary kludge ... |
5876 "/ temporary kludge ... |
5877 (modifiers size > 0) ifTrue:[ |
5877 (modifiers size > 0) ifTrue:[ |
5878 (modifiers includes:'Num_Lock') ifTrue:[ |
5878 (modifiers includes:'Num_Lock') ifTrue:[ |
5879 modifiers := modifiers copy. |
5879 modifiers := modifiers copy. |
5880 modifiers remove:'Num_Lock' |
5880 modifiers remove:'Num_Lock' |
5881 ] |
5881 ] |
5882 ]. |
5882 ]. |
5883 |
5883 |
5884 (modifiers size > 0) ifTrue:[ |
5884 (modifiers size > 0) ifTrue:[ |
5885 t := modifiers first. |
5885 t := modifiers first. |
5886 (t includes:$_) ifTrue:[ |
5886 (t includes:$_) ifTrue:[ |
5887 t := t copyTo:(t indexOf:$_)-1 |
5887 t := t copyTo:(t indexOf:$_)-1 |
5888 ]. |
5888 ]. |
5889 ^ t |
5889 ^ t |
5890 ]. |
5890 ]. |
5891 ^ key |
5891 ^ key |
5892 |
5892 |
5893 "Created: / 28.2.1996 / 17:07:08 / cg" |
5893 "Created: / 28.2.1996 / 17:07:08 / cg" |
5894 "Modified: / 7.2.1998 / 16:18:17 / cg" |
5894 "Modified: / 7.2.1998 / 16:18:17 / cg" |
5902 |
5902 |
5903 "/ the next statement will vanish .... |
5903 "/ the next statement will vanish .... |
5904 (untranslatedKey == #Control |
5904 (untranslatedKey == #Control |
5905 or:[untranslatedKey == #'Control_L' |
5905 or:[untranslatedKey == #'Control_L' |
5906 or:[untranslatedKey == #'Control_R']]) ifTrue:[ |
5906 or:[untranslatedKey == #'Control_R']]) ifTrue:[ |
5907 ^ #Ctrl |
5907 ^ #Ctrl |
5908 ]. |
5908 ]. |
5909 |
5909 |
5910 (untranslatedKey == #Ctrl |
5910 (untranslatedKey == #Ctrl |
5911 or:[untranslatedKey == #'Ctrl_L' |
5911 or:[untranslatedKey == #'Ctrl_L' |
5912 or:[untranslatedKey == #'Ctrl_R']]) ifTrue:[ |
5912 or:[untranslatedKey == #'Ctrl_R']]) ifTrue:[ |
5913 ^ #Ctrl |
5913 ^ #Ctrl |
5914 ]. |
5914 ]. |
5915 (untranslatedKey == #'Shift' |
5915 (untranslatedKey == #'Shift' |
5916 or:[untranslatedKey == #'Shift_L' |
5916 or:[untranslatedKey == #'Shift_L' |
5917 or:[untranslatedKey == #'Shift_R']]) ifTrue:[ |
5917 or:[untranslatedKey == #'Shift_R']]) ifTrue:[ |
5918 ^ #Shift |
5918 ^ #Shift |
5919 ]. |
5919 ]. |
5920 (untranslatedKey == #'Alt' |
5920 (untranslatedKey == #'Alt' |
5921 or:[untranslatedKey == #'Alt_L' |
5921 or:[untranslatedKey == #'Alt_L' |
5922 or:[untranslatedKey == #'Alt_R']]) ifTrue:[ |
5922 or:[untranslatedKey == #'Alt_R']]) ifTrue:[ |
5923 ^ #Alt |
5923 ^ #Alt |
5924 ]. |
5924 ]. |
5925 (untranslatedKey == #'Meta' |
5925 (untranslatedKey == #'Meta' |
5926 or:[untranslatedKey == #'Meta_L' |
5926 or:[untranslatedKey == #'Meta_L' |
5927 or:[untranslatedKey == #'Meta_R']]) ifTrue:[ |
5927 or:[untranslatedKey == #'Meta_R']]) ifTrue:[ |
5928 ^ #Meta |
5928 ^ #Meta |
5929 ]. |
5929 ]. |
5930 (untranslatedKey == #'Cmd' |
5930 (untranslatedKey == #'Cmd' |
5931 or:[untranslatedKey == #'Cmd_L' |
5931 or:[untranslatedKey == #'Cmd_L' |
5932 or:[untranslatedKey == #'Cmd_R']]) ifTrue:[ |
5932 or:[untranslatedKey == #'Cmd_R']]) ifTrue:[ |
5933 ^ #Cmd |
5933 ^ #Cmd |
5934 ]. |
5934 ]. |
5935 ^ nil |
5935 ^ nil |
5936 |
5936 |
5937 "Created: 28.2.1996 / 16:40:46 / cg" |
5937 "Created: 28.2.1996 / 16:40:46 / cg" |
5938 "Modified: 28.2.1996 / 17:11:34 / cg" |
5938 "Modified: 28.2.1996 / 17:11:34 / cg" |
5995 |
5995 |
5996 "/ translate via keyboardMap |
5996 "/ translate via keyboardMap |
5997 |
5997 |
5998 xlatedKey := aView keyboardMap valueFor:xlatedKey. |
5998 xlatedKey := aView keyboardMap valueFor:xlatedKey. |
5999 xlatedKey isCharacter ifFalse:[ |
5999 xlatedKey isCharacter ifFalse:[ |
6000 xlatedKey := xlatedKey asSymbol |
6000 xlatedKey := xlatedKey asSymbol |
6001 ]. |
6001 ]. |
6002 ^ xlatedKey |
6002 ^ xlatedKey |
6003 |
6003 |
6004 "Modified: 28.2.1996 / 17:12:16 / cg" |
6004 "Modified: 28.2.1996 / 17:12:16 / cg" |
6005 ! ! |
6005 ! ! |
6083 "{ Pragma: +optSpace }" |
6083 "{ Pragma: +optSpace }" |
6084 |
6084 |
6085 "output an audible beep or bell" |
6085 "output an audible beep or bell" |
6086 |
6086 |
6087 UserPreferences current beepEnabled ifTrue:[ |
6087 UserPreferences current beepEnabled ifTrue:[ |
6088 Stdout nextPut:(Character bell) |
6088 Stdout nextPut:(Character bell) |
6089 ] |
6089 ] |
6090 |
6090 |
6091 "Modified: / 13.1.1997 / 22:56:13 / cg" |
6091 "Modified: / 13.1.1997 / 22:56:13 / cg" |
6092 "Modified: / 3.12.1999 / 17:13:52 / ps" |
6092 "Modified: / 3.12.1999 / 17:13:52 / ps" |
6093 ! |
6093 ! |
6155 bytesPerLineGiven == bytesPerLineWanted ifTrue:[^ givenBits]. |
6155 bytesPerLineGiven == bytesPerLineWanted ifTrue:[^ givenBits]. |
6156 |
6156 |
6157 newBits := ByteArray new:(bytesPerLineWanted * height). |
6157 newBits := ByteArray new:(bytesPerLineWanted * height). |
6158 srcIndex := dstIndex := 1. |
6158 srcIndex := dstIndex := 1. |
6159 1 to:height do:[:row | |
6159 1 to:height do:[:row | |
6160 newBits |
6160 newBits |
6161 replaceFrom:dstIndex |
6161 replaceFrom:dstIndex |
6162 to:(dstIndex + bytesPerLineWanted - 1) |
6162 to:(dstIndex + bytesPerLineWanted - 1) |
6163 with:givenBits |
6163 with:givenBits |
6164 startingAt:srcIndex. |
6164 startingAt:srcIndex. |
6165 dstIndex := dstIndex + bytesPerLineWanted. |
6165 dstIndex := dstIndex + bytesPerLineWanted. |
6166 srcIndex := srcIndex + bytesPerLineGiven. |
6166 srcIndex := srcIndex + bytesPerLineGiven. |
6167 ]. |
6167 ]. |
6168 ^ newBits. |
6168 ^ newBits. |
6169 |
6169 |
6170 ! |
6170 ! |
6171 |
6171 |
6396 |
6396 |
6397 super printOn:aStream. |
6397 super printOn:aStream. |
6398 |
6398 |
6399 aStream nextPut:$(. |
6399 aStream nextPut:$(. |
6400 (name := self displayName) isNil ifTrue:[ |
6400 (name := self displayName) isNil ifTrue:[ |
6401 name := 'defaultDisplay' |
6401 name := 'defaultDisplay' |
6402 ]. |
6402 ]. |
6403 aStream nextPutAll:name. |
6403 aStream nextPutAll:name. |
6404 aStream nextPut:$) |
6404 aStream nextPut:$) |
6405 ! ! |
6405 ! ! |
6406 |
6406 |
6424 info and the bits in imageBits. The info contains the depth, bitOrder and |
6424 info and the bits in imageBits. The info contains the depth, bitOrder and |
6425 number of bytes per scanline. The number of bytes per scanline is not known |
6425 number of bytes per scanline. The number of bytes per scanline is not known |
6426 in advance, since the X-server is free to return whatever it thinks is a good padding." |
6426 in advance, since the X-server is free to return whatever it thinks is a good padding." |
6427 |
6427 |
6428 ^ self |
6428 ^ self |
6429 getBitsFromId:aDrawableId |
6429 getBitsFromId:aDrawableId |
6430 x:srcx |
6430 x:srcx |
6431 y:srcy |
6431 y:srcy |
6432 width:w |
6432 width:w |
6433 height:h |
6433 height:h |
6434 into:imageBits |
6434 into:imageBits |
6435 |
6435 |
6436 "Created: 19.3.1997 / 13:43:04 / cg" |
6436 "Created: 19.3.1997 / 13:43:04 / cg" |
6437 "Modified: 19.3.1997 / 13:43:38 / cg" |
6437 "Modified: 19.3.1997 / 13:43:38 / cg" |
6438 ! |
6438 ! |
6439 |
6439 |
6443 info and the bits in imageBits. The info contains the depth, bitOrder and |
6443 info and the bits in imageBits. The info contains the depth, bitOrder and |
6444 number of bytes per scanline. The number of bytes per scanline is not known |
6444 number of bytes per scanline. The number of bytes per scanline is not known |
6445 in advance, since the X-server is free to return whatever it thinks is a good padding." |
6445 in advance, since the X-server is free to return whatever it thinks is a good padding." |
6446 |
6446 |
6447 ^ self |
6447 ^ self |
6448 getBitsFromId:aDrawableId |
6448 getBitsFromId:aDrawableId |
6449 x:srcx |
6449 x:srcx |
6450 y:srcy |
6450 y:srcy |
6451 width:w |
6451 width:w |
6452 height:h |
6452 height:h |
6453 into:imageBits |
6453 into:imageBits |
6454 |
6454 |
6455 "Created: 19.3.1997 / 13:43:04 / cg" |
6455 "Created: 19.3.1997 / 13:43:04 / cg" |
6456 "Modified: 19.3.1997 / 13:43:42 / cg" |
6456 "Modified: 19.3.1997 / 13:43:42 / cg" |
6457 ! |
6457 ! |
6458 |
6458 |
6544 |o s| |
6544 |o s| |
6545 |
6545 |
6546 o := self getCopyBuffer. |
6546 o := self getCopyBuffer. |
6547 s := o. |
6547 s := o. |
6548 o isString ifFalse:[ |
6548 o isString ifFalse:[ |
6549 o isNil ifTrue:[ |
6549 o isNil ifTrue:[ |
6550 s := '' |
6550 s := '' |
6551 ] ifFalse:[ |
6551 ] ifFalse:[ |
6552 (o isStringCollection) ifTrue:[ |
6552 (o isStringCollection) ifTrue:[ |
6553 s := o asStringWithCRsFrom:1 to:(o size) compressTabs:false withCR:false. |
6553 o := o collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]]. |
6554 s := s string. |
6554 s := o asStringWithCRsFrom:1 to:(o size) compressTabs:false withCR:false. |
6555 ] ifFalse:[ |
6555 s := s string. |
6556 Object recursiveStoreStringSignal handle:[:ex | |
6556 ] ifFalse:[ |
6557 s := '' |
6557 Object recursiveStoreStringSignal handle:[:ex | |
6558 ] do:[ |
6558 s := '' |
6559 s := o storeString |
6559 ] do:[ |
6560 ] |
6560 s := o storeString |
6561 ] |
6561 ] |
6562 ] |
6562 ] |
6563 ] |
|
6563 ]. |
6564 ]. |
6564 ^ s |
6565 ^ s |
6565 |
6566 |
6566 "Created: / 13.2.1997 / 13:10:30 / cg" |
6567 "Created: / 13.2.1997 / 13:10:30 / cg" |
6567 "Modified: / 20.1.1998 / 14:11:01 / stefan" |
6568 "Modified: / 20.1.1998 / 14:11:01 / stefan" |
6615 This allows for empty values in style sheets, and defaults |
6616 This allows for empty values in style sheets, and defaults |
6616 being provided by the display (which makes sense with Windows, |
6617 being provided by the display (which makes sense with Windows, |
6617 where the systemDefaults are used ..." |
6618 where the systemDefaults are used ..." |
6618 |
6619 |
6619 <resource: #style (#viewSpacing |
6620 <resource: #style (#viewSpacing |
6620 #borderColor #borderWidth |
6621 #borderColor #borderWidth |
6621 #viewBackgroundColor #shadowColor #lightColor |
6622 #viewBackgroundColor #shadowColor #lightColor |
6622 )> |
6623 )> |
6623 |
6624 |
6624 aKey == #viewSpacing ifTrue:[ |
6625 aKey == #viewSpacing ifTrue:[ |
6625 ^ self verticalPixelPerMillimeter rounded "/ 1 millimeter |
6626 ^ self verticalPixelPerMillimeter rounded "/ 1 millimeter |
6626 ]. |
6627 ]. |
6627 |
6628 |
6628 aKey == #borderColor ifTrue:[ |
6629 aKey == #borderColor ifTrue:[ |
6629 ^ Color black |
6630 ^ Color black |
6630 ]. |
6631 ]. |
6631 aKey == #borderWidth ifTrue:[ |
6632 aKey == #borderWidth ifTrue:[ |
6632 ^ 1 |
6633 ^ 1 |
6633 ]. |
6634 ]. |
6634 |
6635 |
6635 aKey == #shadowColor ifTrue:[ |
6636 aKey == #shadowColor ifTrue:[ |
6636 ^ Color black |
6637 ^ Color black |
6637 ]. |
6638 ]. |
6638 aKey == #lightColor ifTrue:[ |
6639 aKey == #lightColor ifTrue:[ |
6639 ^ Color white |
6640 ^ Color white |
6640 ]. |
6641 ]. |
6641 aKey == #viewBackgroundColor ifTrue:[ |
6642 aKey == #viewBackgroundColor ifTrue:[ |
6642 ^ Color white |
6643 ^ Color white |
6643 ]. |
6644 ]. |
6644 aKey == #scrollerViewBackgroundColor ifTrue:[ |
6645 aKey == #scrollerViewBackgroundColor ifTrue:[ |
6645 ^ Color white |
6646 ^ Color white |
6646 ]. |
6647 ]. |
6647 |
6648 |
6648 aKey == #textForegroundColor ifTrue:[ |
6649 aKey == #textForegroundColor ifTrue:[ |
6649 ^ Color black. |
6650 ^ Color black. |
6650 ]. |
6651 ]. |
6651 aKey == #textBackgroundColor ifTrue:[ |
6652 aKey == #textBackgroundColor ifTrue:[ |
6652 ^ Color white. |
6653 ^ Color white. |
6653 ]. |
6654 ]. |
6654 aKey == #selectionForegroundColor ifTrue:[ |
6655 aKey == #selectionForegroundColor ifTrue:[ |
6655 ^ Color white. |
6656 ^ Color white. |
6656 ]. |
6657 ]. |
6657 aKey == #selectionBackgroundColor ifTrue:[ |
6658 aKey == #selectionBackgroundColor ifTrue:[ |
6658 ^ Color black. |
6659 ^ Color black. |
6659 ]. |
6660 ]. |
6660 |
6661 |
6661 ^ nil. |
6662 ^ nil. |
6662 |
6663 |
6663 "Modified: 29.4.1997 / 11:16:57 / dq" |
6664 "Modified: 29.4.1997 / 11:16:57 / dq" |
6674 |freeIdx newArr sz newSize wasBlocked| |
6675 |freeIdx newArr sz newSize wasBlocked| |
6675 |
6676 |
6676 wasBlocked := OperatingSystem blockInterrupts. |
6677 wasBlocked := OperatingSystem blockInterrupts. |
6677 |
6678 |
6678 knownViews isNil ifTrue:[ |
6679 knownViews isNil ifTrue:[ |
6679 knownViews := WeakArray new:50. |
6680 knownViews := WeakArray new:50. |
6680 knownIds := Array new:50. |
6681 knownIds := Array new:50. |
6681 freeIdx := 1. |
6682 freeIdx := 1. |
6682 ] ifFalse:[ |
6683 ] ifFalse:[ |
6683 freeIdx := knownViews identityIndexOf:nil. |
6684 freeIdx := knownViews identityIndexOf:nil. |
6684 freeIdx == 0 ifTrue:[ |
6685 freeIdx == 0 ifTrue:[ |
6685 freeIdx := knownViews identityIndexOf:0. |
6686 freeIdx := knownViews identityIndexOf:0. |
6686 [freeIdx ~~ 0 |
6687 [freeIdx ~~ 0 |
6687 and:[(knownIds at:freeIdx) notNil]] whileTrue:[ |
6688 and:[(knownIds at:freeIdx) notNil]] whileTrue:[ |
6688 "/ mhmh - the view is already clear in the weakArray |
6689 "/ mhmh - the view is already clear in the weakArray |
6689 "/ but the id is not. |
6690 "/ but the id is not. |
6690 "/ (i.e. its collected, but not yet finalized) |
6691 "/ (i.e. its collected, but not yet finalized) |
6691 "/ skip this entry. |
6692 "/ skip this entry. |
6692 "/ 'XXX ' print. (knownIds at:freeIdx) displayString printCR. |
6693 "/ 'XXX ' print. (knownIds at:freeIdx) displayString printCR. |
6693 freeIdx := knownViews identityIndexOf:0 startingAt:(freeIdx + 1). |
6694 freeIdx := knownViews identityIndexOf:0 startingAt:(freeIdx + 1). |
6694 ]. |
6695 ]. |
6695 ]. |
6696 ]. |
6696 ]. |
6697 ]. |
6697 |
6698 |
6698 freeIdx == 0 ifTrue:[ |
6699 freeIdx == 0 ifTrue:[ |
6699 sz := knownViews size. |
6700 sz := knownViews size. |
6700 newSize := sz * 2. |
6701 newSize := sz * 2. |
6701 newArr := WeakArray new:newSize. |
6702 newArr := WeakArray new:newSize. |
6702 newArr replaceFrom:1 to:sz with:knownViews. |
6703 newArr replaceFrom:1 to:sz with:knownViews. |
6703 knownViews := newArr. |
6704 knownViews := newArr. |
6704 |
6705 |
6705 newArr := Array new:newSize. |
6706 newArr := Array new:newSize. |
6706 newArr replaceFrom:1 to:sz with:knownIds. |
6707 newArr replaceFrom:1 to:sz with:knownIds. |
6707 knownIds := newArr. |
6708 knownIds := newArr. |
6708 freeIdx := sz + 1. |
6709 freeIdx := sz + 1. |
6709 ]. |
6710 ]. |
6710 knownViews at:freeIdx put:aView. |
6711 knownViews at:freeIdx put:aView. |
6711 knownIds at:freeIdx put:aWindowID. |
6712 knownIds at:freeIdx put:aWindowID. |
6712 wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
6713 wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
6713 |
6714 |
6714 idToTableIndexMapping notNil ifTrue:[ |
6715 idToTableIndexMapping notNil ifTrue:[ |
6715 idToTableIndexMapping at:aWindowID put:freeIdx. |
6716 idToTableIndexMapping at:aWindowID put:freeIdx. |
6716 ]. |
6717 ]. |
6717 |
6718 |
6718 "/ dispatching ifFalse:[ |
6719 "/ dispatching ifFalse:[ |
6719 "/ self startDispatch |
6720 "/ self startDispatch |
6720 "/ ]. |
6721 "/ ]. |
6738 |index wasBlocked nV nI n dstIdx v id newSize| |
6739 |index wasBlocked nV nI n dstIdx v id newSize| |
6739 |
6740 |
6740 lastId := nil. |
6741 lastId := nil. |
6741 lastView := nil. |
6742 lastView := nil. |
6742 focusView == aView ifTrue:[ |
6743 focusView == aView ifTrue:[ |
6743 focusView := nil |
6744 focusView := nil |
6744 ]. |
6745 ]. |
6745 |
6746 |
6746 knownViews notNil ifTrue:[ |
6747 knownViews notNil ifTrue:[ |
6747 wasBlocked := OperatingSystem blockInterrupts. |
6748 wasBlocked := OperatingSystem blockInterrupts. |
6748 |
6749 |
6749 index := 0. |
6750 index := 0. |
6750 aViewId notNil ifTrue:[ |
6751 aViewId notNil ifTrue:[ |
6751 idToTableIndexMapping notNil ifTrue:[ |
6752 idToTableIndexMapping notNil ifTrue:[ |
6752 index := idToTableIndexMapping at:aViewId ifAbsent:0. |
6753 index := idToTableIndexMapping at:aViewId ifAbsent:0. |
6753 ] |
6754 ] |
6754 ]. |
6755 ]. |
6755 index == 0 ifTrue:[ |
6756 index == 0 ifTrue:[ |
6756 aView notNil ifTrue:[ |
6757 aView notNil ifTrue:[ |
6757 index := knownViews identityIndexOf:aView. |
6758 index := knownViews identityIndexOf:aView. |
6758 ]. |
6759 ]. |
6759 ]. |
6760 ]. |
6760 |
6761 |
6761 index ~~ 0 ifTrue:[ |
6762 index ~~ 0 ifTrue:[ |
6762 idToTableIndexMapping notNil ifTrue:[ |
6763 idToTableIndexMapping notNil ifTrue:[ |
6763 aViewId notNil ifTrue:[ |
6764 aViewId notNil ifTrue:[ |
6764 idToTableIndexMapping removeKey:aViewId ifAbsent:nil |
6765 idToTableIndexMapping removeKey:aViewId ifAbsent:nil |
6765 ] ifFalse:[ |
6766 ] ifFalse:[ |
6766 id := knownIds at:index. |
6767 id := knownIds at:index. |
6767 id notNil ifTrue:[ |
6768 id notNil ifTrue:[ |
6768 idToTableIndexMapping removeKey:id ifAbsent:nil. |
6769 idToTableIndexMapping removeKey:id ifAbsent:nil. |
6769 ] |
6770 ] |
6770 ] |
6771 ] |
6771 ]. |
6772 ]. |
6772 knownViews at:index put:nil. |
6773 knownViews at:index put:nil. |
6773 knownIds at:index put:nil. |
6774 knownIds at:index put:nil. |
6774 lastId := nil. |
6775 lastId := nil. |
6775 lastView := nil. |
6776 lastView := nil. |
6776 ]. |
6777 ]. |
6777 |
6778 |
6778 wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
6779 wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
6779 |
6780 |
6780 aView notNil ifTrue:[ |
6781 aView notNil ifTrue:[ |
6781 aView isTopView ifTrue:[ |
6782 aView isTopView ifTrue:[ |
6782 "/ check for sparsely filled knownViews - array |
6783 "/ check for sparsely filled knownViews - array |
6783 wasBlocked := OperatingSystem blockInterrupts. |
6784 wasBlocked := OperatingSystem blockInterrupts. |
6784 n := 0. |
6785 n := 0. |
6785 knownViews do:[:v | |
6786 knownViews do:[:v | |
6786 (v notNil and:[v ~~ 0]) ifTrue:[ |
6787 (v notNil and:[v ~~ 0]) ifTrue:[ |
6787 n := n + 1 |
6788 n := n + 1 |
6788 ]. |
6789 ]. |
6789 ]. |
6790 ]. |
6790 n < (knownViews size * 2 // 3) ifTrue:[ |
6791 n < (knownViews size * 2 // 3) ifTrue:[ |
6791 newSize := n * 3 // 2. |
6792 newSize := n * 3 // 2. |
6792 newSize > 50 ifTrue:[ |
6793 newSize > 50 ifTrue:[ |
6793 nV := WeakArray new:newSize. |
6794 nV := WeakArray new:newSize. |
6794 nI := Array new:newSize. |
6795 nI := Array new:newSize. |
6795 dstIdx := 1. |
6796 dstIdx := 1. |
6796 1 to:knownViews size do:[:srcIdx | |
6797 1 to:knownViews size do:[:srcIdx | |
6797 v := knownViews at:srcIdx. |
6798 v := knownViews at:srcIdx. |
6798 (v notNil and:[v ~~ 0]) ifTrue:[ |
6799 (v notNil and:[v ~~ 0]) ifTrue:[ |
6799 nV at:dstIdx put:v. |
6800 nV at:dstIdx put:v. |
6800 nI at:dstIdx put:(knownIds at:srcIdx). |
6801 nI at:dstIdx put:(knownIds at:srcIdx). |
6801 dstIdx := dstIdx + 1. |
6802 dstIdx := dstIdx + 1. |
6802 ]. |
6803 ]. |
6803 ]. |
6804 ]. |
6804 idToTableIndexMapping := nil. |
6805 idToTableIndexMapping := nil. |
6805 knownViews := nV. |
6806 knownViews := nV. |
6806 knownIds := nI. |
6807 knownIds := nI. |
6807 idToTableIndexMapping := Dictionary new. |
6808 idToTableIndexMapping := Dictionary new. |
6808 knownIds keysAndValuesDo:[:idx :id | |
6809 knownIds keysAndValuesDo:[:idx :id | |
6809 id notNil ifTrue:[ |
6810 id notNil ifTrue:[ |
6810 idToTableIndexMapping at:id put:idx |
6811 idToTableIndexMapping at:id put:idx |
6811 ] |
6812 ] |
6812 ]. |
6813 ]. |
6813 ]. |
6814 ]. |
6814 ]. |
6815 ]. |
6815 wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
6816 wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
6816 ]. |
6817 ]. |
6817 ]. |
6818 ]. |
6818 self checkForEndOfDispatch. |
6819 self checkForEndOfDispatch. |
6819 ] |
6820 ] |
6820 |
6821 |
6821 "Created: 22.3.1997 / 14:56:20 / cg" |
6822 "Created: 22.3.1997 / 14:56:20 / cg" |
6822 "Modified: 27.3.1997 / 17:13:28 / cg" |
6823 "Modified: 27.3.1997 / 17:13:28 / cg" |
6823 ! |
6824 ! |
6826 "given an Id, return the corresponding view." |
6827 "given an Id, return the corresponding view." |
6827 |
6828 |
6828 |index v idx| |
6829 |index v idx| |
6829 |
6830 |
6830 aWindowID = lastId ifTrue:[ |
6831 aWindowID = lastId ifTrue:[ |
6831 lastView notNil ifTrue:[ |
6832 lastView notNil ifTrue:[ |
6832 ^ lastView |
6833 ^ lastView |
6833 ] |
6834 ] |
6834 ]. |
6835 ]. |
6835 |
6836 |
6836 idToTableIndexMapping notNil ifTrue:[ |
6837 idToTableIndexMapping notNil ifTrue:[ |
6837 idx := idToTableIndexMapping at:aWindowID ifAbsent:nil. |
6838 idx := idToTableIndexMapping at:aWindowID ifAbsent:nil. |
6838 idx notNil ifTrue:[ |
6839 idx notNil ifTrue:[ |
6839 v := knownViews at:idx. |
6840 v := knownViews at:idx. |
6840 (v notNil and:[v ~~ 0]) ifTrue:[ |
6841 (v notNil and:[v ~~ 0]) ifTrue:[ |
6841 lastView := v. |
6842 lastView := v. |
6842 lastId := aWindowID. |
6843 lastId := aWindowID. |
6843 ^ v |
6844 ^ v |
6844 ]. |
6845 ]. |
6845 ] |
6846 ] |
6846 ]. |
6847 ]. |
6847 |
6848 |
6848 knownIds isNil ifTrue:[ |
6849 knownIds isNil ifTrue:[ |
6849 ^ nil |
6850 ^ nil |
6850 ]. |
6851 ]. |
6851 |
6852 |
6852 index := knownIds indexOf:aWindowID. |
6853 index := knownIds indexOf:aWindowID. |
6853 index == 0 ifTrue:[ |
6854 index == 0 ifTrue:[ |
6854 ^ nil |
6855 ^ nil |
6855 ]. |
6856 ]. |
6856 |
6857 |
6857 v := knownViews at:index. |
6858 v := knownViews at:index. |
6858 v == 0 ifTrue:[ |
6859 v == 0 ifTrue:[ |
6859 knownViews at:index put:nil. |
6860 knownViews at:index put:nil. |
6860 knownIds at:index put:nil. |
6861 knownIds at:index put:nil. |
6861 ^ nil |
6862 ^ nil |
6862 ]. |
6863 ]. |
6863 |
6864 |
6864 lastId := aWindowID. |
6865 lastId := aWindowID. |
6865 lastView := v. |
6866 lastView := v. |
6866 |
6867 |
6873 "return true, if I still consider a windowId as being valid" |
6874 "return true, if I still consider a windowId as being valid" |
6874 |
6875 |
6875 |index v| |
6876 |index v| |
6876 |
6877 |
6877 aWindowID = lastId ifTrue:[ |
6878 aWindowID = lastId ifTrue:[ |
6878 lastView notNil ifTrue:[ |
6879 lastView notNil ifTrue:[ |
6879 ^ true |
6880 ^ true |
6880 ] |
6881 ] |
6881 ]. |
6882 ]. |
6882 |
6883 |
6883 idToTableIndexMapping notNil ifTrue:[ |
6884 idToTableIndexMapping notNil ifTrue:[ |
6884 index := idToTableIndexMapping at:aWindowID ifAbsent:nil. |
6885 index := idToTableIndexMapping at:aWindowID ifAbsent:nil. |
6885 ]. |
6886 ]. |
6886 index isNil ifTrue:[ |
6887 index isNil ifTrue:[ |
6887 index := knownIds indexOf:aWindowID. |
6888 index := knownIds indexOf:aWindowID. |
6888 ]. |
6889 ]. |
6889 index ~~ 0 ifTrue:[ |
6890 index ~~ 0 ifTrue:[ |
6890 v := knownViews at:index. |
6891 v := knownViews at:index. |
6891 ^ (v notNil and:[v ~~ 0]) |
6892 ^ (v notNil and:[v ~~ 0]) |
6892 ]. |
6893 ]. |
6893 ^ false. |
6894 ^ false. |
6894 |
6895 |
6895 "Created: 4.4.1997 / 11:01:07 / cg" |
6896 "Created: 4.4.1997 / 11:01:07 / cg" |
6896 "Modified: 4.4.1997 / 19:07:55 / cg" |
6897 "Modified: 4.4.1997 / 19:07:55 / cg" |
6932 |
6933 |
6933 "/ OBSOLETE interface - this looses the minExtent/maxExtent properties |
6934 "/ OBSOLETE interface - this looses the minExtent/maxExtent properties |
6934 "/ use mapView:...minWidth:minHeight:maxWidth:maxHeight: |
6935 "/ use mapView:...minWidth:minHeight:maxWidth:maxHeight: |
6935 |
6936 |
6936 ^ self |
6937 ^ self |
6937 mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
6938 mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
6938 width:w height:h minExtent:nil maxExtent:nil |
6939 width:w height:h minExtent:nil maxExtent:nil |
6939 ! |
6940 ! |
6940 |
6941 |
6941 mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
6942 mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
6942 width:w height:h minExtent:minExt maxExtent:maxExt |
6943 width:w height:h minExtent:minExt maxExtent:maxExt |
6943 "make a window visible - either as icon or as a real view - needed for restart" |
6944 "make a window visible - either as icon or as a real view - needed for restart" |
6944 |
6945 |
6945 ^ self subclassResponsibility |
6946 ^ self subclassResponsibility |
6946 |
6947 |
6947 "Modified: 24.4.1996 / 19:43:17 / cg" |
6948 "Modified: 24.4.1996 / 19:43:17 / cg" |
6998 restoreCursors |
6999 restoreCursors |
6999 "restore the cursors of all views to their current cursor. |
7000 "restore the cursors of all views to their current cursor. |
7000 This undoes the effect of #setCursors:" |
7001 This undoes the effect of #setCursors:" |
7001 |
7002 |
7002 knownViews notNil ifTrue:[ |
7003 knownViews notNil ifTrue:[ |
7003 knownViews validElementsDo:[:aView | |
7004 knownViews validElementsDo:[:aView | |
7004 |c vid cid| |
7005 |c vid cid| |
7005 |
7006 |
7006 (vid := aView id) notNil ifTrue:[ |
7007 (vid := aView id) notNil ifTrue:[ |
7007 c := aView cursor. |
7008 c := aView cursor. |
7008 (c notNil and:[(cid := c id) notNil]) ifTrue:[ |
7009 (c notNil and:[(cid := c id) notNil]) ifTrue:[ |
7009 self setCursor:cid in:vid |
7010 self setCursor:cid in:vid |
7010 ] |
7011 ] |
7011 ] |
7012 ] |
7012 ]. |
7013 ]. |
7013 self flush |
7014 self flush |
7014 ] |
7015 ] |
7015 |
7016 |
7016 " |
7017 " |
7017 Display setCursors:(Cursor wait). |
7018 Display setCursors:(Cursor wait). |
7018 Delay waitForSeconds:5. |
7019 Delay waitForSeconds:5. |
7056 |
7057 |
7057 aCursor isNil ifTrue:[^ self]. |
7058 aCursor isNil ifTrue:[^ self]. |
7058 |
7059 |
7059 id := (aCursor onDevice:self) id. |
7060 id := (aCursor onDevice:self) id. |
7060 id notNil ifTrue:[ |
7061 id notNil ifTrue:[ |
7061 knownViews validElementsDo:[:aView | |
7062 knownViews validElementsDo:[:aView | |
7062 |vid| |
7063 |vid| |
7063 |
7064 |
7064 (vid := aView id) notNil ifTrue:[ |
7065 (vid := aView id) notNil ifTrue:[ |
7065 self setCursor:id in:vid |
7066 self setCursor:id in:vid |
7066 ] |
7067 ] |
7067 ]. |
7068 ]. |
7068 self flush |
7069 self flush |
7069 ] |
7070 ] |
7070 |
7071 |
7071 " |
7072 " |
7072 Display setCursors:(Cursor wait). |
7073 Display setCursors:(Cursor wait). |
7073 Delay waitForSeconds:5. |
7074 Delay waitForSeconds:5. |
7171 |
7172 |
7172 setWindowIcon:aForm in:aWindowId |
7173 setWindowIcon:aForm in:aWindowId |
7173 "define a bitmap to be used as icon" |
7174 "define a bitmap to be used as icon" |
7174 |
7175 |
7175 self |
7176 self |
7176 setWindowIcon:aForm |
7177 setWindowIcon:aForm |
7177 mask:nil |
7178 mask:nil |
7178 in:aWindowId |
7179 in:aWindowId |
7179 ! |
7180 ! |
7180 |
7181 |
7181 setWindowIcon:aForm mask:aMaskForm in:aWindowId |
7182 setWindowIcon:aForm mask:aMaskForm in:aWindowId |
7182 "set a windows icon & iconMask" |
7183 "set a windows icon & iconMask" |
7183 |
7184 |
7195 nil arguments are ignored." |
7196 nil arguments are ignored." |
7196 |
7197 |
7197 |minW minH maxW maxH| |
7198 |minW minH maxW maxH| |
7198 |
7199 |
7199 minExt notNil ifTrue:[ |
7200 minExt notNil ifTrue:[ |
7200 minW := minExt x. |
7201 minW := minExt x. |
7201 minH := minExt y. |
7202 minH := minExt y. |
7202 ]. |
7203 ]. |
7203 maxExt notNil ifTrue:[ |
7204 maxExt notNil ifTrue:[ |
7204 maxW := maxExt x. |
7205 maxW := maxExt x. |
7205 maxH := maxExt y. |
7206 maxH := maxExt y. |
7206 ]. |
7207 ]. |
7207 self setWindowMinExtentX:minW y:minH maxExtentX:maxW y:maxH in:aWindowId |
7208 self setWindowMinExtentX:minW y:minH maxExtentX:maxW y:maxH in:aWindowId |
7208 ! |
7209 ! |
7209 |
7210 |
7210 setWindowMinExtentX:minW y:minH maxExtentX:maxW y:maxH in:aWindowId |
7211 setWindowMinExtentX:minW y:minH maxExtentX:maxW y:maxH in:aWindowId |
7244 ! ! |
7245 ! ! |
7245 |
7246 |
7246 !DeviceWorkstation class methodsFor:'documentation'! |
7247 !DeviceWorkstation class methodsFor:'documentation'! |
7247 |
7248 |
7248 version |
7249 version |
7249 ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.389 2001-01-08 17:33:01 cg Exp $' |
7250 ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.390 2001-01-09 16:03:56 penk Exp $' |
7250 ! ! |
7251 ! ! |
7251 DeviceWorkstation initialize! |
7252 DeviceWorkstation initialize! |