author | Claus Gittinger <cg@exept.de> |
Mon, 04 Oct 1999 12:45:41 +0200 | |
changeset 2934 | 33b1988133d3 |
parent 2932 | f7018a33faa6 |
child 2953 | f9c1d464cb29 |
permissions | -rw-r--r-- |
0 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
1286
f7c2ac67388b
inserted dummy abstract classes for ST-80 compatible subclassing
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
13 |
HostGraphicsDevice subclass:#DeviceWorkstation |
1369 | 14 |
instanceVariableNames:'visualType monitorType depth ncells bitsPerRGB bitsRed bitsGreen |
15 |
bitsBlue redMask greenMask blueMask redShift greenShift blueShift |
|
16 |
hasColors hasGreyscales width height widthMM heightMM |
|
1475 | 17 |
resolutionHor resolutionVer idToTableIndexMapping knownViews |
2824 | 18 |
knownIds knownBitmaps knownBitmapIds dispatching dispatchProcess |
19 |
exitOnLastClose ctrlDown shiftDown metaDown altDown |
|
20 |
motionEventCompression lastId lastView keyboardMap rootView |
|
21 |
isSlow activeKeyboardGrab activePointerGrab buttonTranslation |
|
22 |
multiClickTimeDelta altModifiers metaModifiers ctrlModifiers |
|
23 |
shiftModifiers supportsDeepIcons preferredIconSize ditherColors |
|
24 |
fixColors numFixRed numFixGreen numFixBlue fixGrayColors |
|
25 |
copyBuffer lastCopyBuffer blackColor whiteColor focusMode |
|
2858 | 26 |
activeView clipBoardEncoding focusView deviceErrorSignal |
27 |
deviceIOErrorSignal' |
|
1369 | 28 |
classVariableNames:'ButtonTranslation MultiClickTimeDelta DeviceErrorSignal |
1992
14e554fc38b4
Remove 'condition is always false...'
Stefan Vogel <sv@exept.de>
parents:
1991
diff
changeset
|
29 |
DeviceIOErrorSignal DeviceIOTimeoutErrorSignal ErrorPrinting |
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
30 |
DefaultScreen AllScreens CurrentScreenQuerySignal |
2384
bceacc3c974b
first attempt in simulating windows right button behavior
Claus Gittinger <cg@exept.de>
parents:
2334
diff
changeset
|
31 |
LastActiveScreen LastActiveProcess NoBeep |
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
32 |
WindowsRightButtonBehavior ExitOnLastClose' |
1369 | 33 |
poolDictionaries:'' |
34 |
category:'Interface-Graphics' |
|
0 | 35 |
! |
36 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
37 |
!DeviceWorkstation class methodsFor:'documentation'! |
46 | 38 |
|
39 |
copyright |
|
40 |
" |
|
0 | 41 |
COPYRIGHT (c) 1993 by Claus Gittinger |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
42 |
All Rights Reserved |
0 | 43 |
|
46 | 44 |
This software is furnished under a license and may be used |
45 |
only in accordance with the terms of that license and with the |
|
46 |
inclusion of the above copyright notice. This software may not |
|
47 |
be provided or otherwise made available to, or used by, any |
|
48 |
other person. No title to or ownership of the software is |
|
49 |
hereby transferred. |
|
50 |
" |
|
51 |
! |
|
0 | 52 |
|
53 |
documentation |
|
54 |
" |
|
38 | 55 |
this abstract class defines common protocol to all Display types. |
599 | 56 |
For compatibility with ST-80, this class (actually a concrete subclass) |
57 |
is also bound to the global variable Screen. |
|
58 |
||
59 |
DeviceWorkstation (and its concrete subclasses) are the central classes |
|
60 |
around windowManagement and event processing. |
|
61 |
See the documentation in #events and #workstationDevices for more detailed |
|
62 |
info. |
|
63 |
||
64 |
[instance variables:] |
|
0 | 65 |
|
134 | 66 |
displayId <Number> the device id of the display |
67 |
visualType <Symbol> one of #StaticGray, #PseudoColor, ... #TrueColor |
|
68 |
monitorType <Symbol> one of #monochrome, #color, #unknown |
|
69 |
||
193 | 70 |
depth <SmallInteger> bits per color |
71 |
ncells <SmallInteger> number of colors (i.e. colormap size; not always == 2^depth) |
|
72 |
bitsPerRGB <SmallInteger> number of valid bits per rgb component |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
73 |
(actual number taken in A/D converter; not all devices report the true value) |
193 | 74 |
bitsRed <SmallInteger> number of red bits (only valid for TrueColor displays) |
75 |
bitsGreen <SmallInteger> number of green bits (only valid for TrueColor displays) |
|
76 |
bitsBlue <SmallInteger> number of blue bits (only valid for TrueColor displays) |
|
77 |
redMask <SmallInteger> shifted red mask (only useful for TrueColor displays) |
|
78 |
greenMask <SmallInteger> shifted green mask (only useful for TrueColor displays) |
|
79 |
blueMask <SmallInteger> shifted blue mask (only useful for TrueColor displays) |
|
80 |
shiftRed <SmallInteger> number of bits to shift red bits (only valid for TrueColor displays) |
|
81 |
shiftGreen <SmallInteger> number of bits to shift green bits (only valid for TrueColor displays) |
|
82 |
shiftBlue <SmallInteger> number of bits to shift blue bits (only valid for TrueColor displays) |
|
83 |
||
134 | 84 |
hasColors <Boolean> true, if display supports colors |
85 |
hasGreyscales <Boolean> true, if display supports grey-scales (i.e is not b/w display) |
|
193 | 86 |
width <SmallInteger> number of horizontal pixels |
87 |
height <SmallInteger> number of vertical pixels |
|
134 | 88 |
heightMM <Number> screen height in millimeter |
89 |
widthMM <Number> screen width in millimeter |
|
90 |
resolutionHor <Number> pixels per horizontal millimeter |
|
91 |
resolutionVer <Number> pixels per vertical millimeter |
|
92 |
||
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
93 |
idToTableIndexMapping <Dictionary> maps view-ids to views |
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
94 |
knownViews <WeakArray> all of my known views |
134 | 95 |
knownIds <Collection> corresponding device-view ids |
96 |
knownBitmaps <Collection> all known device bitmaps |
|
97 |
knownBitmapIds <Collection> corresponding device-bitmap ids |
|
98 |
||
99 |
dispatching <Boolean> true, if currently in dispatch loop |
|
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
100 |
exitDispatchOnLastWindowClose |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
101 |
<Boolean> if true, dispatch is finished when the last |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
102 |
window closes (default:true). |
134 | 103 |
|
151 | 104 |
ctrlDown <Boolean> true, if control key currently pressed |
134 | 105 |
shiftDown <Boolean> true, if shift key currently pressed |
106 |
metaDown <Boolean> true, if meta key (cmd-key) is currently pressed |
|
107 |
altDown <Boolean> true, if alt key is currently pressed |
|
108 |
||
109 |
motionEventCompression |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
110 |
<Boolean> if true motion events are compressed |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
111 |
(obsolete: now done in sensor) |
134 | 112 |
|
113 |
lastId <Number> the id of the last events view (internal) |
|
114 |
lastView <View> the last events view (internal, for faster id->view mapping) |
|
115 |
||
116 |
keyboardMap <KeyBdMap> mapping for keys |
|
117 |
rootView <DisplayRootView> this displays root window |
|
118 |
isSlow <Boolean> set/cleared from startup - used to turn off |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
119 |
things like popup-shadows etc. |
599 | 120 |
|
1717
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
121 |
focusMode <Symbol> nil, #pointer or #activeWindow |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
122 |
activeWindow <View> WINDOWS only: the currently active (foreground) view |
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
123 |
|
1788 | 124 |
clipBoardEncoding |
1906 | 125 |
<Symbol> encoding of pasted clipBoard text; |
1787 | 126 |
nil means: iso8859. |
127 |
set this to #shiftJis, if pasting |
|
128 |
SJIS text (for example, from netscape) |
|
129 |
Some systems pass encoding information |
|
1788 | 130 |
in the clipBoard - there, this is not |
1787 | 131 |
needed. |
132 |
||
1122 | 133 |
[class variables:] |
134 |
||
135 |
MultiClickTimeDelta in ms; controls how long of a delay is |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
136 |
required between two clicks, to NOT take |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
137 |
it as a multi-click. |
1122 | 138 |
|
139 |
ErrorPrinting controls low-level (X-) error message printing |
|
140 |
||
141 |
AllScreens a collectin of known screens |
|
142 |
||
599 | 143 |
[see also:] |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
144 |
GraphicsContext DeviceDrawable |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
145 |
WindowSensor WindowGroup WindowEvent |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
146 |
ProcessorScheduler |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
147 |
PSMedium |
614 | 148 |
|
149 |
[author:] |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
150 |
Claus Gittinger |
0 | 151 |
" |
151 | 152 |
! |
153 |
||
293 | 154 |
events |
155 |
" |
|
156 |
All events are processed in a workstations dispatchEvent method. |
|
157 |
There, incoming events are first sent to itself, for a first (view independent) |
|
158 |
preprocessing. For example, the devices state of the shift-, alt-, control and |
|
159 |
meta keys are updated there. After that, the event is forwarded either to |
|
160 |
the views sensor or to the view directly (if it has no sensor). |
|
161 |
(Sensorless views are a leftover from ancient times and will sooner or |
|
162 |
later vanish - simplifying things a bit. Do not depend on views without |
|
163 |
sensors to work correctly in future versions.) |
|
164 |
||
165 |
This event processing is done by the event dispatcher process, which is |
|
166 |
launched in ST/X's startup sequence (see Smalltalk>>start). |
|
167 |
Event processing is done at a high priority, to allow keyboad processing |
|
168 |
and CTRL-C handling to be performed even while other processes are running. |
|
1697 | 169 |
The code executed by the event process is found in #startDispatch. |
293 | 170 |
|
171 |
Individual events can be enabled or disabled. The ones that are enabled |
|
172 |
by default are: |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
173 |
keypress / keyRelease |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
174 |
buttonPress / buttonRelease / buttonMotion (i.e. motion with button pressed) |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
175 |
pointerEnter / pointerLeave |
293 | 176 |
|
177 |
other events have to be enabled by sending a corresponding #enableXXXEvent |
|
178 |
message to the view which shall receive those events. |
|
179 |
For example, pointerMotion events (i.e. motion without button being pressed) |
|
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
180 |
are enabled by: 'aView enableMotionEvent' |
293 | 181 |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
182 |
The above is only of interest, if you write your own widget classes, |
293 | 183 |
existing widgets set things as required in their #initEvents method. |
184 |
" |
|
185 |
! |
|
186 |
||
151 | 187 |
workstationDevices |
188 |
" |
|
189 |
In ST/X, all interaction with the graphics device is done through |
|
190 |
an instance of (a subclass) of DeviceWorkstation. |
|
191 |
Every view has a reference to the device it has been created on in |
|
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
192 |
its 'device' instance variable. |
151 | 193 |
|
194 |
One particular device instance is bound to the global variable Display: |
|
195 |
this is the default graphics display, on which new views are created |
|
196 |
(however, provisions exist for multi-display operation) |
|
197 |
||
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
198 |
Currently, there is are twoconcrete display classes (released to the public): |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
199 |
|
1675 | 200 |
XWorkstation - a plain X window interface |
201 |
||
202 |
GLXWorkstation - an X window interface with a GL(tm) (3D graphic library) |
|
203 |
extension; either simulated (VGL) or a real GL |
|
204 |
(real GL is only available on SGI machines) |
|
1122 | 205 |
|
206 |
the following are coming soon: |
|
207 |
||
1675 | 208 |
OpenGLWorkstation |
209 |
- an X window interface with a openGL(tm) (3D graphic library) |
|
210 |
extension; either simulated (MESA) or a real openGL |
|
211 |
(real openGL is only available on SGI/NT machines) |
|
212 |
||
213 |
WinWorkstation - what will that be ? |
|
151 | 214 |
|
215 |
An experimental version for a NeXTStep interface exists, but is currently |
|
216 |
no longer maintained and not released. |
|
217 |
||
218 |
DeviceWorkstation itself is an abstract class; the methods as defined |
|
219 |
here perform things which are common to all graphic devices or block |
|
220 |
methods and raise a subclassResponsibilty error condition. |
|
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
221 |
To create a new graphic interface, at least the subclassResponsibility-methods |
151 | 222 |
have to be reimplemented in a concrete subclass. |
223 |
||
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
224 |
ST/X is designed to allow the use of multiple workstation devices in parallel, |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
225 |
if the underlying window system supports this. |
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
226 |
For example, in X, it is possible to create another instance of XWorkstation, |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
227 |
start a dispatch process for it, and to create and open views on this display. |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
228 |
Multiple display operation does not work with other devices (i.e. Windows). |
151 | 229 |
|
230 |
If you want to experiment with multi-display applications, |
|
231 |
you have to: |
|
232 |
||
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
233 |
- create a new instance of XWorkstation: |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
234 |
|
1675 | 235 |
Smalltalk at:#Display2 put:(XWorkstation new). |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
236 |
or: |
1675 | 237 |
Smalltalk at:#Display2 put:(GLXWorkstation new). |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
238 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
239 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
240 |
- have it connect to the display (i.e. the xServer): |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
241 |
(replace 'localhost' below with the name of your display) |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
242 |
|
1675 | 243 |
Display2 := Display2 initializeFor:'localhost:0.0' |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
244 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
245 |
returns nil, if connection is refused |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
246 |
- leaving you with Display2==nil in this case. |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
247 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
248 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
249 |
- start an event dispatcher process for it: |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
250 |
(this is now no longer needed - the first opened view will do it for you) |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
251 |
|
1675 | 252 |
Display2 startDispatch |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
253 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
254 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
255 |
- optionally set its keyboard map |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
256 |
(since this is usually done for Display in the startup-file, |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
257 |
the new display does not have all your added key bindings) |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
258 |
|
1675 | 259 |
Display2 keyboardMap:(Display keyboardMap) |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
260 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
261 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
262 |
- create a view for it: |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
263 |
|
1675 | 264 |
(FileBrowser onDevice:Display2) open |
265 |
||
266 |
(Workspace onDevice:Display2) open |
|
267 |
||
268 |
(Launcher onDevice:Display2) open |
|
269 |
does not work with Launcher, since its an ApplicationModel (not a view) |
|
270 |
use: |
|
271 |
Launcher openOnDevice:Display2 |
|
272 |
instead. |
|
921
db3996767685
care for rootView when checking for end of dispatch
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
273 |
|
db3996767685
care for rootView when checking for end of dispatch
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
274 |
However, as mentioned above, there may be a few places, where the default |
1191 | 275 |
display 'Display' is still hard-coded - especially, in contributed and |
276 |
Public domain code, you may find those. |
|
277 |
||
278 |
Beside this (little bug ;-), remote display operation works pretty well. |
|
279 |
If you write your application to work around those, multi-display applications are |
|
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
280 |
possible in the current release (and actually being used in a concrete application, |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
281 |
where up to 6 x-terminals are connected to a single linux PC). |
1191 | 282 |
|
283 |
To make your application ready for multi-display operation, replace all |
|
284 |
references to 'Display' by: 'Screen current', which evaluates to the currently |
|
285 |
active display. I.e. each view gets its actual display via this expression. |
|
286 |
Since ST/X views already use this, new views opened by remote views should |
|
287 |
come up on the remote display. |
|
151 | 288 |
|
289 |
There is no easy solution for things like Notifiers, WarnBoxes or |
|
290 |
Debuggers when opened from some background or non-view process. |
|
291 |
These will come up one the default Display, as returned by 'Screen default'. |
|
292 |
||
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
293 |
Finally, your application should care for I/O errors (i.e. lost connection when |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
294 |
a remote display is switched off). |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
295 |
The framework provides per-display signals, which are raised in the corresponding |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
296 |
event dispatchers context. |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
297 |
For a save environment, you should add static exception handler blocks on those |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
298 |
signals; i.e. the setup for remote displays should look somewhat like: |
1675 | 299 |
|newDpy| |
300 |
||
301 |
newDpy := GLXWorkstation new. |
|
302 |
newDpy := newDpy initializeFor:'localhost:0.0'. |
|
303 |
newDpy isNil ifTrue:[ |
|
304 |
self warn:'cannot connect ...'. |
|
305 |
] ifFalse:[ |
|
306 |
newDpy deviceIOErrorSignal handlerBlock:[:ex | |
|
307 |
Transcript beep. |
|
308 |
Transcript showCR:'Display (' , newDpy displayName , '): connection broken.'. |
|
309 |
AbortSignal raise. |
|
310 |
]. |
|
311 |
newDpy startDispatch. |
|
312 |
Launcher openOnDevice:newDpy. |
|
313 |
]. |
|
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
314 |
|
1191 | 315 |
There may still some problems to be expected, |
151 | 316 |
if the screens have different display capabilities (b&w vs. greyscale vs. |
317 |
color display). The current styleSheet approach keeps default values |
|
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
318 |
only once (it should do so per display ...) |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
319 |
For now, expect ugly looking views in this case - or set your styleSheet |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
320 |
for the smallest common capabilities (i.e. for b&w). |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
321 |
This may be fixed in a future version ... |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
322 |
|
151 | 323 |
" |
0 | 324 |
! ! |
325 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
326 |
!DeviceWorkstation class methodsFor:'initialization'! |
0 | 327 |
|
2 | 328 |
initialize |
609 | 329 |
"create local error signals; enable errorPrinting" |
330 |
||
2 | 331 |
DeviceErrorSignal isNil ifTrue:[ |
1906 | 332 |
DeviceErrorSignal := (Signal new) mayProceed:true. |
333 |
DeviceErrorSignal notifierString:'device error'. |
|
334 |
DeviceErrorSignal nameClass:self message:#deviceErrorSignal. |
|
335 |
||
336 |
DeviceIOErrorSignal := (Signal new) mayProceed:false. |
|
337 |
DeviceIOErrorSignal notifierString:'device IO error'. |
|
338 |
DeviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal. |
|
339 |
||
1973 | 340 |
DeviceIOTimeoutErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false. |
341 |
DeviceIOTimeoutErrorSignal notifierString:'device IO timeout error'. |
|
342 |
DeviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal. |
|
343 |
||
1906 | 344 |
CurrentScreenQuerySignal := QuerySignal new. |
345 |
CurrentScreenQuerySignal nameClass:self message:#currentScreenQuerySignal. |
|
346 |
CurrentScreenQuerySignal notifierString:'asking for current screen'. |
|
2 | 347 |
]. |
218
10072d9beba5
can now turn off Xlib error messages from the errorHandler
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
348 |
ErrorPrinting := true. |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
349 |
|
134 | 350 |
self initializeConstants. |
609 | 351 |
|
1844 | 352 |
"Modified: 3.8.1997 / 18:14:58 / cg" |
2 | 353 |
! |
354 |
||
0 | 355 |
initializeConstants |
356 |
"initialize some (soft) constants" |
|
357 |
||
51 | 358 |
MultiClickTimeDelta := 300. "a click within 300ms is considered a double one" |
0 | 359 |
ButtonTranslation := #(1 2 3) "identity translation" |
1704 | 360 |
! |
361 |
||
362 |
nativeWindows:aBoolean |
|
363 |
"enable / disable use of native windows - dummy here." |
|
364 |
||
0 | 365 |
! ! |
366 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
367 |
!DeviceWorkstation class methodsFor:'Signal constants'! |
2 | 368 |
|
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
369 |
currentScreenQuerySignal |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
370 |
"return the signal which can be used to provide a current |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
371 |
screen (if background processes ask for one)" |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
372 |
|
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
373 |
^ CurrentScreenQuerySignal |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
374 |
|
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
375 |
"Created: 15.2.1997 / 15:07:20 / cg" |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
376 |
! |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
377 |
|
2 | 378 |
deviceErrorSignal |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
379 |
"return the signal used for device error reporting. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
380 |
In multi-display configurations, this is the parent of |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
381 |
all per-instance deviceErrorSignals." |
2 | 382 |
|
383 |
^ DeviceErrorSignal |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
384 |
! |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
385 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
386 |
deviceIOErrorSignal |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
387 |
"return the signal used for device I/O error reporting. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
388 |
In multi-display configurations, this is the parent of |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
389 |
all per-instance deviceIOErrorSignals." |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
390 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
391 |
^ DeviceIOErrorSignal |
1973 | 392 |
! |
393 |
||
394 |
deviceIOTimeoutErrorSignal |
|
395 |
"return the signal used for device I/O timeout error reporting. |
|
396 |
In multi-display configurations, this is the parent of |
|
397 |
all per-instance deviceIOTimeoutErrorSignals." |
|
398 |
||
399 |
^ DeviceIOTimeoutErrorSignal |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
400 |
! ! |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
401 |
|
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
402 |
!DeviceWorkstation class methodsFor:'accessing'! |
0 | 403 |
|
2735 | 404 |
activateOnClick:aBoolean |
405 |
"now obsolete - it became an instance message" |
|
406 |
||
407 |
Display isNil ifTrue:[ ^ false]. |
|
408 |
^ Display activateOnClick:aBoolean |
|
409 |
! |
|
410 |
||
0 | 411 |
buttonTranslation:anArray |
412 |
"set the button translation, #(1 2 3) is no-translation, |
|
413 |
#(3 2 1) is ok for left-handers" |
|
414 |
||
75 | 415 |
ButtonTranslation := anArray. |
416 |
Display notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
417 |
Display buttonTranslation:anArray |
75 | 418 |
]. |
0 | 419 |
! ! |
420 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
421 |
!DeviceWorkstation class methodsFor:'error handling'! |
293 | 422 |
|
423 |
errorInterrupt:errID with:aParameter |
|
544 | 424 |
"{ Pragma: +optSpace }" |
425 |
||
609 | 426 |
"an error in the devices low level code (typically Xlib or XtLib) |
293 | 427 |
This is invoked via |
2892 | 428 |
XError->errorInterrupt:#DisplayError->registeredErrorInterruptHandlers |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
429 |
or |
2892 | 430 |
XError->errorInterrupt:#DisplayIOError->registeredErrorInterruptHandlers |
293 | 431 |
|
432 |
looks if a signal handler for DeviceErrorSignal is present, |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
433 |
and - if so raises the signal. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
434 |
If the signal not handled, simply output a message and continue. |
293 | 435 |
This allows for non disrupted error reporting OR to catch and |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
436 |
investigate errors as required. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
437 |
However, io-errors are always delivered as a signal raise." |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
438 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
439 |
|badId badResource msg theDevice theSignal p| |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
440 |
|
1973 | 441 |
'DevWorkst [info]: errorInterrupt: ' infoPrint. errID infoPrintCR. |
442 |
||
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
443 |
errID notNil ifTrue:[ |
2892 | 444 |
"/ |
445 |
"/ timeoutError passes the device; |
|
446 |
"/ the others pass the devicesID |
|
447 |
"/ |
|
448 |
errID == #DisplayIOTimeoutError ifTrue:[ |
|
449 |
theDevice := aParameter. |
|
450 |
"/ 'device tiomeout error' printCR. |
|
451 |
] ifFalse:[ |
|
452 |
AllScreens do:[:aDisplayDevice | |
|
453 |
aDisplayDevice id = aParameter ifTrue:[ |
|
454 |
theDevice := aDisplayDevice. |
|
455 |
] |
|
456 |
] |
|
457 |
] |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
458 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
459 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
460 |
"/ now, we have the bad guy at hand ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
461 |
"/ get a per-instance signal. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
462 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
463 |
theDevice isNil ifTrue:[ |
2892 | 464 |
errID == #DisplayIOError ifTrue:[ |
465 |
theSignal := self deviceIOErrorSignal. |
|
466 |
] ifFalse:[ |
|
467 |
errID == #DisplayIOTimeoutError ifTrue:[ |
|
468 |
theSignal := self deviceIOTimeoutErrorSignal |
|
469 |
] ifFalse:[ |
|
470 |
theSignal := self deviceErrorSignal |
|
471 |
] |
|
472 |
] |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
473 |
] ifFalse:[ |
2892 | 474 |
errID == #DisplayIOError ifTrue:[ |
475 |
theSignal := theDevice deviceIOErrorSignal. |
|
476 |
] ifFalse:[ |
|
477 |
errID == #DisplayIOTimeoutError ifTrue:[ |
|
478 |
theSignal := theDevice deviceIOTimeoutErrorSignal |
|
479 |
] ifFalse:[ |
|
480 |
theSignal := theDevice deviceErrorSignal |
|
481 |
] |
|
482 |
] |
|
293 | 483 |
]. |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
484 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
485 |
errID == #DisplayIOError ifTrue:[ |
2892 | 486 |
"/ always raises an exception |
487 |
msg := 'Display I/O Error'. |
|
488 |
badResource := theDevice. |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
489 |
] ifFalse:[ |
2892 | 490 |
errID == #DisplayIOTimeoutError ifTrue:[ |
491 |
"/ always raises an exception for the current process |
|
492 |
msg := 'Display I/O timeout Error'. |
|
493 |
badResource := theDevice. |
|
494 |
] ifFalse:[ |
|
495 |
"/ only raises an exception if handled |
|
496 |
||
497 |
"/ that will become instance-specific information in |
|
498 |
"/ the near future ... |
|
499 |
||
500 |
badId := self resourceIdOfLastError. |
|
501 |
badId ~~ 0 ifTrue:[ |
|
502 |
badResource := self resourceOfId:badId. |
|
503 |
]. |
|
504 |
msg := 'Display error: ' , (self lastErrorString). |
|
505 |
||
506 |
theSignal isHandled ifFalse:[ |
|
507 |
ErrorPrinting ifTrue:[ |
|
508 |
('DeviceWorkstation [error]: ' , msg) errorPrintCR |
|
509 |
]. |
|
510 |
^ self |
|
511 |
] |
|
512 |
]. |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
513 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
514 |
|
1973 | 515 |
"/ interrupt that displays dispatch process |
516 |
"/ and force it to shutdown |
|
517 |
||
518 |
theDevice notNil ifTrue:[ |
|
2892 | 519 |
errID ~~ #DisplayIOTimeoutError ifTrue:[ |
520 |
p := theDevice dispatchProcess. |
|
521 |
(p notNil and:[p ~~ Processor activeProcess]) ifTrue:[ |
|
522 |
'DeviceWorkstation [info]: interrupting: ' infoPrint. p displayString infoPrintCR. |
|
523 |
p interruptWith:[ |
|
524 |
'broken connection' infoPrintCR. |
|
525 |
theDevice brokenConnection. |
|
526 |
theSignal raiseRequestWith:badResource errorString:msg. |
|
527 |
self stopDispatch. |
|
528 |
]. |
|
529 |
||
530 |
Processor reschedule. |
|
531 |
AbortSignal raise. |
|
532 |
]. |
|
533 |
]. |
|
534 |
||
535 |
"/ 'broken connection' printCR. |
|
536 |
theDevice brokenConnection. |
|
1973 | 537 |
]. |
538 |
||
539 |
'DeviceWorkstation [info]: interrupting current process: ' infoPrint. |
|
540 |
Processor activeProcess displayString infoPrintCR. |
|
541 |
||
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
542 |
theSignal |
2892 | 543 |
raiseRequestWith:badResource |
544 |
errorString:msg. |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
545 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
546 |
AbortSignal raise. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
547 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
548 |
"Modified: 11.4.1997 / 11:28:27 / cg" |
293 | 549 |
! |
550 |
||
551 |
errorPrinting |
|
609 | 552 |
"return the `errorPrinting-is-on' flag" |
553 |
||
293 | 554 |
ErrorPrinting isNil ifTrue:[^ false]. |
555 |
^ ErrorPrinting |
|
609 | 556 |
|
557 |
"Modified: 24.4.1996 / 19:35:55 / cg" |
|
293 | 558 |
! |
559 |
||
560 |
errorPrinting:aBoolean |
|
609 | 561 |
"set/clear the `errorPrinting-is-on' flag" |
562 |
||
293 | 563 |
ErrorPrinting := aBoolean |
609 | 564 |
|
565 |
"Modified: 24.4.1996 / 19:36:02 / cg" |
|
293 | 566 |
! |
567 |
||
568 |
lastErrorString |
|
569 |
"return a string describing the last error" |
|
570 |
||
571 |
^ self subclassResponsibility |
|
572 |
! |
|
573 |
||
574 |
resourceIdOfLastError |
|
575 |
"return the resource id responsible for the last error" |
|
576 |
||
577 |
^ self subclassResponsibility |
|
578 |
! |
|
579 |
||
580 |
resourceOfId:id |
|
544 | 581 |
"{ Pragma: +optSpace }" |
582 |
||
293 | 583 |
"search thru all device stuff for a resource. |
584 |
Needed for error handling" |
|
585 |
||
2428 | 586 |
Form allInstancesDo:[:f | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
587 |
f id == id ifTrue:[^ f] |
293 | 588 |
]. |
589 |
||
2428 | 590 |
self allInstancesDo:[:aDisplay | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
591 |
aDisplay allViewsDo:[:aView | |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
592 |
aView id == id ifTrue:[^ aView]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
593 |
aView gcId == id ifTrue:[^ aView] |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
594 |
]. |
293 | 595 |
|
596 |
"/ |views| |
|
597 |
"/ views := aDisplay knownViews. |
|
598 |
"/ views notNil ifTrue:[ |
|
599 |
"/ views do:[:v | |
|
600 |
"/ v id == id ifTrue:[^ v]. |
|
601 |
"/ v gcId == id ifTrue:[^ v] |
|
602 |
"/ ]. |
|
603 |
"/ ]. |
|
604 |
]. |
|
605 |
||
2428 | 606 |
Color allInstancesDo:[:c | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
607 |
c colorId == id ifTrue:[^ c] |
293 | 608 |
]. |
609 |
||
2428 | 610 |
Font allInstancesDo:[:f | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
611 |
f fontId == id ifTrue:[^ f] |
293 | 612 |
]. |
613 |
^ nil |
|
609 | 614 |
|
615 |
"Modified: 24.4.1996 / 19:36:15 / cg" |
|
293 | 616 |
! ! |
617 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
618 |
!DeviceWorkstation class methodsFor:'queries'! |
293 | 619 |
|
620 |
allScreens |
|
609 | 621 |
"Return a collection of active display devices. |
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
622 |
Typically, there is only one: Display or Screen current." |
293 | 623 |
|
1870
7f5931773d54
allScreens should always return a collection
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
624 |
^ AllScreens ? #() |
293 | 625 |
|
626 |
" |
|
627 |
Screen allScreens |
|
628 |
" |
|
629 |
||
630 |
"Modified: 1.9.1995 / 13:38:35 / claus" |
|
1870
7f5931773d54
allScreens should always return a collection
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
631 |
"Modified: 18.8.1997 / 18:43:42 / cg" |
293 | 632 |
! |
633 |
||
634 |
current |
|
609 | 635 |
"Return the currently active screen, |
293 | 636 |
that is, the device of the currently executing windowGroup. |
637 |
It will be used in multi-display operation, to launch views on |
|
638 |
the correct device - even if not specified explicitely. |
|
609 | 639 |
This does not yet work fully satisfying if a background processes |
1189 | 640 |
invokes this ... the default display is returned in this case." |
293 | 641 |
|
1310
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
642 |
|wg dev thisProcess| |
293 | 643 |
|
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
644 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
645 |
"/ if there is only one screen, |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
646 |
"/ take that ... it ought to be display |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
647 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
648 |
AllScreens size <= 1 ifTrue:[ |
2922
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
649 |
LastActiveProcess := LastActiveScreen := nil. |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
650 |
^ Display |
347 | 651 |
]. |
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
652 |
|
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
653 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
654 |
"/ someone willing to tell me ? |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
655 |
"/ |
2520
c5d3b01ab788
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2476
diff
changeset
|
656 |
(dev := CurrentScreenQuerySignal query) notNil ifTrue:[ |
2922
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
657 |
^ dev |
293 | 658 |
]. |
659 |
||
1310
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
660 |
thisProcess := Processor activeProcess. |
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
661 |
LastActiveScreen notNil ifTrue:[ |
2922
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
662 |
LastActiveProcess == thisProcess ifTrue:[ |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
663 |
^ LastActiveScreen |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
664 |
] |
1310
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
665 |
]. |
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
666 |
|
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
667 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
668 |
"/ mhmh - multiple screens are active; |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
669 |
"/ look for the active windowGroups screen. |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
670 |
"/ Be careful, to not run into an error in case |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
671 |
"/ the current windowGroup got corrupted somehow ... |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
672 |
|
293 | 673 |
(wg := WindowGroup activeGroup) notNil ifTrue:[ |
2922
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
674 |
"/ |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
675 |
"/ ok, not a background process or scheduler ... |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
676 |
"/ |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
677 |
(dev := wg graphicsDevice) notNil ifTrue:[ |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
678 |
LastActiveScreen := dev. |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
679 |
LastActiveProcess := thisProcess. |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
680 |
^ dev |
2c9033529c57
oops - release LastAvtiveProcess when LastActiveScreen is cleared.
Claus Gittinger <cg@exept.de>
parents:
2909
diff
changeset
|
681 |
]. |
293 | 682 |
]. |
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
683 |
|
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
684 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
685 |
"/ in all other cases, return the default display |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
686 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
687 |
'DevWorkstation [info]: cannot figure out current screen - use default' infoPrintCR. |
1310
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
688 |
|
293 | 689 |
^ Display |
690 |
||
691 |
" |
|
692 |
Screen current |
|
693 |
" |
|
694 |
||
2520
c5d3b01ab788
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2476
diff
changeset
|
695 |
"Modified: / 1.9.1995 / 13:40:05 / claus" |
c5d3b01ab788
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2476
diff
changeset
|
696 |
"Modified: / 7.2.1997 / 16:16:58 / cg" |
c5d3b01ab788
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2476
diff
changeset
|
697 |
"Modified: / 18.3.1999 / 18:20:39 / stefan" |
293 | 698 |
! |
699 |
||
1968
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
700 |
currentWindow |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
701 |
"Return the currently active window, |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
702 |
that is, the topView of the currently executing windowGroup" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
703 |
|
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
704 |
|wg| |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
705 |
|
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
706 |
wg := WindowGroup activeGroup. |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
707 |
wg notNil ifTrue:[^ wg topViews first]. |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
708 |
^ nil |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
709 |
|
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
710 |
" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
711 |
Screen currentWindow |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
712 |
" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
713 |
|
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
714 |
"Modified: / 1.9.1995 / 13:40:05 / claus" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
715 |
"Modified: / 7.2.1997 / 16:16:58 / cg" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
716 |
"Created: / 14.11.1997 / 21:52:24 / cg" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
717 |
! |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
718 |
|
293 | 719 |
default |
720 |
"ST-80 compatibility. |
|
721 |
Return the default screen. This is typically the first opened |
|
722 |
Display screen in a session. Use of the global variable Display |
|
723 |
should vanish over time - replace it by Screen default." |
|
724 |
||
725 |
^ DefaultScreen |
|
726 |
||
727 |
" |
|
728 |
Screen default |
|
729 |
" |
|
730 |
! |
|
731 |
||
732 |
default:aDevice |
|
733 |
"Set the default screen. This is sent very early during startup, |
|
734 |
and assigns the first opened screenDevice to both Display and the default |
|
735 |
screen." |
|
736 |
||
737 |
DefaultScreen := aDevice |
|
738 |
! |
|
739 |
||
740 |
platformName |
|
741 |
"ST-80 compatibility. |
|
742 |
Return a string describing the display systems platform. |
|
743 |
Returns a dummy here. This must be redefined in concrete |
|
744 |
Workstation classes, to return somthing like 'X', 'MSWindows', 'OS/2' etc." |
|
745 |
||
746 |
^ 'unknown' |
|
747 |
! ! |
|
748 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
749 |
!DeviceWorkstation class methodsFor:'standalone setup'! |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
750 |
|
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
751 |
exitOnLastClose:aBoolean |
599 | 752 |
"set/clear the flag which controls if the |
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
753 |
event dispatching should stop when the last view is closed |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
754 |
on the (main) Display connection. |
599 | 755 |
(standAlone applications will set it)" |
756 |
||
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
757 |
"/ here, a separate class variable is used, since this may have |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
758 |
"/ to be set at init-time, when no display instance exists yet. |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
759 |
"/ For all other (non-main-Display) connections, an instVar is used. |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
760 |
ExitOnLastClose := aBoolean |
599 | 761 |
|
762 |
"Modified: 23.4.1996 / 22:01:28 / cg" |
|
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
763 |
! ! |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
764 |
|
2934 | 765 |
!DeviceWorkstation methodsFor:'Compatibility - ST-80'! |
1281 | 766 |
|
1352 | 767 |
colorDepth |
768 |
"alias for depth - for ST-80 compatibility" |
|
769 |
||
770 |
^ self depth |
|
771 |
! |
|
772 |
||
1281 | 773 |
zoom:startRect to:endRect |
774 |
"animate a rubber-rectangle from startRect to endRect. |
|
775 |
Can be used by buttons, which open some dialog for nicer user feedback. |
|
776 |
Notice: since the displays window manager typically allows a topWindow |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
777 |
to be placed by the user, this should not be used for modeless |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
778 |
topViews. |
1281 | 779 |
" |
780 |
||
781 |
^ self |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
782 |
zoom:startRect to:endRect duration:0.3 |
1281 | 783 |
|
784 |
" |
|
785 |
Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) |
|
786 |
Screen current zoom:(20@20 corner:1000@1000) to:(10@10 corner:20@20) |
|
787 |
" |
|
788 |
||
789 |
"Modified: 27.1.1997 / 18:20:11 / cg" |
|
790 |
! |
|
791 |
||
792 |
zoom:startRect to:endRect duration:milliseconds |
|
793 |
"animate a rubber-rectangle from startRect to endRect. |
|
794 |
Can be used by buttons, which open some dialog for nicer user feedback. |
|
795 |
Notice: since the displays window manager typically allows a topWindow |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
796 |
to be placed by the user, this should not be used for modeless |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
797 |
topViews. |
1281 | 798 |
" |
799 |
||
800 |
|steps dExt dOrg org ext root| |
|
801 |
||
802 |
root := self rootView. |
|
803 |
||
804 |
steps := 10. |
|
805 |
dExt := (endRect extent - startRect extent) / steps. |
|
806 |
dOrg := (endRect origin - startRect origin) / steps. |
|
807 |
0 to:steps do:[:step | |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
808 |
org := (startRect origin + (dOrg * step)) rounded. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
809 |
ext := (startRect extent + (dExt * step)) rounded. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
810 |
rootView clippedByChildren:false. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
811 |
rootView xoring:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
812 |
rootView displayRectangleX:org x y:org y width:ext x height:ext y |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
813 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
814 |
Delay waitForMilliseconds:(milliseconds // steps). |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
815 |
rootView xoring:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
816 |
rootView displayRectangleX:org x y:org y width:ext x height:ext y |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
817 |
]. |
1281 | 818 |
]. |
819 |
rootView clippedByChildren:true. |
|
820 |
||
821 |
" |
|
822 |
Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) duration:1000 |
|
823 |
Screen current zoom:(20@20 corner:1000@1000) to:(10@10 corner:20@20) duration:1000 |
|
824 |
" |
|
825 |
||
826 |
"Created: 27.1.1997 / 18:19:35 / cg" |
|
827 |
! |
|
828 |
||
829 |
zoom:startRect to:endRect speed:pixelsPerSecond |
|
830 |
"animate a rubber-rectangle from startRect to endRect. |
|
831 |
Can be used by buttons, which open some dialog for nicer user feedback. |
|
832 |
The speed is computed for the longest edge to run at the given speed. |
|
833 |
Notice: since the displays window manager typically allows a topWindow |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
834 |
to be placed by the user, this should not be used for modeless |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
835 |
topViews. |
1281 | 836 |
" |
837 |
||
838 |
|maxDistance| |
|
839 |
||
840 |
maxDistance := (endRect origin - startRect origin). |
|
841 |
maxDistance := maxDistance max:(endRect topRight - startRect topRight). |
|
842 |
maxDistance := maxDistance max:(endRect bottomLeft - startRect bottomLeft). |
|
843 |
maxDistance := maxDistance max:(endRect corner - startRect corner). |
|
844 |
maxDistance := maxDistance x max:(maxDistance y). |
|
845 |
||
846 |
^ self |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
847 |
zoom:startRect to:endRect duration:(maxDistance / pixelsPerSecond * 1000) |
1281 | 848 |
|
849 |
" |
|
850 |
Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) speed:1000 |
|
851 |
Screen current zoom:(20@20 corner:1000@1000) to:(10@10 corner:20@20) speed:2000 |
|
852 |
" |
|
853 |
||
854 |
"Created: 27.1.1997 / 18:19:35 / cg" |
|
855 |
"Modified: 27.1.1997 / 18:24:58 / cg" |
|
856 |
! ! |
|
857 |
||
2934 | 858 |
!DeviceWorkstation methodsFor:'Compatibility - Squeak'! |
1926 | 859 |
|
860 |
border:aRectangle width:bw |
|
861 |
"draw a rectangular border on the display with black. |
|
862 |
Added to allow for some squeak examples to be evaluated ..." |
|
863 |
||
864 |
|r| |
|
865 |
||
866 |
rootView clippedByChildren:false. |
|
867 |
rootView paint:Color black. |
|
868 |
r := aRectangle. |
|
869 |
0 to:bw-1 do:[:i | |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
870 |
rootView displayRectangle:r. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
871 |
r := r insetBy:1. |
1926 | 872 |
]. |
873 |
rootView clippedByChildren:true. |
|
874 |
||
875 |
" |
|
876 |
Display restoreAfter:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
877 |
Display border:(10@10 corner:100@100) width:2. |
1926 | 878 |
] |
879 |
" |
|
880 |
||
881 |
"Modified: 15.10.1997 / 19:23:28 / cg" |
|
882 |
! |
|
883 |
||
2789 | 884 |
cursorPoint |
885 |
^ self pointerPosition |
|
886 |
! |
|
887 |
||
1926 | 888 |
displayOpaqueString:s x:x y:y |
889 |
"draw a string on the display with black. |
|
890 |
Added to allow for some squeak examples to be evaluated ..." |
|
891 |
||
892 |
rootView clippedByChildren:false. |
|
893 |
rootView paint:Color black. |
|
894 |
rootView displayOpaqueString:s x:x y:y. |
|
895 |
rootView clippedByChildren:true. |
|
896 |
||
897 |
" |
|
898 |
Display restoreAfter:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
899 |
Display displayOpaqueString:'hello' x:10 y:10. |
1926 | 900 |
] |
901 |
" |
|
902 |
||
903 |
"Created: 15.10.1997 / 19:25:09 / cg" |
|
904 |
"Modified: 15.10.1997 / 19:29:05 / cg" |
|
905 |
! |
|
906 |
||
907 |
displayString:s x:x y:y |
|
908 |
"draw a string on the display with black. |
|
909 |
Added to allow for some squeak examples to be evaluated ..." |
|
910 |
||
911 |
rootView clippedByChildren:false. |
|
912 |
rootView paint:Color black. |
|
913 |
rootView displayString:s x:x y:y. |
|
914 |
rootView clippedByChildren:true. |
|
915 |
||
916 |
" |
|
917 |
Display restoreAfter:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
918 |
Display displayString:'hello' x:10 y:10. |
1926 | 919 |
] |
920 |
" |
|
921 |
||
922 |
"Modified: 15.10.1997 / 19:29:10 / cg" |
|
923 |
! |
|
924 |
||
925 |
fillWhite:aRectangle |
|
926 |
"fill a rectangular area on the display with white. |
|
927 |
Added to allow for some squeak examples to be evaluated ..." |
|
928 |
||
929 |
|oldPaint| |
|
930 |
||
931 |
oldPaint := rootView paint. |
|
932 |
rootView clippedByChildren:false. |
|
933 |
rootView paint:Color white. |
|
934 |
rootView fillRectangle:aRectangle. |
|
935 |
rootView clippedByChildren:true. |
|
936 |
rootView paint:oldPaint. |
|
937 |
||
938 |
" |
|
939 |
Display restoreAfter:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
940 |
Display fillWhite:(10@10 corner:100@100) |
1926 | 941 |
] |
942 |
" |
|
943 |
||
944 |
"Modified: 15.10.1997 / 19:28:17 / cg" |
|
945 |
! |
|
946 |
||
947 |
restoreAfter:aBlock |
|
948 |
"evaluate aBlock, wait for a buttonPress, then restore the display. |
|
949 |
Added to allow for some squeak examples to be evaluated ..." |
|
950 |
||
951 |
aBlock value. |
|
952 |
[self anyButtonPressed] whileFalse:[]. |
|
953 |
self restoreWindows. |
|
954 |
||
955 |
" |
|
956 |
Display restoreAfter:[Display fillWhite:(10@10 corner:100@100)] |
|
957 |
" |
|
958 |
||
959 |
"Modified: 15.10.1997 / 19:43:08 / cg" |
|
2790 | 960 |
! |
961 |
||
962 |
supportsDisplayDepth:givenDepth |
|
963 |
"return true, if the given depth is supported by the display. |
|
964 |
(Actually, some displays support multiple depths (i.e. visuals), |
|
965 |
but for now, we want the displays native depth here." |
|
966 |
||
967 |
^ depth == givenDepth |
|
1926 | 968 |
! ! |
969 |
||
2934 | 970 |
!DeviceWorkstation methodsFor:'Signal constants'! |
971 |
||
972 |
deviceErrorSignal |
|
973 |
"return the per-device signal, which is used for error reporting. |
|
974 |
The default here is the global DeviceErrorSignal |
|
975 |
(which is the parent of any per-instance error signals)." |
|
976 |
||
977 |
deviceErrorSignal notNil ifTrue:[^ deviceErrorSignal]. |
|
978 |
^ self class deviceErrorSignal |
|
979 |
! |
|
980 |
||
981 |
deviceIOErrorSignal |
|
982 |
"return the signal used for device I/O error reporting. |
|
983 |
The default here is the global DeviceIOErrorSignal |
|
984 |
(which is the parent of any per-instance I/O error signals)." |
|
985 |
||
986 |
deviceIOErrorSignal notNil ifTrue:[^ deviceIOErrorSignal]. |
|
987 |
^ self class deviceIOErrorSignal |
|
988 |
! |
|
989 |
||
990 |
deviceIOTimeoutErrorSignal |
|
991 |
"return the signal used for device I/O timeout error reporting. |
|
992 |
The default here is the global DeviceIOTimeoutErrorSignal |
|
993 |
(which is the parent of any per-instance I/O timeout signals)." |
|
994 |
||
995 |
^ self class deviceIOTimeoutErrorSignal |
|
996 |
! ! |
|
997 |
||
293 | 998 |
!DeviceWorkstation methodsFor:'accessing & queries'! |
999 |
||
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1000 |
activateOnClick:aBoolean |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1001 |
"enable/disable raise&activate on click; |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1002 |
return the previous setting. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1003 |
This may be left unimplemented by a device." |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1004 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1005 |
^ false |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1006 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1007 |
"Created: / 2.10.1998 / 01:07:51 / cg" |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1008 |
! |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1009 |
|
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1010 |
activeView |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1011 |
^ activeView |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1012 |
! |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1013 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1014 |
buttonMotionMask:aMask includesButton:aButton |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1015 |
"given a device button mask, return true if a logical button |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1016 |
(1 .. 3 for left .. right) is included." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1017 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1018 |
|buttonNr| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1019 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1020 |
"reverse buttonTranslation" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1021 |
buttonTranslation notNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1022 |
buttonNr := buttonTranslation indexOf:aButton ifAbsent:[1]. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1023 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1024 |
buttonNr := aButton. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1025 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1026 |
^ (aMask bitTest:(self buttonMotionMask:buttonNr)) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1027 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1028 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1029 |
dispatchProcess |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1030 |
^ dispatchProcess |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1031 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1032 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1033 |
displayFileDescriptor |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1034 |
"return the file descriptor associated with the display |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1035 |
if any. If there is no underlying filedescriptor, return nil. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1036 |
(used for event select/polling)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1037 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1038 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1039 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1040 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1041 |
id |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1042 |
"return the displayId" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1043 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1044 |
^ displayId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1045 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1046 |
|
1281 | 1047 |
isOpen |
1048 |
"return true, if there is a valid connection to the display. |
|
1049 |
Added for ST-80 compatibility." |
|
1050 |
||
1051 |
^ displayId notNil |
|
1052 |
||
1053 |
"Created: 27.1.1997 / 18:28:30 / cg" |
|
1054 |
! |
|
1055 |
||
2932 | 1056 |
isPersistentInSnapshot |
1057 |
"return true, if resources on this device are to be made |
|
1058 |
persistent in a snapshot image." |
|
1059 |
||
1060 |
^ true |
|
1061 |
! |
|
1062 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1063 |
knownViews |
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
1064 |
"return a (non-weak) collection of all known views" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1065 |
|
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1066 |
|views| |
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1067 |
|
2475 | 1068 |
knownViews size == 0 ifTrue:[^ #()]. |
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1069 |
views := IdentitySet new. |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
1070 |
knownViews validElementsDo:[:v | views add:v]. |
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1071 |
^ views |
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1072 |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
1073 |
"Modified: 23.1.1997 / 21:25:51 / cg" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1074 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1075 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1076 |
knownViews:aCollection |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1077 |
"set the collection of all known views - take care, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1078 |
bad use of this will create funny results; use only for snapshot support" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1079 |
|
2403 | 1080 |
idToTableIndexMapping := nil. |
2181
7b07c4a6cad4
flush idToSlotIndex cache, when changing knownViews
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
1081 |
knownViews := aCollection. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1082 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1083 |
|
2859 | 1084 |
mayOpenDebugger |
1085 |
"return true, if a debugger may open on this workstation; |
|
1086 |
if false, the debugger opens on the main display. |
|
1087 |
This should be made a variable ..." |
|
1088 |
||
1089 |
^ true |
|
1090 |
! |
|
1091 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1092 |
multiClickTimeDelta |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1093 |
^ multiClickTimeDelta |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1094 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1095 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1096 |
multiClickTimeDelta:milliseconds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1097 |
multiClickTimeDelta := milliseconds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1098 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1099 |
|
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1100 |
rootView |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1101 |
"return the rootView (i.e. the background window) on the receiver screen. |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1102 |
It is not guaranteed, that a particular display device supports this." |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1103 |
|
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1104 |
rootView isNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1105 |
rootView := DisplayRootView onDevice:self |
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1106 |
]. |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1107 |
^ rootView |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1108 |
|
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1109 |
" |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1110 |
|v| |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1111 |
v := Display rootView. |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1112 |
v paint:Color red. |
1722 | 1113 |
v clippedByChildren:false. |
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1114 |
v fillRectangleX:10 y:10 width:100 height:100. |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1115 |
" |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1116 |
! |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1117 |
|
2885 | 1118 |
suppressDebugger |
1119 |
"return true, if no debugger should be opened for applications running |
|
1120 |
on this device (i.e. neither a debugger on the device nor on the |
|
1121 |
main screen).m |
|
1122 |
If true, the debugger is either opened on the device or on the |
|
1123 |
main display, depending on the mayOpenDebugger setting." |
|
1124 |
||
1125 |
^ false |
|
1126 |
! |
|
1127 |
||
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1128 |
suppressShadowViews |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1129 |
"return true, if this device wants to suppress shadow views |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1130 |
(i.e. shadows under popups and modalBoxes). |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1131 |
Some (slow) devices may want to return true here" |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1132 |
|
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1133 |
^ false |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1134 |
! |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1135 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1136 |
translatePoint:aPoint from:windowId1 to:windowId2 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1137 |
"given a point in window1 (defined by its id), return the coordinate of |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1138 |
aPoint in window2 (defined by its id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1139 |
Use to xlate points from a window to rootwindow, mainly for rubber-line |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1140 |
drawing on the displays root window." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1141 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1142 |
"This method has to be reimplemented in concrete display classes." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1143 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1144 |
^ self subclassResponsibility |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1145 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1146 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1147 |
|v p root| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1148 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1149 |
v := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1150 |
v openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1151 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1152 |
root := v device rootView. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1153 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1154 |
p := v device translatePoint:10@10 from:(v id) to:(root id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1155 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1156 |
root clippedByChildren:false. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1157 |
root displayLineFrom:0@0 to:p. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1158 |
root clippedByChildren:true. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1159 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1160 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1161 |
|v1 v2 p1 p2 root| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1162 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1163 |
v1 := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1164 |
v1 openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1165 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1166 |
v2 := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1167 |
v2 openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1168 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1169 |
root := v1 device rootView. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1170 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1171 |
p1 := v1 device translatePoint:10@10 from:(v1 id) to:(root id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1172 |
p2 := v1 device translatePoint:10@10 from:(v2 id) to:(root id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1173 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1174 |
root clippedByChildren:false. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1175 |
root displayLineFrom:p1 to:p2. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1176 |
root clippedByChildren:true. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1177 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1178 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1179 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1180 |
viewFromPoint:aPoint |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1181 |
"given a point on the screen, return the ST/X view in which that |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1182 |
point is (this may be a subview). Return nil, if its not an ST/X view |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1183 |
or if the point is on the background" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1184 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1185 |
|view id| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1186 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1187 |
id := self viewIdFromPoint:aPoint. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1188 |
view := self viewFromId:id. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1189 |
^ view |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1190 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1191 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1192 |
viewIdFromPoint:aPoint |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1193 |
"given a point on the screen, return the id of the ST/X view in which that |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1194 |
point is (this may be a subview). Return nil, if its not an ST/X view |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1195 |
or if the point is on the background" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1196 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1197 |
|id searchId foundId| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1198 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1199 |
searchId := self rootWindowId. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1200 |
[searchId notNil] whileTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1201 |
id := self viewIdFromPoint:aPoint in:searchId. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1202 |
foundId := searchId. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1203 |
searchId := id |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1204 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1205 |
^ foundId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1206 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1207 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1208 |
viewIdFromPoint:aPoint in:windowId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1209 |
"given a point in rootWindow, return the viewId of the subview of windowId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1210 |
hit by this coordinate. Return nil if no view was hit. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1211 |
- use to find window to drop objects after a cross-view drag" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1212 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1213 |
"returning nil here actually makes drag&drop impossible |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1214 |
- could also be reimplemented to make a search over all knownViews here. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1215 |
This method has to be reimplemented in concrete display classes." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1216 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1217 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1218 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1219 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1220 |
windowAt:aPoint |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1221 |
"given a point on the screen, return the ST/X topview in which that |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1222 |
point is. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1223 |
Return nil, if its not an ST/X view or if the point is on the background. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1224 |
Alias for viewFromPoint: - ST-80 compatibility" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1225 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1226 |
^ self viewFromPoint:aPoint |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1227 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1228 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1229 |
!DeviceWorkstation methodsFor:'accessing display attributes'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1230 |
|
293 | 1231 |
bitsBlue |
1602 | 1232 |
"return the number of valid bits in the blue component." |
293 | 1233 |
|
1234 |
bitsBlue isNil ifTrue:[ |
|
1675 | 1235 |
"/ not a truecolor display |
1236 |
^ bitsPerRGB |
|
293 | 1237 |
]. |
1238 |
^ bitsBlue |
|
1239 |
||
1240 |
" |
|
1241 |
Display bitsBlue |
|
1242 |
" |
|
1243 |
||
1244 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
1602 | 1245 |
"Modified: 16.4.1997 / 15:00:53 / cg" |
293 | 1246 |
! |
1247 |
||
1248 |
bitsGreen |
|
1602 | 1249 |
"return the number of valid bits in the green component." |
293 | 1250 |
|
1251 |
bitsGreen isNil ifTrue:[ |
|
1675 | 1252 |
"/ not a truecolor display |
1253 |
^ bitsPerRGB |
|
293 | 1254 |
]. |
1255 |
^ bitsGreen |
|
1256 |
||
1257 |
" |
|
1258 |
Display bitsGreen |
|
1259 |
" |
|
1260 |
||
1261 |
"Created: 21.10.1995 / 00:45:11 / cg" |
|
1602 | 1262 |
"Modified: 16.4.1997 / 15:01:02 / cg" |
293 | 1263 |
! |
1264 |
||
1265 |
bitsPerRGB |
|
1266 |
"return the number of valid bits per rgb component; |
|
1267 |
Currently, assume that r/g/b all have the same precision, |
|
1268 |
which is a stupid assumption (there may be some, where less |
|
1269 |
resolution is available in the blue component). |
|
1270 |
Therefore, this may be changed to return a 3-element vector. |
|
1271 |
In the meantime, use bitsRed/bitsGreen/bitsBlue to get this information." |
|
1272 |
||
1273 |
^ bitsPerRGB |
|
1274 |
||
1275 |
" |
|
1276 |
Display bitsPerRGB |
|
1277 |
" |
|
1278 |
||
1279 |
"Modified: 21.10.1995 / 00:46:27 / cg" |
|
1280 |
! |
|
1281 |
||
1282 |
bitsRed |
|
1283 |
"return the number of valid bits in the red component." |
|
1284 |
||
1285 |
bitsRed isNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1286 |
"/ not a truecolor display |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1287 |
^ bitsPerRGB |
293 | 1288 |
]. |
1289 |
^ bitsRed |
|
1290 |
||
1291 |
" |
|
1292 |
Display bitsRed |
|
1293 |
" |
|
1294 |
||
1295 |
"Created: 21.10.1995 / 00:44:55 / cg" |
|
1296 |
! |
|
1297 |
||
1197 | 1298 |
blackColor |
1299 |
"return the black color on this device. |
|
1300 |
This is the same as 'Color black on:device', but much faster." |
|
1301 |
||
1302 |
^ blackColor |
|
1303 |
||
1304 |
"Created: 13.1.1997 / 22:37:05 / cg" |
|
1305 |
"Modified: 13.1.1997 / 22:43:19 / cg" |
|
1306 |
! |
|
1307 |
||
293 | 1308 |
blackpixel |
1309 |
"return the colorId of black" |
|
1310 |
||
2853 | 1311 |
visualType == #TrueColor ifTrue:[^ 0]. |
1312 |
||
293 | 1313 |
^ self subclassResponsibility |
1314 |
! |
|
1315 |
||
996 | 1316 |
blueMask |
1317 |
"return a mask, which extracts the blueBits from a color id. |
|
1318 |
This only makes sense with trueColor displays; |
|
1319 |
therefore, 0 is returned on all others." |
|
1320 |
||
1321 |
^ blueMask |
|
1322 |
||
1323 |
" |
|
1324 |
Display blueMask |
|
1325 |
" |
|
1326 |
||
1327 |
"Modified: 21.10.1995 / 00:47:58 / cg" |
|
1328 |
"Created: 24.7.1996 / 13:25:21 / cg" |
|
1329 |
! |
|
1330 |
||
293 | 1331 |
depth |
1332 |
"return the depth in pixels of the display" |
|
1333 |
||
1334 |
^ depth |
|
1335 |
||
1336 |
" |
|
1337 |
Display depth |
|
1338 |
" |
|
1339 |
! |
|
1340 |
||
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1341 |
focusMode |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1342 |
^ focusMode |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1343 |
! |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1344 |
|
996 | 1345 |
greenMask |
1346 |
"return a mask, which extracts the greenBits from a color id. |
|
1347 |
This only makes sense with trueColor displays; |
|
1348 |
therefore, 0 is returned on all others." |
|
1349 |
||
1350 |
^ greenMask |
|
1351 |
||
1352 |
" |
|
1353 |
Display greenMask |
|
1354 |
" |
|
1355 |
||
1356 |
"Modified: 21.10.1995 / 00:47:58 / cg" |
|
1357 |
"Created: 24.7.1996 / 13:25:15 / cg" |
|
1358 |
! |
|
1359 |
||
293 | 1360 |
hasColors |
1361 |
"return true, if its a color display" |
|
1362 |
||
1363 |
^ hasColors |
|
1364 |
||
1365 |
" |
|
1366 |
Display hasColors |
|
1367 |
" |
|
1368 |
! |
|
1369 |
||
631 | 1370 |
hasGrayscales |
1371 |
"return true, if this workstation supports grayscales |
|
1372 |
(also true for color displays)" |
|
1373 |
||
1374 |
^ hasGreyscales |
|
1375 |
||
1376 |
" |
|
1377 |
Display hasGrayscales |
|
1378 |
" |
|
1379 |
||
1380 |
"Created: 2.5.1996 / 11:49:07 / cg" |
|
1381 |
! |
|
1382 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1383 |
hasGreyscales |
631 | 1384 |
"OBSOLETE english version; please use #hasGrayScales. |
1385 |
Return true, if this workstation supports greyscales |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1386 |
(also true for color displays)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1387 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1388 |
^ hasGreyscales |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1389 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1390 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1391 |
Display hasGreyscales |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1392 |
" |
631 | 1393 |
|
1394 |
"Modified: 2.5.1996 / 11:51:03 / cg" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1395 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1396 |
|
996 | 1397 |
redMask |
1398 |
"return a mask, which extracts the redBits from a color id. |
|
1399 |
This only makes sense with trueColor displays; |
|
1400 |
therefore, 0 is returned on all others." |
|
1401 |
||
1402 |
^ redMask |
|
1403 |
||
1404 |
" |
|
1405 |
Display redMask |
|
1406 |
" |
|
1407 |
||
1408 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
1409 |
"Modified: 24.7.1996 / 13:25:08 / cg" |
|
1410 |
! |
|
1411 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1412 |
shiftBlue |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1413 |
"return the count by which the blue bits are to be shifted |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1414 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1415 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1416 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1417 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1418 |
^ blueShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1419 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1420 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1421 |
Display shiftBlue |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1422 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1423 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1424 |
"Created: 21.10.1995 / 00:45:27 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1425 |
"Modified: 21.10.1995 / 00:47:58 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1426 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1427 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1428 |
shiftGreen |
1602 | 1429 |
"return the count by which the green bits are to be shifted |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1430 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1431 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1432 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1433 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1434 |
^ greenShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1435 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1436 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1437 |
Display shiftGreen |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1438 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1439 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1440 |
"Created: 21.10.1995 / 00:45:27 / cg" |
1602 | 1441 |
"Modified: 16.4.1997 / 15:02:37 / cg" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1442 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1443 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1444 |
shiftRed |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1445 |
"return the count by which the red bits are to be shifted |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1446 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1447 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1448 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1449 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1450 |
^ redShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1451 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1452 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1453 |
Display shiftRed |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1454 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1455 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1456 |
"Created: 21.10.1995 / 00:45:27 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1457 |
"Modified: 21.10.1995 / 00:48:10 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1458 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1459 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1460 |
visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1461 |
"return a symbol representing the visual type of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1462 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1463 |
^ visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1464 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1465 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1466 |
Display visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1467 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1468 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1469 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1470 |
visualType:aSymbol |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1471 |
"set the visual type. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1472 |
The only situation, where setting the visual makes sense, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1473 |
is with my plasma-display, which ignores the palette and spits out |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1474 |
grey scales, independent of color LUT definitions. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1475 |
(of which the server knows nothing). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1476 |
So, this should be used from a display-specific startup file only." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1477 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1478 |
visualType := aSymbol. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1479 |
(visualType == #StaticGray or:[visualType == #GrayScale]) ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1480 |
hasColors := false |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1481 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1482 |
hasColors := true |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1483 |
] |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1484 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1485 |
|
1197 | 1486 |
whiteColor |
1487 |
"return the white color on this device. |
|
1488 |
This is the same as 'Color white on:device', but much faster." |
|
1489 |
||
1490 |
^ whiteColor |
|
1491 |
||
1492 |
"Created: 13.1.1997 / 22:37:10 / cg" |
|
1493 |
"Modified: 13.1.1997 / 22:43:04 / cg" |
|
1494 |
! |
|
1495 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1496 |
whitepixel |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1497 |
"return the colorId of white" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1498 |
|
2853 | 1499 |
visualType == #TrueColor ifTrue:[^ (1 bitShift:depth)-1]. |
1500 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1501 |
^ self subclassResponsibility |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1502 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1503 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1504 |
!DeviceWorkstation methodsFor:'accessing display capabilities'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1505 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1506 |
hasColors:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1507 |
"set the hasColors flag - needed since some servers dont tell the |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1508 |
truth if a monochrome monitor is connected to a color server. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1509 |
Clearing the hasColors flag in the rc file will force use of grey |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1510 |
colors (which might make a difference, since some colors are hard to |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1511 |
distinguish on a greyscale monitor)." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1512 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1513 |
hasColors := aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1514 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1515 |
|
293 | 1516 |
hasDPS |
1517 |
"return true, if this workstation supports postscript output into views. |
|
1518 |
Should be reimplemented in concrete classes which do support this." |
|
1519 |
||
1520 |
^ false |
|
1521 |
||
1522 |
" |
|
1523 |
Display hasDPS |
|
1524 |
" |
|
1525 |
! |
|
1526 |
||
1527 |
hasExtension:extensionString |
|
1528 |
"query for an X extension. The method here is provide for XWorkstation |
|
1529 |
protocol compatibility only." |
|
1530 |
||
1531 |
^ false |
|
1532 |
||
1533 |
" |
|
1534 |
Display hasExtension:'XVideo' |
|
1535 |
Display hasExtension:'Input' |
|
1536 |
Display hasExtension:'GLX' |
|
1537 |
Display hasExtension:'X3D-PEX' |
|
1538 |
Display hasExtension:'XInputExtension' |
|
1539 |
Display hasExtension:'SHAPE' |
|
1540 |
Display hasExtension:'MIT-SHM' |
|
1541 |
Display hasExtension:'SGIFullScreenStereo' |
|
1542 |
" |
|
1543 |
! |
|
1544 |
||
631 | 1545 |
hasGrayscales:aBoolean |
1546 |
"set the hasGrayscales flag - can be used to simulate b&w behavior |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1547 |
on greyScale and color monitors. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1548 |
(You may want to check if your application looks ok if displayed on |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1549 |
a b&w monitor - even if you have a color display. To do so, clear |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1550 |
the hasGreyscales flag from your .rc file)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1551 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1552 |
hasGreyscales := aBoolean |
631 | 1553 |
|
1554 |
"Created: 2.5.1996 / 11:50:04 / cg" |
|
1555 |
! |
|
1556 |
||
1557 |
hasGreyscales:aBoolean |
|
1558 |
"OBSOLETE english version - please use #hasGrayscales: |
|
1559 |
Set the hasGreyscales flag - can be used to simulate b&w behavior |
|
1560 |
on greyScale and color monitors. |
|
1561 |
(You may want to check if your application looks ok if displayed on |
|
1562 |
a b&w monitor - even if you have a color display. To do so, clear |
|
1563 |
the hasGreyscales flag from your .rc file)" |
|
1564 |
||
1565 |
hasGreyscales := aBoolean |
|
1566 |
||
1567 |
"Modified: 2.5.1996 / 11:50:48 / cg" |
|
293 | 1568 |
! |
1569 |
||
1570 |
hasImageExtension |
|
1571 |
"return true, if this workstation supports the X Image extension" |
|
1572 |
||
1573 |
^ false |
|
1574 |
||
1575 |
" |
|
1576 |
Display hasImageExtension |
|
1577 |
" |
|
1578 |
! |
|
1579 |
||
1580 |
hasInputExtension |
|
1581 |
"return true, if this workstation supports the X Input extension" |
|
1582 |
||
1583 |
^ false |
|
1584 |
||
1585 |
" |
|
1586 |
Display hasInputExtension |
|
1587 |
" |
|
1588 |
! |
|
1589 |
||
1590 |
hasMultibuffer |
|
1591 |
"return true, if this workstation supports the X multibuffer extension" |
|
1592 |
||
1593 |
^ false |
|
1594 |
||
1595 |
" |
|
1596 |
Display hasMultibuffer |
|
1597 |
" |
|
1598 |
! |
|
1599 |
||
1600 |
hasPEX |
|
1601 |
"return true, if this workstation supports PEX graphics. |
|
1602 |
Should be reimplemented in concrete classes which do support this." |
|
1603 |
||
1604 |
^ false |
|
1605 |
||
1606 |
" |
|
1607 |
Display hasPEX |
|
1608 |
" |
|
1609 |
! |
|
1610 |
||
1611 |
hasShape |
|
2744
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1612 |
"return true, if this workstation supports arbitrary shaped windows. |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1613 |
This is obsolete - use #supportsArbitraryShapedViews." |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1614 |
|
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1615 |
^ self supportsArbitraryShapedViews |
293 | 1616 |
|
1617 |
" |
|
1618 |
Display hasShape |
|
1619 |
" |
|
1620 |
! |
|
1621 |
||
1622 |
hasShm |
|
1623 |
"return true, if this workstation supports shared memory pixmaps. |
|
1624 |
Should be reimplemented in concrete classes which do support this." |
|
1625 |
||
1626 |
^ false |
|
1627 |
||
1628 |
" |
|
1629 |
Display hasShm |
|
1630 |
" |
|
1631 |
! |
|
1632 |
||
1633 |
hasStereoExtension |
|
1634 |
"return true, if this workstation supports stereo GL drawing. |
|
1635 |
Both the server must support it, and the feature must have been |
|
1636 |
enabled in the smalltalk system, for true to be returned." |
|
1637 |
||
1638 |
^ false |
|
1639 |
||
1640 |
" |
|
1641 |
Display hasStereoExtension |
|
1642 |
" |
|
1643 |
! |
|
1644 |
||
1645 |
hasXVideo |
|
1646 |
"return true, if this workstation supports the XVideo extension" |
|
1647 |
||
1648 |
^ false |
|
1649 |
||
1650 |
" |
|
1651 |
Display hasXVideo |
|
1652 |
" |
|
1653 |
! |
|
1654 |
||
340 | 1655 |
iconSizes |
690 | 1656 |
"Get the supported icon sizes. These are typically set by the window manager. |
340 | 1657 |
We return nil here (as if there are no special size preferences)." |
1658 |
||
1659 |
^ nil |
|
1660 |
||
1661 |
"Created: 2.1.1996 / 15:08:16 / cg" |
|
690 | 1662 |
"Modified: 7.5.1996 / 10:43:38 / cg" |
340 | 1663 |
! |
1664 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1665 |
ignoreBackingStore:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1666 |
"if the argument is true, the views backingStore setting will be ignored, and |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1667 |
no backing store used - this can be used on servers where backing store is |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1668 |
very slow (from rc-file)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1669 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1670 |
^ self |
293 | 1671 |
! |
1672 |
||
1673 |
isSlow |
|
1674 |
"return true, if this is a relatively slow device - |
|
1675 |
used to turn off things like popup-shadows" |
|
1676 |
||
1677 |
^ isSlow |
|
1678 |
! |
|
1679 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1680 |
isSlow:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1681 |
"set/clear the slow flag. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1682 |
The slow-flag has no semantic meaning by itself; |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1683 |
however, it can be set via the display.rc file and tested at various |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1684 |
other places to turn off some bells&whistles which might slow down |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1685 |
the drawing. For example, shadows under popUps are suppressed if isSlow |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1686 |
is set." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1687 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1688 |
isSlow := aBoolean |
293 | 1689 |
! |
1690 |
||
1691 |
monitorType |
|
1692 |
"return a symbol representing the monitor type of the display. |
|
1693 |
It is usually set to #unknown, #color or #monochrome. |
|
1694 |
But it can be set to any value from the startup file, for later |
|
1695 |
testing from anywhere. For example the startup for plasma-displays |
|
1696 |
can set it to #plasma to later influence the colors used in widgets |
|
1697 |
(indirectly through the resource file)." |
|
1698 |
||
1699 |
^ monitorType |
|
1700 |
||
1701 |
" |
|
1702 |
Display monitorType |
|
1703 |
" |
|
1704 |
! |
|
1705 |
||
1706 |
monitorType:aSymbol |
|
1707 |
"set the monitorType - see comment in DeviceWorkstation>>montorType" |
|
1708 |
||
1709 |
monitorType := aSymbol |
|
1710 |
! |
|
1711 |
||
1712 |
ncells |
|
1713 |
"return the number of usable color cells, the display has |
|
1714 |
- this is not always 2 to the power of depth |
|
1715 |
(for example, on 6bit displays, ncells is 64 while depth is 8)" |
|
1716 |
||
1717 |
^ ncells |
|
1718 |
||
1719 |
" |
|
1720 |
Display ncells |
|
1721 |
" |
|
1722 |
! |
|
1723 |
||
689 | 1724 |
preferredIconSize |
1725 |
"Get the preferrered icon size. These are typically set by the window manager. |
|
1726 |
We return nil here (as if there are no special size preferences)." |
|
1727 |
||
827 | 1728 |
|sizes spec sz sz2| |
820 | 1729 |
|
821 | 1730 |
preferredIconSize isNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1731 |
sizes := self iconSizes. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1732 |
sizes notNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1733 |
spec := sizes first. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1734 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1735 |
"/ we prefer square icons ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1736 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1737 |
sz := (spec at:#maxWidth) min: (spec at:#maxHeight). |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1738 |
sz > 64 ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1739 |
sz2 := (spec at:#minWidth) max: (spec at:#minHeight). |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1740 |
sz2 <= 48 ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1741 |
sz := 48 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1742 |
] |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1743 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1744 |
preferredIconSize := sz @ sz |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1745 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1746 |
preferredIconSize isNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1747 |
preferredIconSize := 48@48 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
1748 |
]. |
820 | 1749 |
]. |
821 | 1750 |
|
1751 |
^ preferredIconSize |
|
689 | 1752 |
|
820 | 1753 |
" |
1754 |
Display preferredIconSize |
|
821 | 1755 |
Display preferredIconSize:32@32 |
827 | 1756 |
Display preferredIconSize:nil |
820 | 1757 |
" |
1758 |
||
827 | 1759 |
"Modified: 10.6.1996 / 22:10:58 / cg" |
821 | 1760 |
! |
1761 |
||
1762 |
preferredIconSize:anExtentPoint |
|
1763 |
"set the preferrered icon size. |
|
1764 |
By default, the preferredIconSize is queried from the display, |
|
1765 |
however, some windowManagers return stupid values. |
|
1766 |
This methods allows overriding thngs from a startup file" |
|
1767 |
||
1768 |
preferredIconSize := anExtentPoint |
|
1769 |
||
1770 |
" |
|
1771 |
Display preferredIconSize |
|
1772 |
Display preferredIconSize:32@32 |
|
1773 |
Display preferredIconSize:48@48 |
|
1774 |
" |
|
1775 |
||
1776 |
"Modified: 10.6.1996 / 21:01:50 / cg" |
|
689 | 1777 |
! |
1778 |
||
1024 | 1779 |
scrollsAsynchronous |
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
1780 |
"return true, if this display asynchronously sends expose events after a |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
1781 |
scroll operation. False otherwise. Asynchronous expose events are an X |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
1782 |
speciality, which affects a few methods outside of the display class (sorry)" |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
1783 |
|
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
1784 |
^ false |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
1785 |
! |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
1786 |
|
2536 | 1787 |
supportedImageFormatForDepth:aDepth |
1788 |
"given a depth, return the devices image format info, |
|
1789 |
which provides padding info. If the given depth is not |
|
1790 |
supported, return nil." |
|
1791 |
||
1792 |
self supportedImageFormats do:[:fmt | |
|
1793 |
(fmt at:#depth) == aDepth ifTrue:[ |
|
1794 |
^fmt |
|
1795 |
] |
|
1796 |
]. |
|
1797 |
^ nil |
|
1798 |
! |
|
1799 |
||
293 | 1800 |
supportedImageFormats |
1801 |
"return an array with supported image formats; each array entry |
|
1802 |
is another array, consisting of depth and bitsPerPixel values. |
|
1803 |
Here, we return a single format only; every graphics device must |
|
1804 |
support b&w single bit images." |
|
1805 |
||
1806 |
|info| |
|
1807 |
||
1808 |
info := IdentityDictionary new. |
|
1809 |
info at:#depth put:1. |
|
1810 |
info at:#bitsPerPixel put:1. |
|
1811 |
info at:#padding put:32. |
|
1812 |
^ Array with:info |
|
1813 |
! |
|
1814 |
||
2634 | 1815 |
supportsAnyViewBackgroundPixmaps |
1816 |
"return true, if the device allows any pixmap as |
|
1817 |
viewBackground. False returned here - redefined in some |
|
1818 |
device classes." |
|
1819 |
||
1820 |
^ false |
|
1821 |
||
1822 |
"Created: / 4.5.1999 / 18:41:01 / cg" |
|
1823 |
! |
|
1824 |
||
2744
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1825 |
supportsArbitraryShapedViews |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1826 |
"return true, if this workstation supports arbitrary shaped |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1827 |
windows. |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1828 |
Should be reimplemented in concrete classes which do support this." |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1829 |
|
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1830 |
^ false |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1831 |
|
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1832 |
" |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1833 |
Display supportsArbitraryShapedViews |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1834 |
" |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1835 |
! |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
1836 |
|
293 | 1837 |
supportsDeepIcons |
1838 |
"return true, if this device supports non b&w (i.e. greyScale |
|
817 | 1839 |
or colored icons). Many Xservers (and/or windowManagers) crash, |
1840 |
if you pass them a deep form as icon; therefore, the default is false. |
|
1841 |
It may be a good idea to check for the server vendor/release and |
|
1842 |
return true sometimes. |
|
1843 |
This flag can be set with #supportsDeepIcons:" |
|
1844 |
||
1845 |
^ supportsDeepIcons |
|
1846 |
||
1847 |
" |
|
1848 |
Display supportsDeepIcons:true |
|
1849 |
||
1850 |
|v| |
|
1851 |
||
1852 |
v := StandardSystemView new. |
|
1853 |
v icon:((Image fromFile:'bitmaps/claus.gif') magnifiedTo:68@68). |
|
1854 |
v open. |
|
1855 |
" |
|
1856 |
||
1857 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
1858 |
! |
|
1859 |
||
1860 |
supportsDeepIcons:yesOrNo |
|
1861 |
"set/clear the supportsDeepIcons flag. |
|
1862 |
Many Xservers (and/or windowManagers) crash, |
|
1863 |
if you pass them a deep form as icon; therefore, the default is false." |
|
1864 |
||
1865 |
supportsDeepIcons := yesOrNo |
|
293 | 1866 |
|
1867 |
" |
|
1868 |
Display supportsDeepIcons |
|
1869 |
" |
|
817 | 1870 |
|
1871 |
"Created: 10.6.1996 / 19:36:19 / cg" |
|
293 | 1872 |
! |
1873 |
||
1874 |
supportsGLDrawing |
|
1875 |
"return true, if this device supports 3D GL drawing. |
|
1876 |
We do not depend on that being implemented." |
|
1877 |
||
1957 | 1878 |
"This method should be reimplemented in concrete display classes." |
293 | 1879 |
^ false |
1880 |
||
1881 |
" |
|
1882 |
Display supportsGLDrawing |
|
1883 |
" |
|
1884 |
! |
|
1885 |
||
2603 | 1886 |
supportsIconMasks |
1887 |
"return true, if this device supports masked icons. |
|
1888 |
Assume true here - to be redefined in concrete classes." |
|
1889 |
||
1890 |
^ true |
|
1891 |
||
1892 |
" |
|
1893 |
Display supportsIconMasks |
|
1894 |
" |
|
1895 |
||
1896 |
"Modified: / 28.4.1999 / 19:58:12 / cg" |
|
1897 |
! |
|
1898 |
||
824 | 1899 |
supportsIconViews |
1900 |
"return true, if this device supports views as icons. |
|
1901 |
Only Xservers (currently) support this." |
|
1902 |
||
1903 |
^ false |
|
1904 |
||
1905 |
" |
|
1906 |
Display supportsIconViews |
|
1907 |
" |
|
1908 |
||
1909 |
"Modified: 10.6.1996 / 21:08:04 / cg" |
|
1910 |
! |
|
1911 |
||
2631
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
1912 |
supportsMaskedDrawingWith:aForm |
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
1913 |
"return true, if the device allows the given form pixmap |
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
1914 |
to be used as paint color. |
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
1915 |
False returned here, which forces higher level code to |
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
1916 |
perform the filling manually (by copying the form) |
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
1917 |
- redefined in most device classes." |
2332
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
1918 |
|
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
1919 |
^ false |
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
1920 |
|
2631
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
1921 |
"Created: / 4.5.1999 / 12:16:18 / cg" |
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
1922 |
"Modified: / 4.5.1999 / 12:58:04 / cg" |
2332
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
1923 |
! |
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
1924 |
|
2749
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1925 |
supportsRoundShapedViews |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1926 |
"return true, if this workstation supports round shaped |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1927 |
(elliptical & circular) windows. |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1928 |
Should be reimplemented in concrete classes which do support this." |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1929 |
|
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1930 |
^ false |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1931 |
|
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1932 |
" |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1933 |
Display supportsRoundShapedViews |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1934 |
" |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1935 |
! |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1936 |
|
2634 | 1937 |
supportsViewBackgroundPixmap:aForm |
1938 |
"return true, if the device allows the given pixmap as |
|
1939 |
viewBackground. If false is returned, |
|
1940 |
drawing is done by (possibly) slower smalltalk code. |
|
1941 |
False returned here - redefined in some concrete device classes." |
|
2324
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
1942 |
|
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
1943 |
^ false |
2634 | 1944 |
|
1945 |
"Created: / 4.5.1999 / 18:40:25 / cg" |
|
1946 |
"Modified: / 4.5.1999 / 18:44:41 / cg" |
|
2324
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
1947 |
! |
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
1948 |
|
293 | 1949 |
supportsViewGravity |
1950 |
"return true, if this device supports gravity attributes. |
|
1951 |
We do not depend on the being implemented, but some resizing operations |
|
1952 |
are faster, it is is." |
|
1953 |
||
1954 |
"This method should to be reimplemented in concrete display classes." |
|
1955 |
^ false |
|
1956 |
||
1957 |
" |
|
1958 |
Display supportsViewGravity |
|
1959 |
" |
|
2906
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1960 |
! |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1961 |
|
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1962 |
supportsWindowBorder:aNumber |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1963 |
"return true, if this device supports bordered windows. |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1964 |
RIght now, some drawing stuff depends on (at least) a border of 1 pixel |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1965 |
to be supported by the device. |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1966 |
ST/X's views are being rewritten to draw the border manually in the |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1967 |
future." |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1968 |
|
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1969 |
^ true |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1970 |
|
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1971 |
" |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1972 |
Display supportsWindowBorder:1 |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
1973 |
" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1974 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1975 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1976 |
!DeviceWorkstation methodsFor:'accessing display geometry'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1977 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1978 |
boundingBox |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1979 |
"return a rectangle representing the displays bounding box. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1980 |
For Smalltalk-80 2.x compatibility" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1981 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1982 |
^ self bounds |
293 | 1983 |
! |
1984 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1985 |
bounds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1986 |
"return a rectangle representing the displays bounding box. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1987 |
For Smalltalk-80 4.x compatibility" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1988 |
|
656 | 1989 |
^ Rectangle left:0 top:0 width:width-1 height:height-1 |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1990 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1991 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1992 |
Screen default bounds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1993 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1994 |
"/ thats the same as: |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1995 |
" |
656 | 1996 |
Display bounds |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1997 |
" |
656 | 1998 |
|
1999 |
"Modified: 8.5.1996 / 20:58:26 / cg" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2000 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2001 |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2002 |
captionHeight |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2003 |
"return the height in pixels of the caption |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2004 |
(i.e. title bar) of topWindows. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2005 |
Fallback of 0 (i.e. unknown) is returned here. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2006 |
Applications should not depend on that returned value |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2007 |
to be exact - on some systems (windowManagers), |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2008 |
its value cannot be retrieved" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2009 |
|
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2010 |
^ 0 |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2011 |
! |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2012 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2013 |
center |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2014 |
"return the centerpoint in pixels of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2015 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2016 |
^ (width // 2) @ (height // 2) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2017 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2018 |
|
783
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2019 |
drawingResolution |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2020 |
"return a point consisting of the actual drawing resolution |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2021 |
in pixel-per-inch horizontally and vertically. |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2022 |
On screen devices, this is the same as resolution; on postscript |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2023 |
devices, this is usually higher than the coordinate systems unit. |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2024 |
This method is provided for compatibility with postscript media, |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2025 |
to query the device if sub-pixel-coordinate drawing is possible. |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2026 |
(there are a few situations, in which resolution-independ drawing |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2027 |
leads to ugly looking output ... knowing about subPixel resolution |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2028 |
may help there.)" |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2029 |
|
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2030 |
^ self resolution |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2031 |
|
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2032 |
"Created: 4.6.1996 / 15:20:43 / cg" |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2033 |
"Modified: 4.6.1996 / 17:56:26 / cg" |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2034 |
! |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2035 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2036 |
extent |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2037 |
"return the extent of the display (in pixels)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2038 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2039 |
^ width @ height |
293 | 2040 |
|
2041 |
" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2042 |
Display extent |
293 | 2043 |
" |
2044 |
! |
|
2045 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2046 |
height |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2047 |
"return the height of the display (in pixels)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2048 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2049 |
^ height |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2050 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2051 |
"Display height" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2052 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2053 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2054 |
heightInMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2055 |
"return the height in millimeter of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2056 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2057 |
^ heightMM |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2058 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2059 |
"Display heightInMillimeter" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2060 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2061 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2062 |
heightInMillimeter:aNumber |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2063 |
"set the height in millimeter of the display |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2064 |
- needed since some displays do not tell the truth or do not know it" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2065 |
|
1044 | 2066 |
aNumber > 0 ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2067 |
heightMM := aNumber. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2068 |
resolutionVer := nil. |
1044 | 2069 |
] |
2070 |
||
2071 |
"Modified: 10.9.1996 / 14:25:39 / cg" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2072 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2073 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2074 |
horizontalPixelPerInch |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2075 |
"return the number of horizontal pixels per inch of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2076 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2077 |
^ (width / widthMM) * 25.4 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2078 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2079 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2080 |
horizontalPixelPerMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2081 |
"return the number of horizontal pixels per millimeter of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2082 |
|
999 | 2083 |
resolutionHor notNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2084 |
^ resolutionHor |
999 | 2085 |
]. |
1000 | 2086 |
resolutionHor := (width / widthMM) asFloat. |
999 | 2087 |
^ resolutionHor |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2088 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2089 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2090 |
pixelPerInch |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2091 |
"return the number of horizontal/vertical pixels per inch of the display as Point" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2092 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2093 |
^ ((width / widthMM) @ (height / heightMM)) * 25.4 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2094 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2095 |
"Display pixelPerInch" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2096 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2097 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2098 |
pixelPerMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2099 |
"return the number of horizontal/vertical pixels per millimeter of the display as Point" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2100 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2101 |
^ (width / widthMM) @ (height / heightMM) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2102 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2103 |
"Display pixelPerMillimeter" |
293 | 2104 |
! |
2105 |
||
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2106 |
resolution |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2107 |
"return a point consisting of pixel-per-inch horizontally and vertically. |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2108 |
This is an ST-80 compatibility method" |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2109 |
|
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2110 |
^ self pixelPerInch |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2111 |
! |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2112 |
|
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2113 |
usableExtent |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2114 |
"return the usable extent of the display (in pixels). |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2115 |
Normally, the same as extent, but may be smaller, in |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2116 |
case some menu space is taken up by the window manager (windows)" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2117 |
|
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2118 |
^ width @ height |
1844 | 2119 |
|
2120 |
" |
|
2121 |
Display extent |
|
2122 |
Display usableExtent |
|
2123 |
" |
|
2124 |
||
2125 |
"Modified: 4.8.1997 / 01:40:14 / cg" |
|
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2126 |
! |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2127 |
|
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2128 |
usableHeight |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2129 |
"returns the usable height of the display (in pixels) |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2130 |
Normally, the same as height, but may be smaller, in |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2131 |
case some menu space is taken up by the window manager (windows)" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2132 |
|
1708 | 2133 |
^ self usableExtent y |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2134 |
! |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2135 |
|
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2136 |
usableWidth |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2137 |
"returns the usable width of the display (in pixels) |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2138 |
Normally, the same as width, but may be smaller, in |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2139 |
case some menu space is taken up by the window manager (windows)" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2140 |
|
1708 | 2141 |
^ self usableExtent x |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2142 |
! |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2143 |
|
293 | 2144 |
verticalPixelPerInch |
2145 |
"return the number of vertical pixels per inch of the display" |
|
2146 |
||
2147 |
^ (height / heightMM) * 25.4 |
|
2148 |
! |
|
2149 |
||
2150 |
verticalPixelPerMillimeter |
|
2151 |
"return the number of vertical pixels per millimeter of the display" |
|
2152 |
||
999 | 2153 |
resolutionVer notNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2154 |
^ resolutionVer |
999 | 2155 |
]. |
1000 | 2156 |
resolutionVer := (height / heightMM) asFloat. |
999 | 2157 |
^ resolutionVer |
293 | 2158 |
! |
2159 |
||
2160 |
virtualExtent |
|
2161 |
"return the virtual extent of the display (in pixels). |
|
2162 |
On most systems, this is the same as the physical width; |
|
2163 |
except, if a window manager with a virtual desktop like olvwm |
|
2164 |
(simulating a bigger screen) is running." |
|
2165 |
||
2166 |
^ width @ height |
|
2167 |
! |
|
2168 |
||
2169 |
virtualHeight |
|
2170 |
"return the virtual height of the display (in pixels). |
|
2171 |
On most systems, this is the same as the physical height; |
|
2172 |
except, if a window manager with a virtual desktop like olvwm |
|
2173 |
(simulating a bigger screen) is running." |
|
2174 |
||
2175 |
^ self virtualExtent y |
|
2176 |
||
2177 |
"Display virtualHeight" |
|
2178 |
! |
|
2179 |
||
2180 |
virtualWidth |
|
2181 |
"return the virtual width of the display (in pixels). |
|
2182 |
On most systems, this is the same as the physical width; |
|
2183 |
except, if a window manager with a virtual desktop like olvwm |
|
2184 |
(simulating a bigger screen) is running." |
|
2185 |
||
2186 |
^ self virtualExtent x |
|
2187 |
||
2188 |
"Display virtualWidth" |
|
2189 |
! |
|
2190 |
||
2191 |
width |
|
2192 |
"return the width of the display (in pixels)" |
|
2193 |
||
2194 |
^ width |
|
2195 |
||
2196 |
"Display width" |
|
2197 |
! |
|
2198 |
||
2199 |
widthInMillimeter |
|
2200 |
"return the width in millimeter of the display" |
|
2201 |
||
2202 |
^ widthMM |
|
2203 |
||
2204 |
"Display widthInMillimeter" |
|
2205 |
! |
|
2206 |
||
2207 |
widthInMillimeter:aNumber |
|
2208 |
"set the width in millimeter of the display |
|
2209 |
- needed since some displays do not tell the truth or do not know it" |
|
2210 |
||
1044 | 2211 |
aNumber > 0 ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2212 |
widthMM := aNumber. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2213 |
resolutionHor := nil. |
1044 | 2214 |
]. |
2215 |
||
2216 |
"Modified: 10.9.1996 / 14:25:27 / cg" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2217 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2218 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2219 |
!DeviceWorkstation methodsFor:'accessing keyboard mappings'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2220 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2221 |
buttonTranslation |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2222 |
^ buttonTranslation |
293 | 2223 |
! |
2224 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2225 |
buttonTranslation:anArray |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2226 |
buttonTranslation := anArray |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2227 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2228 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2229 |
keyboardMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2230 |
"return the keyboard map" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2231 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2232 |
^ keyboardMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2233 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2234 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2235 |
keyboardMap:aMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2236 |
"set the keyboard map" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2237 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2238 |
keyboardMap := aMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2239 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2240 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2241 |
!DeviceWorkstation methodsFor:'accessing misc'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2242 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2243 |
displayName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2244 |
"return the display name - that is the name of the display connection |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2245 |
or nil, for default display. For example, in X, this returns a string |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2246 |
like 'hostname:0' for remote connections, and nil for a default local |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2247 |
connection. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2248 |
- nothing known here, but maybe redefined in subclasses." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2249 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2250 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2251 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2252 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2253 |
Display displayName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2254 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2255 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2256 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2257 |
glVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2258 |
"return a string describing the GL version. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2259 |
Since the generic display does not support 3D GL graphics, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2260 |
a dummy is returned here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2261 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2262 |
^ 'noGL' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2263 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2264 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2265 |
Display glVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2266 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2267 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2268 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2269 |
platformName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2270 |
"return a string describing the display systems platform. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2271 |
Returns a dummy here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2272 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2273 |
^ self class platformName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2274 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2275 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2276 |
Display platformName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2277 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2278 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2279 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2280 |
protocolVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2281 |
"return the display systems protocol version number. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2282 |
Returns a dummy here" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2283 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2284 |
^ 0 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2285 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2286 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2287 |
Display protocolVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2288 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2289 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2290 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2291 |
serverVendor |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2292 |
"return a string describing the display systems server vendor. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2293 |
Returns a dummy here" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2294 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2295 |
^ 'generic' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2296 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2297 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2298 |
Display serverVendor |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2299 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2300 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2301 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2302 |
vendorRelease |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2303 |
"return the display systems release number. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2304 |
Returns a dummy here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2305 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2306 |
^ 0 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2307 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2308 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2309 |
Display vendorRelease |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2310 |
" |
293 | 2311 |
! ! |
2312 |
||
2313 |
!DeviceWorkstation methodsFor:'bitmap/window creation'! |
|
2314 |
||
2315 |
createBitmapFromArray:anArray width:w height:h |
|
2896 | 2316 |
"create a monochrome, depth1 bitmap from a given (byte-)array. |
2317 |
The rows are aligned to a multiple of 8" |
|
2318 |
||
293 | 2319 |
^ self subclassResponsibility |
2320 |
! |
|
2321 |
||
2322 |
createBitmapFromFile:aString for:aForm |
|
974 | 2323 |
^ nil |
293 | 2324 |
! |
2325 |
||
2326 |
createBitmapWidth:w height:h |
|
2327 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
2328 |
(i.e. random). Return a bitmap id or nil" |
|
2329 |
||
2330 |
^ self subclassResponsibility |
|
2331 |
! |
|
2332 |
||
2333 |
createPixmapWidth:w height:h depth:d |
|
2334 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
2335 |
(i.e. random). Return a bitmap id or nil" |
|
2336 |
||
2337 |
^ self subclassResponsibility |
|
2338 |
! |
|
2339 |
||
1696
ba6085a629e0
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
2340 |
createWindowFor:aView type:typeSymbol origin:org extent:ext minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv style:styleSymbol inputOnly:inp label:label cursor:curs icon:icn iconMask:icnM iconView:icnV |
ba6085a629e0
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
2341 |
"must be implemented by a concrete class" |
ba6085a629e0
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
2342 |
|
293 | 2343 |
^ self subclassResponsibility |
2344 |
! |
|
2345 |
||
1961 | 2346 |
createWindowFor:aView type:typeSymbol origin:org extent:ext |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2347 |
minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2348 |
style:styleSymbol inputOnly:inp |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2349 |
label:label owner:owner |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2350 |
icon:icn iconMask:icnM iconView:icnV |
1961 | 2351 |
"must be implemented by a concrete class" |
2352 |
||
2353 |
^ self subclassResponsibility |
|
2354 |
! |
|
2355 |
||
293 | 2356 |
destroyGC:aGCId |
2357 |
"destroy a GC" |
|
2358 |
||
2359 |
^ self subclassResponsibility |
|
2360 |
! |
|
2361 |
||
2362 |
destroyPixmap:aDrawableId |
|
2363 |
^ self subclassResponsibility |
|
2364 |
! |
|
2365 |
||
2366 |
destroyView:aView withId:aWindowId |
|
2367 |
^ self subclassResponsibility |
|
2368 |
! |
|
2369 |
||
2370 |
gcFor:aDrawableId |
|
2371 |
"create a GC for drawing into aDrawable" |
|
2372 |
||
2373 |
^ self subclassResponsibility |
|
2374 |
! |
|
2375 |
||
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
2376 |
gcForBitmap:aDrawableId |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
2377 |
"create a GC for drawing into a bitmap drawable" |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
2378 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
2379 |
^ self subclassResponsibility |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
2380 |
! |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
2381 |
|
974 | 2382 |
realRootWindowId |
2383 |
"return the id of the real root window. |
|
2384 |
This may or may not be the view you see as background, |
|
2385 |
since some window managers install a virtual root window on top |
|
2386 |
of the real one. In this case, this method returns the id of the |
|
2387 |
covered real-root |
|
2388 |
(in contrast, rootWindowId returns the id of the visible one). |
|
2389 |
With most window systems, the realRoot is the same as the root window. |
|
1074
da107006d4f6
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1059
diff
changeset
|
2390 |
The real root is only seldom of any interest." |
974 | 2391 |
|
2392 |
^ self rootWindowId |
|
1074
da107006d4f6
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1059
diff
changeset
|
2393 |
|
da107006d4f6
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1059
diff
changeset
|
2394 |
"Modified: 14.10.1996 / 22:25:03 / stefan" |
974 | 2395 |
! |
2396 |
||
293 | 2397 |
rootWindowFor:aView |
974 | 2398 |
|id| |
2399 |
||
2400 |
id := self rootWindowId. |
|
2401 |
self addKnownView:aView withId:id. |
|
2402 |
^ id |
|
2403 |
! |
|
2404 |
||
2405 |
rootWindowId |
|
2406 |
"return the id of the root window. |
|
2407 |
This is the window you see as background, |
|
2408 |
however, it may or may not be the real physical root window, |
|
2409 |
since some window managers install a virtual root window on top |
|
2410 |
of the real one. If this is the case, that views id is returned here." |
|
2411 |
||
293 | 2412 |
^ self subclassResponsibility |
2413 |
! ! |
|
2414 |
||
2415 |
!DeviceWorkstation methodsFor:'color stuff'! |
|
2416 |
||
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2417 |
availableDitherColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2418 |
"return the table of preallocated emergency ditherColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2419 |
plus possibly available fixColors." |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2420 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2421 |
|s| |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2422 |
|
1768 | 2423 |
s := IdentitySet new. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2424 |
fixColors notNil ifTrue:[ |
1906 | 2425 |
s addAll:fixColors. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2426 |
]. |
1768 | 2427 |
fixGrayColors notNil ifTrue:[ |
1906 | 2428 |
s addAll:fixGrayColors. |
1768 | 2429 |
]. |
1776 | 2430 |
ditherColors notNil ifTrue:[ |
1906 | 2431 |
s addAll:ditherColors. |
1776 | 2432 |
]. |
1768 | 2433 |
^ s asArray |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2434 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2435 |
"Created: 11.7.1996 / 18:13:30 / cg" |
1776 | 2436 |
"Modified: 24.6.1997 / 16:23:50 / cg" |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2437 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2438 |
|
293 | 2439 |
blueComponentOfColor:colorId |
2440 |
"get blue component (0..100) of color in map at:index" |
|
2441 |
||
2442 |
self getRGBFrom:colorId into:[:r :g :b | ^ b] |
|
2443 |
! |
|
2444 |
||
2445 |
colorCell |
|
974 | 2446 |
"allocate a color - return index or nil, if no color cell |
2447 |
can be allocated (out of colors or trueColor device)" |
|
2448 |
||
2449 |
^ nil |
|
293 | 2450 |
! |
2451 |
||
934 | 2452 |
colorMap |
2453 |
"return my displays colormap, or nil, if the display is not colorMap based |
|
2454 |
(i.e. not PseudoColor)" |
|
2455 |
||
2456 |
|mapSize "{ Class: SmallInteger }" |
|
2457 |
depthUsed mapArray| |
|
2458 |
||
2459 |
visualType == #DirectColor ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2460 |
'DeviceWorkstation [info]: directColor displays not fully supported.' infoPrintCR. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2461 |
^ nil |
934 | 2462 |
]. |
2463 |
||
2464 |
(visualType == #StaticGray or:[visualType == #TrueColor]) ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2465 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2466 |
those have no colorMap - we're done |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2467 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2468 |
^ nil |
934 | 2469 |
]. |
2470 |
||
2471 |
" |
|
2472 |
get some attributes of the display device |
|
2473 |
" |
|
2474 |
depthUsed := depth. |
|
2475 |
||
2476 |
"/ kludge for 15bit XFree server |
|
2477 |
"/ (but: I have never encountered a PseudoColor display with more |
|
2478 |
"/ than 8 bits ...) |
|
2479 |
||
2480 |
depthUsed == 15 ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2481 |
depthUsed := 16 |
934 | 2482 |
]. |
2483 |
depthUsed > 16 ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2484 |
"/ do not allocate zillions of colors ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2485 |
self error:'unreasonably large colorMap ...'. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2486 |
^ nil |
934 | 2487 |
]. |
2488 |
||
2489 |
mapSize := (1 bitShift:depthUsed). |
|
2490 |
||
2491 |
"/ get the palette |
|
2492 |
mapArray := Array new:mapSize. |
|
2493 |
1 to:mapSize do:[:i | |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2494 |
self getRGBFrom:(i-1) into:[:r :g :b | |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2495 |
mapArray at:i put:(Color red:r green:g blue:b) |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2496 |
] |
934 | 2497 |
]. |
2498 |
^ mapArray. |
|
2499 |
||
2500 |
" |
|
2501 |
Display colorMap |
|
2502 |
" |
|
2503 |
||
2504 |
"Created: 11.7.1996 / 10:53:38 / cg" |
|
1168 | 2505 |
"Modified: 10.1.1997 / 15:40:10 / cg" |
934 | 2506 |
! |
2507 |
||
293 | 2508 |
colorRed:redVal green:greenVal blue:blueVal |
2509 |
"allocate a color with rgb values (0..100) - return index" |
|
2510 |
||
2511 |
^ self subclassResponsibility |
|
2512 |
! |
|
2513 |
||
2854 | 2514 |
colorScaledRed:red scaledGreen:green scaledBlue:blue |
2515 |
visualType == #TrueColor ifTrue:[ |
|
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
2516 |
^ (((red bitShift:-8) bitShift:redShift) |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
2517 |
bitOr:((green bitShift:-8) bitShift:greenShift)) |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
2518 |
bitOr:((blue bitShift:-8) bitShift:blueShift) |
2854 | 2519 |
]. |
2520 |
self subclassResponsibility |
|
2521 |
! |
|
2522 |
||
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2523 |
ditherColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2524 |
"return the table of preallocated emergency ditherColors" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2525 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2526 |
^ ditherColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2527 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2528 |
"Modified: 11.7.1996 / 18:13:37 / cg" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2529 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2530 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2531 |
fixColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2532 |
"return the table of preallocated fix colors (a colorCube), |
1768 | 2533 |
or nil if no fix colors were preallocated." |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2534 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2535 |
^ fixColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2536 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2537 |
"Created: 11.7.1996 / 17:49:24 / cg" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2538 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2539 |
|
1768 | 2540 |
fixGrayColors |
2541 |
"return the table of preallocated fix grayScale colors, |
|
2542 |
or nil if no fix gray colors were preallocated." |
|
2543 |
||
2544 |
^ fixGrayColors |
|
2545 |
||
2546 |
"Created: 11.7.1996 / 17:49:24 / cg" |
|
2547 |
! |
|
2548 |
||
293 | 2549 |
freeColor:colorIndex |
2550 |
"free a color on the display, when its no longer needed" |
|
2551 |
||
2552 |
^ self subclassResponsibility |
|
2553 |
! |
|
2554 |
||
2555 |
getRGBFrom:index into:aBlock |
|
2556 |
"get rgb components (0..100) of color in map at:index, |
|
2557 |
and evaluate the 3-arg block, aBlock with them" |
|
2558 |
||
2559 |
^ self subclassResponsibility |
|
2560 |
! |
|
2561 |
||
2562 |
getRGBFromName:colorName into:aBlock |
|
2563 |
"get rgb components (0..100) of color named colorName, |
|
2564 |
and evaluate the 3-arg block, aBlock with them. |
|
2565 |
The method here only handles some often used colors; |
|
2566 |
getRGBFromName should not be used, since colorNames other |
|
2567 |
than those below are X specific." |
|
2568 |
||
1674
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
2569 |
|idx names triple r g b| |
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
2570 |
|
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
2571 |
(colorName startsWith:$#) ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2572 |
"/ color in r/g/b hex notation |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2573 |
r := Integer readFrom:(colorName copyFrom:2 to:3) radix:16. |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2574 |
g := Integer readFrom:(colorName copyFrom:4 to:5) radix:16. |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2575 |
b := Integer readFrom:(colorName copyFrom:6 to:7) radix:16. |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2576 |
^ aBlock value:(r * 100 / 255) |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2577 |
value:(g * 100 / 255) |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2578 |
value:(b * 100 / 255) |
1674
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
2579 |
]. |
293 | 2580 |
|
1059
c040194dcab8
added internet explorers color-names
Claus Gittinger <cg@exept.de>
parents:
1045
diff
changeset
|
2581 |
names := #( |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2582 |
'red' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2583 |
'green' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2584 |
'blue' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2585 |
'yellow' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2586 |
'magenta' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2587 |
'cyan' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2588 |
'white' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2589 |
'black' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2590 |
|
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2591 |
'olive' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2592 |
'teal' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2593 |
'silver' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2594 |
'lime' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2595 |
'fuchsia' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2596 |
'aqua' |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2597 |
). |
293 | 2598 |
idx := names indexOf:colorName. |
2599 |
idx == 0 ifTrue:[ |
|
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2600 |
idx := names indexOf:colorName asLowercase. |
293 | 2601 |
]. |
2602 |
idx == 0 ifFalse:[ |
|
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2603 |
triple := #( |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2604 |
(100 0 0) "red" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2605 |
( 0 100 0) "green" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2606 |
( 0 0 100) "blue" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2607 |
(100 100 0) "yellow" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2608 |
(100 0 100) "magenta" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2609 |
( 0 100 100) "cyan" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2610 |
(100 100 100) "white" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2611 |
( 0 0 0) "black" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2612 |
|
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2613 |
( 50 50 0) "olive" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2614 |
( 0 50 50) "teal" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2615 |
( 40 40 40) "silver" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2616 |
( 20 100 0) "lime" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2617 |
( 60 3 100) "fuchsia" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2618 |
( 10 100 100) "aqua" |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2619 |
) at:idx. |
293 | 2620 |
|
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2621 |
^ aBlock value:(triple at:1) |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2622 |
value:(triple at:2) |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2623 |
value:(triple at:3) |
293 | 2624 |
]. |
2625 |
^ nil |
|
1059
c040194dcab8
added internet explorers color-names
Claus Gittinger <cg@exept.de>
parents:
1045
diff
changeset
|
2626 |
|
c040194dcab8
added internet explorers color-names
Claus Gittinger <cg@exept.de>
parents:
1045
diff
changeset
|
2627 |
"Modified: 18.9.1996 / 12:27:11 / cg" |
1674
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
2628 |
"Modified: 28.4.1997 / 22:35:55 / dq" |
293 | 2629 |
! |
2630 |
||
996 | 2631 |
getScaledRGBFromName:colorName into:aBlock |
2632 |
"get rgb components (0..16rFFFF) of color named colorName, |
|
2633 |
and evaluate the 3-arg block, aBlock with them" |
|
2634 |
||
2635 |
self getRGBFromName:colorName into:[:r :g :b | |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2636 |
|sr sg sb| |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2637 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2638 |
sr := self percentToDeviceColorValue:r. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2639 |
sg := self percentToDeviceColorValue:g. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2640 |
sb := self percentToDeviceColorValue:b. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2641 |
^ aBlock value:sr value:sg value:sb |
996 | 2642 |
] |
2643 |
! |
|
2644 |
||
293 | 2645 |
greenComponentOfColor:colorId |
2646 |
"get green component (0..100) of color in map at:index" |
|
2647 |
||
2648 |
self getRGBFrom:colorId into:[:r :g :b | ^ g] |
|
2649 |
! |
|
2650 |
||
2651 |
listOfAvailableColors |
|
2652 |
"return a list of all available colornames; |
|
2653 |
This method should not be used, since colornames are |
|
2654 |
very X specific. However, the names defined here are pretty common" |
|
2655 |
||
2656 |
^ #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black') |
|
2657 |
! |
|
2658 |
||
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2659 |
numFixBlue |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2660 |
"return the number of blue shades in the |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2661 |
preallocated fix color cube (or 0 if there is none)" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2662 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2663 |
^ numFixBlue |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2664 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2665 |
"Created: 11.7.1996 / 17:49:58 / cg" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2666 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2667 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2668 |
numFixGreen |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2669 |
"return the number of green shades in the |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2670 |
preallocated fix color cube (or 0 if there is none)" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2671 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2672 |
^ numFixGreen |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2673 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2674 |
"Created: 11.7.1996 / 17:50:12 / cg" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2675 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2676 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2677 |
numFixRed |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2678 |
"return the number of red shades in the |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2679 |
preallocated fix color cube (or 0 if there is none)" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2680 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2681 |
^ numFixRed |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2682 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2683 |
"Created: 11.7.1996 / 17:50:20 / cg" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2684 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2685 |
|
974 | 2686 |
percentToDeviceColorValue:percent |
2687 |
^ self subclassResponsibility |
|
2688 |
! |
|
2689 |
||
293 | 2690 |
redComponentOfColor:colorId |
2691 |
"get red component (0..100) of color in map at:index" |
|
2692 |
||
2693 |
self getRGBFrom:colorId into:[:r :g :b | ^ r] |
|
2694 |
! |
|
2695 |
||
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2696 |
releaseFixColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2697 |
"release the fix colorMap" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2698 |
|
1769 | 2699 |
fixColors := nil. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2700 |
numFixRed := numFixGreen := numFixBlue := 0. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2701 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2702 |
" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2703 |
Display releaseFixColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2704 |
" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2705 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2706 |
"Created: 11.7.1996 / 18:00:42 / cg" |
1769 | 2707 |
"Modified: 23.6.1997 / 15:32:04 / cg" |
2708 |
! |
|
2709 |
||
2710 |
releaseFixGrayColors |
|
2711 |
"release the fix colorMap" |
|
2712 |
||
2713 |
fixGrayColors := nil. |
|
2714 |
||
2715 |
" |
|
2716 |
Display releaseFixGrayColors |
|
2717 |
" |
|
2718 |
||
2719 |
"Created: 23.6.1997 / 15:32:00 / cg" |
|
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2720 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2721 |
|
293 | 2722 |
setColor:index red:redVal green:greenVal blue:blueVal |
974 | 2723 |
"change color in map at:index to rgb (0..100). |
2724 |
This is a no-op on TrueColor systems." |
|
2725 |
||
2726 |
^ self |
|
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2727 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2728 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2729 |
setDitherColors:colors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2730 |
"set the table of preallocated emergency dither fix colors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2731 |
These preallocated colors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2732 |
(white, black, red, green, blue and a few grayScales) prevent |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2733 |
running out of colors later, when images have to be dithered or |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2734 |
pen colors must be approximated. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2735 |
((Although, with such a small number of colors, the result will |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2736 |
definitely look poor))" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2737 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2738 |
ditherColors := colors. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2739 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2740 |
"Created: 11.7.1996 / 18:11:45 / cg" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2741 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2742 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2743 |
setFixColors:colors numRed:nR numGreen:nG numBlue:nB |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2744 |
"set the table of preallocated fix colors (a colorCube), |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2745 |
and the number of r/g/b entries in each dimension." |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2746 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2747 |
fixColors := colors. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2748 |
numFixRed := nR. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2749 |
numFixGreen := nG. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2750 |
numFixBlue := nB. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2751 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2752 |
"Created: 11.7.1996 / 17:56:18 / cg" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
2753 |
"Modified: 11.7.1996 / 17:57:10 / cg" |
1768 | 2754 |
! |
2755 |
||
2756 |
setFixGrayColors:colors |
|
2757 |
"set the table of preallocated fix gray colors" |
|
2758 |
||
2759 |
fixGrayColors := colors. |
|
293 | 2760 |
! ! |
2761 |
||
2762 |
!DeviceWorkstation methodsFor:'cursor stuff'! |
|
2763 |
||
1562
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2764 |
builtInCursorShapes |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2765 |
"return a collection of standard cursor names. |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2766 |
Hre none is assumed - so all cursors are created as user cursors |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2767 |
(see Cursor>>initializeNewCursors)" |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2768 |
|
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2769 |
"/ if you add something here, also add to #shapeNumberFromCursor ... |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2770 |
|
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2771 |
^ #() |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2772 |
|
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2773 |
"Created: 8.4.1997 / 10:32:31 / cg" |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2774 |
! |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
2775 |
|
293 | 2776 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
974 | 2777 |
"change a cursors colors. |
2778 |
Ignored on systems which do not support colored cursors." |
|
2779 |
||
2780 |
^ self |
|
293 | 2781 |
! |
2782 |
||
2875 | 2783 |
createCursorShape:aShapeSymbol |
2784 |
"create a cursor given a shape-symbol; return a cursorID or nil. |
|
2785 |
This only works for a few standard cursors, and returns nil |
|
2786 |
if no such cursor exists. |
|
974 | 2787 |
Always care for a fallBack, in case of a nil return." |
2788 |
||
2789 |
^ nil |
|
2790 |
! |
|
2791 |
||
2792 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
|
2793 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot. |
|
2794 |
Returns nil, if no cursor can be created (for any reason)" |
|
2795 |
||
293 | 2796 |
^ self subclassResponsibility |
2797 |
! |
|
2798 |
||
2799 |
destroyCursor:aCursorId |
|
2800 |
"free a cursor" |
|
2801 |
||
2802 |
^ self subclassResponsibility |
|
974 | 2803 |
! |
2804 |
||
2805 |
needDeviceFormsForCursor |
|
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2838
diff
changeset
|
2806 |
"return true, if this device requires device-forms as opposed |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2838
diff
changeset
|
2807 |
to a simple bitmap-byteArray for creation. |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2838
diff
changeset
|
2808 |
Redefined in X- and Win- Workstation classes." |
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2838
diff
changeset
|
2809 |
|
974 | 2810 |
^ self subclassResponsibility |
2811 |
! |
|
2812 |
||
2813 |
shapeNumberFromSymbol:shape |
|
2814 |
"given a shape-symbol, return the corresponding cursor-number, |
|
2815 |
or nil if no such standard cursor exists." |
|
2816 |
||
2817 |
^ nil |
|
293 | 2818 |
! ! |
2819 |
||
1542 | 2820 |
!DeviceWorkstation methodsFor:'drag & drop'! |
2821 |
||
1582
ec428aba3f9c
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
2822 |
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
1542 | 2823 |
"device specific drop here" |
2824 |
||
2825 |
"/ self subclassResponsibility |
|
2826 |
||
2827 |
"Created: 4.4.1997 / 18:33:44 / cg" |
|
1582
ec428aba3f9c
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
2828 |
"Modified: 11.4.1997 / 12:43:23 / cg" |
1542 | 2829 |
! ! |
2830 |
||
293 | 2831 |
!DeviceWorkstation methodsFor:'drawing'! |
2832 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1024
diff
changeset
|
2833 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
293 | 2834 |
"do a bit-blt" |
2835 |
||
2836 |
^ self subclassResponsibility |
|
2837 |
! |
|
2838 |
||
1247
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2839 |
copyFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2840 |
"do a bit-blt from a pix- or bitmap. |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2841 |
Here, fall back into copyFromId:, which should also work. |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2842 |
Subclasses may redefine this for more performance or if required" |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2843 |
|
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2844 |
^ self copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2845 |
! |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2846 |
|
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1024
diff
changeset
|
2847 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
293 | 2848 |
"do a bit-blt, using the low-bit plane of the source only" |
2849 |
||
2850 |
^ self subclassResponsibility |
|
2851 |
! |
|
2852 |
||
1247
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2853 |
copyPlaneFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2854 |
"do a bit-blt from a pix- or bitmap, using the low-bit plane of the source only. |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2855 |
Here, fall back into copyPlaneFromId:, which should also work. |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2856 |
Subclasses may redefine this for more performance or if required" |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2857 |
|
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2858 |
^ self copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2859 |
! |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
2860 |
|
653
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
2861 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2862 |
in:aDrawableId with:aGCId |
293 | 2863 |
"draw an arc" |
2864 |
||
2865 |
^ self subclassResponsibility |
|
653
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
2866 |
|
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
2867 |
"Created: 8.5.1996 / 08:44:43 / cg" |
293 | 2868 |
! |
2869 |
||
2870 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
|
2871 |
"draw a line" |
|
2872 |
||
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
2873 |
" |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
2874 |
could add a bresenham line drawer here ... |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
2875 |
" |
293 | 2876 |
^ self subclassResponsibility |
2877 |
! |
|
2878 |
||
2909 | 2879 |
displayLinesFromX:xStart step:xStep yValues:ydata scaleY:yScale transY:yTrans in:drawableId with:gcId |
2880 |
"draw a polygon starting at x; the y values derives from the collection yValues. |
|
2881 |
The associated x is a multiple of step. Each y value will be scaled and translated. |
|
2882 |
The implementation here is a fallback, using the line-draw primitive; |
|
2883 |
devices which support fast drawing of a polygon may redefine this for more performance." |
|
2884 |
||
2885 |
|x xLast yLast| |
|
2886 |
||
2887 |
ydata size == 0 ifTrue:[^ self]. |
|
2888 |
||
2889 |
xLast := xStart. |
|
2890 |
yLast := (ydata at:1) * yScale + yTrans. |
|
2891 |
ydata from:2 do:[:y | |yT| |
|
2892 |
x := xLast + xStep. |
|
2893 |
yT := y * yScale + yTrans. |
|
2894 |
self displayLineFromX:xLast rounded y:yLast rounded toX:x rounded y:yT rounded in:drawableId with:gcId. |
|
2895 |
xLast := x. |
|
2896 |
yLast := y. |
|
2897 |
] |
|
2898 |
! |
|
2899 |
||
293 | 2900 |
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
2901 |
"draw a sub-string - draw foreground on background. |
|
2902 |
If the coordinates are not integers, retry with rounded." |
|
2903 |
||
2904 |
self displayString:aString |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2905 |
from:index1 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2906 |
to:index2 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2907 |
x:x |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2908 |
y:y |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2909 |
in:aDrawableId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2910 |
with:aGCId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2911 |
opaque:true |
293 | 2912 |
! |
2913 |
||
2914 |
displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId |
|
2915 |
"draw a string - draw foreground on background. |
|
2916 |
If the coordinates are not integers, retry with rounded." |
|
2917 |
||
2918 |
self displayString:aString |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2919 |
x:x |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2920 |
y:y |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2921 |
in:aDrawableId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2922 |
with:aGCId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2923 |
opaque:true |
293 | 2924 |
! |
2925 |
||
2926 |
displayPointX:x y:y in:aDrawableId with:aGCId |
|
2927 |
"draw a point" |
|
2928 |
||
2622 | 2929 |
"/ could use |
2930 |
"/ self displayLineFromX:x y:y toX:x y:y in:aDrawableId with:aGCId. |
|
2931 |
"/ but then, we had to care for lineWidth & style ... |
|
2932 |
||
2933 |
^ self subclassResponsibility |
|
2934 |
||
2935 |
"Modified: / 3.5.1999 / 14:26:32 / cg" |
|
293 | 2936 |
! |
2937 |
||
2938 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
2939 |
"draw a polygon" |
|
2940 |
||
2941 |
" |
|
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
2942 |
could draw the lines here |
293 | 2943 |
but then, we have to reimplement all line and join styles here |
2944 |
" |
|
2945 |
^ self subclassResponsibility |
|
2946 |
! |
|
2947 |
||
2442 | 2948 |
displayPolylines:arrayOfPoints in:aDrawableId with:aGCId |
2949 |
"draw a bunch of lines" |
|
2950 |
||
2523 | 2951 |
|startPoint p| |
2442 | 2952 |
|
2953 |
1 to:arrayOfPoints size by:2 do:[:idx | |
|
2954 |
p := arrayOfPoints at:idx. |
|
2955 |
idx odd ifTrue:[ |
|
2956 |
startPoint := p |
|
2957 |
] ifFalse:[ |
|
2958 |
self |
|
2959 |
displayLineFromX:startPoint x |
|
2960 |
y:startPoint y |
|
2961 |
toX:p x |
|
2962 |
y:p y |
|
2963 |
in:aDrawableId |
|
2964 |
with:aGCId |
|
2965 |
] |
|
2966 |
] |
|
2967 |
! |
|
2968 |
||
293 | 2969 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
2970 |
"draw a rectangle" |
|
2971 |
||
2972 |
" |
|
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
2973 |
could draw four lines here |
293 | 2974 |
but then, we have to reimplement all line and join styles here |
2975 |
" |
|
2976 |
^ self subclassResponsibility |
|
2977 |
! |
|
2978 |
||
2979 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
|
2980 |
"draw a sub-string - draw foreground only. |
|
2981 |
If the coordinates are not integers, retry with rounded." |
|
2982 |
||
2983 |
self |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2984 |
displayString:aString |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2985 |
from:index1 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2986 |
to:index2 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2987 |
x:x |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2988 |
y:y |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2989 |
in:aDrawableId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2990 |
with:aGCId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
2991 |
opaque:false |
293 | 2992 |
! |
2993 |
||
2994 |
displayString:aString from:i1 to:i2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
2995 |
"draw part of a string" |
|
2996 |
||
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
2997 |
^ self subclassResponsibility |
293 | 2998 |
! |
2999 |
||
3000 |
displayString:aString x:x y:y in:aDrawableId with:aGCId |
|
3001 |
"draw a string - draw foreground only. |
|
3002 |
If the coordinates are not integers, retry with rounded." |
|
3003 |
||
3004 |
self |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3005 |
displayString:aString |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3006 |
x:x |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3007 |
y:y |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3008 |
in:aDrawableId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3009 |
with:aGCId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3010 |
opaque:false |
293 | 3011 |
! |
3012 |
||
3013 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
3014 |
"draw a string" |
|
3015 |
||
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
3016 |
self displayString:aString |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3017 |
from:1 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3018 |
to:aString size |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3019 |
x:x |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3020 |
y:y |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3021 |
in:aDrawableId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3022 |
with:aGCId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3023 |
opaque:opaque |
293 | 3024 |
! |
3025 |
||
2002 | 3026 |
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:pad |
3027 |
width:imageWidth height:imageHeight |
|
3028 |
x:srcx y:srcy |
|
3029 |
into:aDrawableId |
|
3030 |
x:dstx y:dsty |
|
3031 |
width:w height:h |
|
3032 |
with:aGCId |
|
3033 |
"draw a bitimage which has depth id, width iw and height ih into |
|
3034 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
3035 |
It has to be checked elsewhere, that server can do it with the given |
|
3036 |
depth; also it is assumed, that the colormap is setup correctly. |
|
3037 |
The actual bits per pixel may be different from the depth (for example, |
|
3038 |
on a depth-15 device, 16 bits/pixel may be used; also, many depth-24 |
|
3039 |
systems actually use 32 bits/pixel)" |
|
3040 |
||
3041 |
^ self subclassResponsibility |
|
3042 |
! |
|
3043 |
||
1602 | 3044 |
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3045 |
width:imageWidth height:imageHeight |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3046 |
x:srcx y:srcy |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3047 |
into:aDrawableId |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3048 |
x:dstx y:dsty |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3049 |
width:w height:h |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3050 |
with:aGCId |
1602 | 3051 |
|
3052 |
"draw a bitimage which has depth id, width iw and height ih into |
|
3053 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
3054 |
It has to be checked elsewhere, that server can do it with the given |
|
3055 |
depth; also it is assumed, that the colormap is setup correctly. |
|
3056 |
The actual bits per pixel may be different from the depth (for example, |
|
3057 |
on a depth-15 device, 16 bits/pixel may be used; also, many depth-24 |
|
2004 | 3058 |
systems actually use 32 bits/pixel). |
3059 |
This assumes a padding of 8-bits (i.e. byte-boundary), |
|
3060 |
which is the natural padding within ST/X." |
|
1602 | 3061 |
|
2002 | 3062 |
^ self |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3063 |
drawBits:imageBits |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3064 |
bitsPerPixel:bitsPerPixel |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3065 |
depth:imageDepth |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3066 |
padding:8 |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3067 |
width:imageWidth height:imageHeight |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3068 |
x:srcx y:srcy |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3069 |
into:aDrawableId |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3070 |
x:dstx y:dsty |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3071 |
width:w height:h |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3072 |
with:aGCId |
2004 | 3073 |
|
3074 |
"Created: / 16.4.1997 / 14:55:57 / cg" |
|
3075 |
"Modified: / 21.1.1998 / 13:27:58 / cg" |
|
2002 | 3076 |
! |
3077 |
||
3078 |
drawBits:imageBits depth:imageDepth padding:pad width:imageWidth height:imageHeight |
|
3079 |
x:srcx y:srcy into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
|
3080 |
||
3081 |
"draw a bitimage which has depth id, width iw and height ih into |
|
3082 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
3083 |
It has to be checked elsewhere, that server can do it with the given |
|
3084 |
depth; also it is assumed, that the colormap is setup correctly" |
|
3085 |
||
3086 |
^ self |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3087 |
drawBits:imageBits |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3088 |
bitsPerPixel:imageDepth |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3089 |
depth:imageDepth |
2002 | 3090 |
padding:pad |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3091 |
width:imageWidth height:imageHeight |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3092 |
x:srcx y:srcy |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3093 |
into:aDrawableId |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3094 |
x:dstx y:dsty |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3095 |
width:w height:h |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3096 |
with:aGCId |
293 | 3097 |
! |
3098 |
||
2004 | 3099 |
drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3100 |
x:srcx y:srcy |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3101 |
into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
2004 | 3102 |
|
3103 |
"draw a bitimage which has depth id, width iw and height ih into |
|
3104 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
3105 |
It has to be checked elsewhere, that server can do it with the given |
|
3106 |
depth; also it is assumed, that the colormap is setup correctly. |
|
3107 |
This assumes a padding of 8-bits (i.e. byte-boundary), |
|
3108 |
which is the natural padding within ST/X." |
|
3109 |
||
3110 |
^ self |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3111 |
drawBits:imageBits |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3112 |
bitsPerPixel:imageDepth |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3113 |
depth:imageDepth |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3114 |
width:imageWidth height:imageHeight |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3115 |
x:srcx y:srcy |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3116 |
into:aDrawableId |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3117 |
x:dstx y:dsty |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3118 |
width:w height:h |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3119 |
with:aGCId |
2004 | 3120 |
|
3121 |
"Modified: / 21.1.1998 / 13:28:34 / cg" |
|
3122 |
! |
|
3123 |
||
653
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
3124 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3125 |
in:aDrawableId with:aGCId |
293 | 3126 |
"fill an arc" |
3127 |
||
3128 |
^ self subclassResponsibility |
|
653
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
3129 |
|
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
3130 |
"Created: 8.5.1996 / 08:45:11 / cg" |
293 | 3131 |
! |
3132 |
||
3133 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
3134 |
"fill a polygon" |
|
3135 |
||
3136 |
^ self subclassResponsibility |
|
3137 |
! |
|
3138 |
||
3139 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
3140 |
"fill a rectangle" |
|
3141 |
||
3142 |
^ self subclassResponsibility |
|
3143 |
! ! |
|
3144 |
||
3145 |
!DeviceWorkstation methodsFor:'enumerating'! |
|
3146 |
||
1215 | 3147 |
allViews |
3148 |
"return a collection of all my known views" |
|
3149 |
||
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
3150 |
|setOfViews| |
1215 | 3151 |
|
3152 |
knownViews notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3153 |
setOfViews := IdentitySet new. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3154 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3155 |
knownViews validElementsDo:[:v | setOfViews add:v]. |
1215 | 3156 |
]. |
3157 |
^ setOfViews |
|
3158 |
||
3159 |
"Created: 14.2.1997 / 14:29:43 / cg" |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
3160 |
"Modified: 23.1.1997 / 21:27:03 / cg" |
1215 | 3161 |
! |
3162 |
||
293 | 3163 |
allViewsDo:aBlock |
3164 |
"evaluate the argument, aBlock for all of my known views" |
|
3165 |
||
3166 |
"/ idToViewMapping notNil ifTrue:[ |
|
3167 |
"/ idToViewMapping keysAndValuesDo:[:id :aView | |
|
3168 |
"/ aView notNil ifTrue:[ |
|
3169 |
"/ aBlock value:aView |
|
3170 |
"/ ] |
|
3171 |
"/ ] |
|
3172 |
||
3173 |
knownViews notNil ifTrue:[ |
|
1906 | 3174 |
knownViews validElementsDo:aBlock |
293 | 3175 |
] |
3176 |
||
3177 |
" |
|
3178 |
View defaultStyle:#iris. |
|
3179 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
3180 |
" |
|
3181 |
" |
|
3182 |
View defaultStyle:#next. |
|
3183 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
3184 |
" |
|
3185 |
" |
|
3186 |
View defaultStyle:#normal. |
|
3187 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
3188 |
" |
|
1215 | 3189 |
|
1810 | 3190 |
"Modified: 16.7.1997 / 09:56:58 / cg" |
293 | 3191 |
! ! |
3192 |
||
3193 |
!DeviceWorkstation methodsFor:'event forwarding'! |
|
3194 |
||
3195 |
buttonMotion:button x:x y:y view:aView |
|
3196 |
"forward a button-motion for some view" |
|
3197 |
||
3198 |
|sensor| |
|
3199 |
||
3200 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3201 |
sensor buttonMotion:button x:x y:y view:aView |
293 | 3202 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3203 |
aView shown ifTrue:[ "/ could be a late event arrival |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3204 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3205 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3206 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3207 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3208 |
dispatchEvent:#buttonMotion:x:y: |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3209 |
arguments:(Array with:button with:x with:y) |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3210 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3211 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3212 |
"/ sendEvent:#buttonMotion:x:y: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3213 |
"/ arguments:(Array with:button with:x with:y) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3214 |
"/ view:aView |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3215 |
] |
293 | 3216 |
] |
1383
f078f4ec6b08
care for late arriving button and key events
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
3217 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3218 |
"Modified: / 20.5.1998 / 22:50:32 / cg" |
293 | 3219 |
! |
3220 |
||
3221 |
buttonMultiPress:button x:x y:y view:aView |
|
3222 |
"forward a button-multi-press event for some view" |
|
3223 |
||
3224 |
|sensor| |
|
3225 |
||
3226 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3227 |
sensor buttonMultiPress:button x:x y:y view:aView |
293 | 3228 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3229 |
aView shown ifTrue:[ "/ could be a late event arrival |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3230 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3231 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3232 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3233 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3234 |
dispatchEvent:#buttonMultiPress:x:y: |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3235 |
arguments:(Array with:button with:x with:y) |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3236 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3237 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3238 |
"/ sendEvent:#buttonMultiPress:x:y: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3239 |
"/ arguments:(Array with:button with:x with:y) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3240 |
"/ view:aView |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3241 |
] |
293 | 3242 |
] |
1383
f078f4ec6b08
care for late arriving button and key events
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
3243 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3244 |
"Modified: / 20.5.1998 / 22:50:49 / cg" |
293 | 3245 |
! |
3246 |
||
3247 |
buttonPress:button x:x y:y view:aView |
|
3248 |
"forward a button-press event for some view" |
|
3249 |
||
3250 |
|sensor| |
|
3251 |
||
3252 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2428 | 3253 |
WindowsRightButtonBehavior == true ifTrue:[ |
3254 |
button >= 2 ifTrue:[ |
|
3255 |
sensor buttonPress:1 x:x y:y view:aView. |
|
3256 |
^ self. |
|
3257 |
] |
|
3258 |
]. |
|
3259 |
||
3260 |
sensor buttonPress:button x:x y:y view:aView |
|
293 | 3261 |
] ifFalse:[ |
2428 | 3262 |
aView shown ifTrue:[ "/ could be a late event arrival |
3263 |
" |
|
3264 |
if there is no sensor ... |
|
3265 |
" |
|
3266 |
aView |
|
3267 |
dispatchEvent:#buttonPress:x:y: |
|
3268 |
arguments:(Array with:button with:x with:y) |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3269 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3270 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3271 |
"/ sendEvent:#buttonPress:x:y: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3272 |
"/ arguments:(Array with:button with:x with:y) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3273 |
"/ view:aView |
2428 | 3274 |
] |
293 | 3275 |
] |
1383
f078f4ec6b08
care for late arriving button and key events
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
3276 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3277 |
"Modified: / 20.5.1998 / 22:51:02 / cg" |
293 | 3278 |
! |
3279 |
||
3280 |
buttonRelease:button x:x y:y view:aView |
|
3281 |
"forward a button-release event for some view" |
|
3282 |
||
3283 |
|sensor| |
|
3284 |
||
3285 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2428 | 3286 |
WindowsRightButtonBehavior == true ifTrue:[ |
3287 |
button >= 2 ifTrue:[ |
|
3288 |
sensor buttonRelease:1 x:x y:y view:aView. |
|
3289 |
sensor buttonPress:button x:x y:y view:aView. |
|
3290 |
sensor buttonRelease:button x:x y:y view:aView. |
|
3291 |
^ self. |
|
3292 |
]. |
|
3293 |
]. |
|
3294 |
sensor buttonRelease:button x:x y:y view:aView |
|
293 | 3295 |
] ifFalse:[ |
2428 | 3296 |
aView shown ifTrue:[ "/ could be a late event arrival |
3297 |
" |
|
3298 |
if there is no sensor ... |
|
3299 |
" |
|
3300 |
aView |
|
3301 |
dispatchEvent:#buttonRelease:x:y: |
|
3302 |
arguments:(Array with:button with:x with:y) |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3303 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3304 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3305 |
"/ sendEvent:#buttonRelease:x:y: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3306 |
"/ arguments:(Array with:button with:x with:y) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3307 |
"/ view:aView |
2428 | 3308 |
] |
293 | 3309 |
] |
1383
f078f4ec6b08
care for late arriving button and key events
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
3310 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3311 |
"Modified: / 20.5.1998 / 22:51:13 / cg" |
293 | 3312 |
! |
3313 |
||
3314 |
configureX:x y:y width:w height:h view:aView |
|
3315 |
"forward a configure for some view" |
|
3316 |
||
3317 |
|sensor| |
|
3318 |
||
3319 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3320 |
sensor configureX:x y:y width:w height:h view:aView |
293 | 3321 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3322 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3323 |
if there is no sensor ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3324 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3325 |
aView configureX:x y:y width:w height:h |
293 | 3326 |
] |
3327 |
! |
|
3328 |
||
3329 |
coveredBy:otherView view:aView |
|
3330 |
"forward a covered for some view" |
|
3331 |
||
2442 | 3332 |
"/ |sensor| |
3333 |
"/ |
|
3334 |
"/ (sensor := aView sensor) notNil ifTrue:[ |
|
3335 |
"/ sensor coveredBy:otherView view:aView |
|
3336 |
"/ ] ifFalse:[ |
|
3337 |
"/ " |
|
3338 |
"/ if there is no sensor ... |
|
3339 |
"/ " |
|
2648 | 3340 |
aView coveredBy:otherView |
2442 | 3341 |
"/ ] |
3342 |
||
3343 |
"Modified: / 8.2.1999 / 15:24:52 / cg" |
|
293 | 3344 |
! |
3345 |
||
3346 |
destroyedView:aView |
|
3347 |
"forward a destroyed event for some view" |
|
3348 |
||
3349 |
|sensor| |
|
3350 |
||
3351 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3352 |
sensor destroyedView:aView |
293 | 3353 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3354 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3355 |
if there is no sensor ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3356 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3357 |
aView destroyed |
293 | 3358 |
] |
3359 |
! |
|
3360 |
||
3361 |
exposeX:x y:y width:w height:h view:aView |
|
3362 |
"forward an expose for some view" |
|
3363 |
||
3364 |
|sensor| |
|
3365 |
||
3366 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3367 |
sensor exposeX:x y:y width:w height:h view:aView |
293 | 3368 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3369 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3370 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3371 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3372 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3373 |
dispatchEvent:#exposeX:y:width:height: |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3374 |
arguments:(Array with:x with:y with:w with:h) |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3375 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3376 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3377 |
"/ sendEvent:#exposeX:y:width:height: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3378 |
"/ arguments:(Array with:x with:y with:w with:h) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3379 |
"/ view:aView |
293 | 3380 |
] |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3381 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3382 |
"Modified: / 20.5.1998 / 22:51:31 / cg" |
293 | 3383 |
! |
3384 |
||
3385 |
focusInView:aView |
|
3386 |
"forward a focusIn event for some view" |
|
3387 |
||
3388 |
|sensor| |
|
3389 |
||
3390 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3391 |
sensor focusInView:aView |
293 | 3392 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3393 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3394 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3395 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3396 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3397 |
dispatchEvent:#focusIn |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3398 |
arguments:nil |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3399 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3400 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3401 |
"/ sendEvent:#focusIn |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3402 |
"/ arguments:nil |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3403 |
"/ view:aView |
293 | 3404 |
] |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3405 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3406 |
"Modified: / 20.5.1998 / 22:51:48 / cg" |
293 | 3407 |
! |
3408 |
||
3409 |
focusOutView:aView |
|
3410 |
"forward a focusOut event for some view" |
|
3411 |
||
3412 |
|sensor| |
|
3413 |
||
3414 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3415 |
sensor focusOutView:aView |
293 | 3416 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3417 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3418 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3419 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3420 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3421 |
dispatchEvent:#focusOut |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3422 |
arguments:nil |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3423 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3424 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3425 |
"/ sendEvent:#focusOut |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3426 |
"/ arguments:nil |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3427 |
"/ view:aView |
293 | 3428 |
] |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3429 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3430 |
"Modified: / 20.5.1998 / 22:51:58 / cg" |
293 | 3431 |
! |
3432 |
||
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3433 |
graphicsExposeX:x y:y width:w height:h final:final view:aView |
293 | 3434 |
"forward a graphic expose for some view" |
3435 |
||
3436 |
|sensor| |
|
3437 |
||
3438 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3439 |
sensor graphicsExposeX:x y:y width:w height:h final:final view:aView |
293 | 3440 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3441 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3442 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3443 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3444 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3445 |
dispatchEvent:#graphicsExposeX:y:width:height:final: |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3446 |
arguments:(Array with:x with:y with:w with:h with:final) |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3447 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3448 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3449 |
"/ sendEvent:#graphicsExposeX:y:width:height:final: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3450 |
"/ arguments:(Array with:x with:y with:w with:h with:final) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3451 |
"/ view:aView |
293 | 3452 |
] |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3453 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3454 |
"Modified: / 20.5.1998 / 22:52:16 / cg" |
293 | 3455 |
! |
3456 |
||
3457 |
keyPress:untranslatedKey x:x y:y view:aView |
|
3458 |
"forward a key-press event for some view" |
|
3459 |
||
509 | 3460 |
<resource: #keyboard (#Escape)> |
3461 |
||
293 | 3462 |
|xlatedKey sensor| |
3463 |
||
492
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
3464 |
"/ |
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
3465 |
"/ ctrl-Esc gives up focus |
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
3466 |
"/ |
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
3467 |
untranslatedKey == #Escape ifTrue:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3468 |
ctrlDown ifTrue:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3469 |
self ungrabPointer. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3470 |
self setInputFocusTo:nil |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3471 |
] |
492
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
3472 |
]. |
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
3473 |
|
293 | 3474 |
self modifierKeyProcessing:untranslatedKey down:true. |
3475 |
||
3476 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3477 |
sensor keyPress:untranslatedKey x:x y:y view:aView |
293 | 3478 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3479 |
aView shown ifTrue:[ "/ could be a late event arrival |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3480 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3481 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3482 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3483 |
xlatedKey := self translateKey:untranslatedKey forView:aView. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3484 |
xlatedKey notNil ifTrue:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3485 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3486 |
dispatchEvent:#keyPress:x:y: |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3487 |
arguments:(Array with:xlatedKey with:x with:y) |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3488 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3489 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3490 |
"/ sendEvent:#keyPress:x:y: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3491 |
"/ arguments:(Array with:xlatedKey with:x with:y) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3492 |
"/ view:aView |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3493 |
] |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3494 |
] |
293 | 3495 |
] |
492
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
3496 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3497 |
"Modified: / 20.5.1998 / 22:52:36 / cg" |
293 | 3498 |
! |
3499 |
||
3500 |
keyRelease:untranslatedKey x:x y:y view:aView |
|
3501 |
"forward a key-release event for some view" |
|
3502 |
||
3503 |
|xlatedKey sensor| |
|
3504 |
||
3505 |
self modifierKeyProcessing:untranslatedKey down:false. |
|
3506 |
||
3507 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3508 |
sensor keyRelease:untranslatedKey x:x y:y view:aView |
293 | 3509 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3510 |
aView shown ifTrue:[ "/ could be a late event arrival |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3511 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3512 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3513 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3514 |
xlatedKey := self translateKey:untranslatedKey forView:aView. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3515 |
xlatedKey notNil ifTrue:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3516 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3517 |
dispatchEvent:#keyRelease:x:y: |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3518 |
arguments:(Array with:xlatedKey with:x with:y) |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3519 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3520 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3521 |
"/ sendEvent:#keyRelease:x:y: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3522 |
"/ arguments:(Array with:xlatedKey with:x with:y) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3523 |
"/ view:aView |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3524 |
] |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3525 |
] |
293 | 3526 |
] |
1383
f078f4ec6b08
care for late arriving button and key events
Claus Gittinger <cg@exept.de>
parents:
1375
diff
changeset
|
3527 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3528 |
"Modified: / 20.5.1998 / 22:52:52 / cg" |
293 | 3529 |
! |
3530 |
||
3531 |
mappedView:aView |
|
3532 |
"forward a mapped event for some view" |
|
3533 |
||
3534 |
|sensor| |
|
3535 |
||
3536 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3537 |
sensor mappedView:aView |
293 | 3538 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3539 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3540 |
if there is no sensor ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3541 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3542 |
aView mapped |
293 | 3543 |
] |
3544 |
! |
|
3545 |
||
2733
5af2417bc450
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
2716
diff
changeset
|
3546 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime view:aView |
2677 | 3547 |
"the mousewheel was moved by some amount (signed). |
3548 |
This event is sent to the current pointer view (like keyPress/release)." |
|
2699 | 3549 |
|
3550 |
|sensor| |
|
3551 |
||
3552 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2733
5af2417bc450
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
2716
diff
changeset
|
3553 |
sensor mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime view:aView |
2699 | 3554 |
] ifFalse:[ |
2716
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
3555 |
aView shown ifTrue:[ "/ could be a late event arrival |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
3556 |
" |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
3557 |
if there is no sensor ... |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
3558 |
" |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
3559 |
aView |
2733
5af2417bc450
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
2716
diff
changeset
|
3560 |
dispatchEvent:#mouseWheelMotion:x:y:amount:deltaTime: |
5af2417bc450
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
2716
diff
changeset
|
3561 |
arguments:(Array with:buttonState with:x with:y with:amount with:dTime ) |
2716
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
3562 |
] |
2699 | 3563 |
] |
3564 |
||
3565 |
"Modified: / 21.5.1999 / 13:05:53 / cg" |
|
2677 | 3566 |
! |
3567 |
||
293 | 3568 |
noExposeView:aView |
3569 |
"forward a noExpose event for some view" |
|
3570 |
||
3571 |
|sensor| |
|
3572 |
||
3573 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3574 |
sensor noExposeView:aView |
293 | 3575 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3576 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3577 |
if there is no sensor ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3578 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3579 |
aView noExpose |
293 | 3580 |
] |
3581 |
! |
|
3582 |
||
3583 |
pointerEnter:buttonState x:x y:y view:aView |
|
3584 |
"forward a pointer enter for some view" |
|
3585 |
||
3586 |
|sensor| |
|
3587 |
||
3588 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3589 |
sensor pointerEnter:buttonState x:x y:y view:aView |
293 | 3590 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3591 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3592 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3593 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3594 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3595 |
dispatchEvent:#pointerEnter:x:y: |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3596 |
arguments:(Array with:buttonState with:x with:y) |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3597 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3598 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3599 |
"/ sendEvent:#pointerEnter:x:y: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3600 |
"/ arguments:(Array with:buttonState with:x with:y) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3601 |
"/ view:aView |
293 | 3602 |
] |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3603 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3604 |
"Modified: / 20.5.1998 / 22:53:13 / cg" |
293 | 3605 |
! |
3606 |
||
3607 |
pointerLeave:buttonState view:aView |
|
3608 |
"forward a pointer leave for some view" |
|
3609 |
||
3610 |
|sensor| |
|
3611 |
||
3612 |
(sensor := aView sensor) notNil ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3613 |
sensor pointerLeave:buttonState view:aView |
293 | 3614 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3615 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3616 |
if there is no sensor ... |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3617 |
" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3618 |
aView |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3619 |
dispatchEvent:#pointerLeave: |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3620 |
arguments:(Array with:buttonState) |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3621 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3622 |
"/ WindowEvent |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3623 |
"/ sendEvent:#pointerLeave: |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3624 |
"/ arguments:(Array with:buttonState) |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3625 |
"/ view:aView |
293 | 3626 |
] |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3627 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
3628 |
"Modified: / 20.5.1998 / 22:53:29 / cg" |
293 | 3629 |
! |
3630 |
||
3631 |
saveAndTerminateView:aView |
|
3632 |
"forward a saveAndTerminate event for some view" |
|
3633 |
||
3634 |
|sensor| |
|
3635 |
||
3636 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3637 |
sensor saveAndTerminateView:aView |
293 | 3638 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3639 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3640 |
if there is no sensor ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3641 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3642 |
aView saveAndTerminate |
293 | 3643 |
] |
3644 |
! |
|
3645 |
||
3646 |
terminateView:aView |
|
3647 |
"forward a terminate event for some view" |
|
3648 |
||
3649 |
|sensor| |
|
3650 |
||
3651 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3652 |
sensor terminateView:aView |
293 | 3653 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3654 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3655 |
if there is no sensor ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3656 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3657 |
aView terminate |
293 | 3658 |
] |
3659 |
! |
|
3660 |
||
3661 |
unmappedView:aView |
|
3662 |
"forward an unmapped event for some view" |
|
3663 |
||
3664 |
|sensor| |
|
3665 |
||
3666 |
(sensor := aView sensor) notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3667 |
sensor unmappedView:aView |
293 | 3668 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3669 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3670 |
if there is no sensor ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3671 |
" |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3672 |
aView unmapped |
293 | 3673 |
] |
3674 |
! ! |
|
3675 |
||
3676 |
!DeviceWorkstation methodsFor:'event handling'! |
|
3677 |
||
3678 |
checkForEndOfDispatch |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
3679 |
"return true, if there are still any views of interest - |
349
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
3680 |
if not, stop dispatch. |
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
3681 |
This ends the dispatcher process when the last view is closed on that device. |
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
3682 |
We only do this for displays other that the default Display." |
507a573eba58
dont exit dispatch loop with last window (stopped when changing language with only a launcher open)
Claus Gittinger <cg@exept.de>
parents:
347
diff
changeset
|
3683 |
|
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
3684 |
dispatching ifFalse:[^ self]. |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
3685 |
|
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
3686 |
self == Display ifTrue:[ |
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3687 |
ExitOnLastClose == true ifFalse:[^ self]. |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
3688 |
]. |
2826 | 3689 |
exitOnLastClose == true ifFalse:[^ self]. |
293 | 3690 |
|
3691 |
knownViews notNil ifTrue:[ |
|
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3692 |
(knownViews findFirst:[:slot | |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3693 |
slot notNil |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3694 |
and:[slot ~~ 0 |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3695 |
and:[slot isRootView not |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3696 |
and:[slot superView isNil |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3697 |
and:[slot realized]]]]]) == 0 ifTrue:[ |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3698 |
"/ my last view was closed |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3699 |
dispatching := false. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3700 |
'DeviceWorkstation [info]: finished dispatch (last view closed)' infoPrintCR. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3701 |
LastActiveScreen == self ifTrue:[ |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3702 |
LastActiveScreen := nil. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3703 |
LastActiveProcess := nil. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3704 |
]. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3705 |
] |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
3706 |
]. |
293 | 3707 |
|
3708 |
"Modified: 19.9.1995 / 11:31:54 / claus" |
|
1449
02f4faded623
end of dispatch if no realized topview
Claus Gittinger <cg@exept.de>
parents:
1429
diff
changeset
|
3709 |
"Modified: 18.3.1997 / 10:42:11 / cg" |
293 | 3710 |
! |
3711 |
||
3712 |
dispatchEvent |
|
3713 |
"get and process the next pending event - for any view" |
|
3714 |
||
3715 |
self dispatchEventFor:nil withMask:nil |
|
3716 |
! |
|
3717 |
||
3718 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
3719 |
"central event handling method: |
|
3720 |
get next event and send an appropriate message to the views sensor, |
|
3721 |
or to the view directly (if the view has none). |
|
3722 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
3723 |
otherwise only events for the view with given id are processed |
|
3724 |
(in this case, nothing is done if no events are pending); |
|
3725 |
if the argument aMask is nonNil, only events for this eventMask are |
|
3726 |
handled. The mask is a device dependent event mask." |
|
3727 |
||
3728 |
^ self subclassResponsibility |
|
3729 |
! |
|
3730 |
||
3731 |
dispatchModalWhile:aBlock |
|
3732 |
"get and process next event for any view as long as the |
|
3733 |
argument-block evaluates to true. |
|
3734 |
This is a modal loop, not switching to other processes, |
|
3735 |
effectively polling the device in a (nice) busy loop. |
|
3736 |
This should only be (and is only) used for emergency cases. |
|
3737 |
(such as a graphical debugger, debugging the event-dispatcher itself)" |
|
3738 |
||
3739 |
|myFd| |
|
3740 |
||
3741 |
" |
|
3742 |
if this display has a fileDescriptor to wait on, |
|
3743 |
it is used; otherwise we poll (with a delay to not lock up |
|
3744 |
the workstation) |
|
3745 |
" |
|
3746 |
myFd := self displayFileDescriptor. |
|
3747 |
[aBlock value] whileTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3748 |
self eventPending ifFalse:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3749 |
myFd isNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3750 |
OperatingSystem millisecondDelay:50 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3751 |
] ifFalse:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3752 |
OperatingSystem selectOn:myFd withTimeOut:50. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3753 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3754 |
Processor evaluateTimeouts. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3755 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3756 |
self eventPending ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3757 |
self dispatchEvent |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3758 |
]. |
293 | 3759 |
] |
3760 |
! |
|
3761 |
||
3762 |
dispatchPendingEvents |
|
405 | 3763 |
"go dispatch events as long as there is one. |
3764 |
This is only used with modal operation. |
|
3765 |
(i.e. when in the modal debugger)" |
|
293 | 3766 |
|
2114 | 3767 |
Object osSignalInterruptSignal handle:[:ex | |
3768 |
ex return |
|
3769 |
] do:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
3770 |
[self eventPending] whileTrue:[ |
2114 | 3771 |
self dispatchEventFor:nil withMask:nil |
3772 |
] |
|
293 | 3773 |
] |
3774 |
! |
|
3775 |
||
3776 |
disposeButtonEventsFor:aViewIdOrNil |
|
3777 |
"dispose (i.e. forget) all pending button events on this display" |
|
3778 |
||
3779 |
|mask| |
|
3780 |
||
3781 |
mask := self eventMaskFor:#buttonPress. |
|
3782 |
mask := mask bitOr:(self eventMaskFor:#buttonRelease). |
|
3783 |
mask := mask bitOr:(self eventMaskFor:#buttonMotion). |
|
3784 |
self disposeEventsWithMask:mask for:aViewIdOrNil |
|
3785 |
! |
|
3786 |
||
3787 |
disposeEvents |
|
3788 |
"dispose (i.e. forget) all events pending on this display" |
|
3789 |
||
3790 |
[self eventPending] whileTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
3791 |
self getEventFor:nil withMask:nil |
293 | 3792 |
]. |
3793 |
! |
|
3794 |
||
3795 |
disposeEventsWithMask:aMask for:aWindowId |
|
3796 |
"dispose (throw away) specific events" |
|
3797 |
||
3798 |
^ self subclassResponsibility |
|
3799 |
! |
|
3800 |
||
3801 |
eventMaskFor:anEventSymbol |
|
3802 |
^ self subclassResponsibility |
|
3803 |
! |
|
3804 |
||
3805 |
eventPending |
|
3806 |
"return true, if any event is pending" |
|
3807 |
||
3808 |
^ self subclassResponsibility |
|
3809 |
! |
|
3810 |
||
3811 |
eventPending:anEventSymbol for:aWindowId |
|
3812 |
"return true, if a specific event is pending for a specific window. |
|
3813 |
This expects device independent event symbols (such as #buttonPress, |
|
3814 |
#buttonRelease etc.) as first argument." |
|
3815 |
||
3816 |
^ self subclassResponsibility |
|
3817 |
! |
|
3818 |
||
405 | 3819 |
eventPendingWithSync:doSync |
293 | 3820 |
"return true, if any event is pending" |
3821 |
||
3822 |
^ self subclassResponsibility |
|
3823 |
! |
|
3824 |
||
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3825 |
eventQueued |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3826 |
"return true, if any event is pending in some internal queue. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3827 |
The fallBack here returns true if events are pending on the display connection; |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3828 |
only devices which use internal queues (i.e. Xlib) need to redefine this." |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3829 |
|
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3830 |
^ self eventPending |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3831 |
! |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
3832 |
|
2169 | 3833 |
eventQueuedAlready |
3834 |
"return true, if any event is pending in some internal queue. |
|
3835 |
The fallBack here returns true if events are pending on the display connection; |
|
3836 |
only devices which use internal queues (i.e. Xlib) need to redefine this." |
|
3837 |
||
3838 |
^ self eventPending |
|
3839 |
! |
|
3840 |
||
405 | 3841 |
eventsPending:anEventMask for:aWindowId withSync:doSync |
293 | 3842 |
"return true, if any of the masked events is pending |
3843 |
for a specific window. |
|
3844 |
This expects a device dependent event mask as first argument." |
|
3845 |
||
3846 |
^ self subclassResponsibility |
|
3847 |
! |
|
3848 |
||
3849 |
setEventMask:aMask in:aWindowId |
|
310 | 3850 |
"arrange that only events from aMask are reported to a view. |
3851 |
Highly device specific, to be defined in concrete subclasses" |
|
3852 |
||
293 | 3853 |
^ self subclassResponsibility |
3854 |
! |
|
3855 |
||
3856 |
startDispatch |
|
1719
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3857 |
"create & start the display event dispatch process." |
293 | 3858 |
|
3859 |
|inputSema fd p nm| |
|
3860 |
||
1185
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3861 |
"/ |
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3862 |
"/ only allow one dispatcher process per display |
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3863 |
"/ |
293 | 3864 |
dispatching ifTrue:[^ self]. |
3865 |
dispatching := true. |
|
3866 |
||
3867 |
AllScreens isNil ifTrue:[ |
|
2858 | 3868 |
AllScreens := IdentitySet new:1 |
293 | 3869 |
]. |
3870 |
AllScreens add:self. |
|
3871 |
||
3872 |
fd := self displayFileDescriptor. |
|
3873 |
||
1185
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3874 |
"/ handle all incoming events from the device, sitting on a semaphore. |
1719
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3875 |
"/ Tell Processor to trigger this semaphore when some event arrives |
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3876 |
"/ for me. Since a select alone may not be enough to know if events are pending |
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3877 |
"/ (Xlib reads out event-queue while doing output), we also install a poll-check block. |
1697 | 3878 |
"/ The poll check is also req'd for systems where we cannot do a select |
3879 |
"/ on the eventQ (i.e. windows). |
|
1185
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3880 |
|
1719
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3881 |
inputSema := Semaphore new name:'display inputSema'. |
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
3882 |
|
762 | 3883 |
p := [ |
2858 | 3884 |
self initializeDeviceResources. |
3885 |
||
2892 | 3886 |
[ |
3887 |
[dispatching] whileTrue:[ |
|
3888 |
AbortSignal handle:[:ex | |
|
3889 |
ex return |
|
3890 |
] do:[ |
|
3891 |
self eventPending ifFalse:[ |
|
3892 |
Processor activeProcess setStateTo:#ioWait if:#active. |
|
3893 |
inputSema wait. |
|
3894 |
]. |
|
3895 |
||
3896 |
self dispatchPendingEvents. |
|
3897 |
] |
|
2858 | 3898 |
] |
2892 | 3899 |
] valueNowOrOnUnwindDo:[ |
3900 |
inputSema notNil ifTrue:[ |
|
3901 |
Processor disableSemaphore:inputSema. |
|
3902 |
inputSema := nil. |
|
3903 |
]. |
|
3904 |
dispatchProcess := nil. |
|
3905 |
self close. |
|
2858 | 3906 |
]. |
958 | 3907 |
] newProcess. |
1185
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3908 |
|
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3909 |
"/ |
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3910 |
"/ give the process a nice name (for the processMonitor) |
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
3911 |
"/ |
762 | 3912 |
(nm := self displayName) notNil ifTrue:[ |
2858 | 3913 |
nm := 'event dispatcher (' , nm , ')'. |
293 | 3914 |
] ifFalse:[ |
2858 | 3915 |
nm := 'event dispatcher'. |
762 | 3916 |
]. |
3917 |
p name:nm. |
|
958 | 3918 |
p priority:(Processor userInterruptPriority). |
3919 |
dispatchProcess := p. |
|
3920 |
p resume. |
|
3921 |
||
1719
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3922 |
"/ finally, arrange for the processor to signal that semaphore when input |
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3923 |
"/ is available or #eventPending returns true |
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3924 |
|
2275 | 3925 |
"/ fd isNil ifTrue:[ |
3926 |
"/ fd := -1 "/ has no fileDescriptor (i.e. Windows) - will poll |
|
3927 |
"/ ]. |
|
1719
c9d6b6fc6fb0
systems without a display fd install a checkBlock only and an fd of -1 (windows)
Claus Gittinger <cg@exept.de>
parents:
1717
diff
changeset
|
3928 |
Processor signal:inputSema onInput:fd orCheck:[self eventPending]. |
310 | 3929 |
|
2275 | 3930 |
"Modified: / 12.12.1995 / 20:52:57 / stefan" |
3931 |
"Modified: / 24.8.1998 / 18:36:29 / cg" |
|
2892 | 3932 |
! |
3933 |
||
3934 |
stopDispatch |
|
3935 |
"stop the dispatch process" |
|
3936 |
||
3937 |
|p| |
|
3938 |
||
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3939 |
LastActiveScreen == self ifTrue:[ |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3940 |
LastActiveScreen := nil. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3941 |
LastActiveProcess := nil. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3942 |
]. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
3943 |
|
2892 | 3944 |
(p := dispatchProcess) notNil ifTrue:[ |
3945 |
dispatchProcess := nil. |
|
3946 |
p terminateWithAllSubprocesses. |
|
3947 |
p terminateNoSignal. "/ just in case |
|
3948 |
] |
|
293 | 3949 |
! ! |
3950 |
||
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3951 |
!DeviceWorkstation methodsFor:'event sending'! |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3952 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3953 |
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3954 |
"send a keyPress/Release or buttonPress/Release event to some (possibly alien) view. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3955 |
TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3956 |
For buttonEvents, the keySymCodeOrButtonNr must be the buttons number (1, 2 ...); |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3957 |
for key events, it can be either a symbol (as listen in X's keySyms) |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3958 |
or a numeric keysym code. If state is nil, the modifier bits (shift & control) |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3959 |
are computed from the keyboardMap - if non-nil, these are passed as modifierbits. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3960 |
The non-nil case is the lowlevel entry, where state must include any shift/ctrl information |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3961 |
(not very user friendly)" |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3962 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3963 |
self subclassResponsibility |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3964 |
! |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3965 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3966 |
simulateKeyboardInput:aCharacterOrString inViewId:viewId |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3967 |
"send input to some other view, by simulating keyPress/keyRelease |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3968 |
events. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3969 |
Only a few control characters are supported. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3970 |
Notice: not all alien views allow this kind of synthetic input; |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3971 |
some simply ignore it." |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3972 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3973 |
|control code state| |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3974 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3975 |
aCharacterOrString isString ifTrue:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3976 |
aCharacterOrString do:[:char | |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3977 |
self simulateKeyboardInput:char inViewId:viewId |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3978 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3979 |
^ self |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3980 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3981 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3982 |
control := false. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3983 |
code := aCharacterOrString asciiValue. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3984 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3985 |
(aCharacterOrString == Character cr) ifTrue:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3986 |
code := #Return |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3987 |
] ifFalse:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3988 |
(aCharacterOrString == Character tab) ifTrue:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3989 |
code := #Tab |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3990 |
] ifFalse:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3991 |
(aCharacterOrString == Character esc) ifTrue:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3992 |
code := #Escape |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3993 |
] |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3994 |
] |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3995 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3996 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3997 |
control ifTrue:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3998 |
state := self controlMask |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
3999 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4000 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4001 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4002 |
"/ the stuff below should not be needed |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4003 |
"/ (sendKeyOrButtonevent should be able to figure out things itself) |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4004 |
"/ however, on some linux systems it seems to not work correctly. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4005 |
"/ Hopefully, this is correct ... |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4006 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4007 |
code isNumber ifTrue:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4008 |
code >= $A asciiValue ifTrue:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4009 |
code <= $Z asciiValue ifTrue:[ |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4010 |
state := self shiftMask |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4011 |
] |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4012 |
] |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4013 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4014 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4015 |
self sendKeyOrButtonEvent:#keyPress x:0 y:0 keyOrButton:code state:state toViewId:viewId. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4016 |
self sendKeyOrButtonEvent:#keyRelease x:0 y:0 keyOrButton:code state:state toViewId:viewId |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4017 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4018 |
" |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4019 |
sending input to some (possibly alien) view: |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4020 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4021 |
|point id| |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4022 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4023 |
point := Display pointFromUser. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4024 |
id := Display viewIdFromPoint:point. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4025 |
Display simulateKeyboardInput:'Hello_world' inViewId:id |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4026 |
" |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4027 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4028 |
"Modified: 11.6.1996 / 10:59:42 / cg" |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4029 |
! ! |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
4030 |
|
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4031 |
!DeviceWorkstation methodsFor:'font helpers'! |
293 | 4032 |
|
4033 |
ascentOf:aFontId |
|
4034 |
"return the number of pixels above the base line of a font" |
|
4035 |
||
4036 |
^ self subclassResponsibility |
|
4037 |
! |
|
4038 |
||
4039 |
descentOf:aFontId |
|
4040 |
"return the number of pixels below the base line of a font" |
|
4041 |
||
4042 |
^ self subclassResponsibility |
|
4043 |
! |
|
4044 |
||
439
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4045 |
encodingOf:aFontId |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4046 |
"return the characterEncoding of a font. |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4047 |
Here, we assume an ISO8859 (=ANSI) encoding" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4048 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4049 |
^ 'ISO8859-1' |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4050 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4051 |
"Created: 23.2.1996 / 00:39:06 / cg" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4052 |
! |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4053 |
|
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4054 |
maxAscentOf:aFontId |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4055 |
"return the number of pixels above the base line of the tallest character |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4056 |
in a font" |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4057 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4058 |
^ self subclassResponsibility |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4059 |
! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4060 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4061 |
maxDescentOf:aFontId |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4062 |
"return the number of pixels below the base line of the tallest character |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4063 |
in a font" |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4064 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4065 |
^ self subclassResponsibility |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4066 |
! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4067 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4068 |
maxWidthOfFont:aFontId |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4069 |
"return the width in pixels of the widest character a specific font" |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4070 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4071 |
^ self subclassResponsibility |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4072 |
! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4073 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4074 |
minWidthOfFont:aFontId |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4075 |
"return the width in pixels of the smallest character a specific font" |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4076 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4077 |
^ self subclassResponsibility |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4078 |
! ! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4079 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4080 |
!DeviceWorkstation methodsFor:'font stuff'! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4081 |
|
293 | 4082 |
facesInFamily:aFamilyName |
4083 |
"return a set of all available font faces in aFamily on this display" |
|
4084 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4085 |
^ self facesInFamily:aFamilyName filtering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4086 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4087 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4088 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4089 |
Display facesInFamily:'times' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4090 |
Display facesInFamily:'fixed' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4091 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4092 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4093 |
"Modified: 27.2.1996 / 01:33:47 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4094 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4095 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4096 |
facesInFamily:aFamilyName filtering:filterBlock |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4097 |
"return a set of all available font faces in aFamily on this display. |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4098 |
But only those matching filterBlock (if nonNil)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4099 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4100 |
|fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4101 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4102 |
fonts := self fontsInFamily:aFamilyName filtering:filterBlock. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4103 |
fonts size == 0 ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4104 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4105 |
^ (fonts collect:[:descr | descr face]) asSortedCollection |
293 | 4106 |
|
4107 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4108 |
Display facesInFamily:'fixed' filtering:[:f | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4109 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 4110 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4111 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4112 |
"Created: 27.2.1996 / 01:33:25 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4113 |
"Modified: 29.2.1996 / 04:29:01 / cg" |
293 | 4114 |
! |
4115 |
||
2220
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4116 |
flushListOfAvailableFonts |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4117 |
"flush any cached font information - dummy here, |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4118 |
but should be implemented in subclasses, which keep |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4119 |
a list of available device fonts. |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4120 |
This should be flushed, to allow update whenever new fonts |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4121 |
are installed or the system-font-path changes." |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4122 |
|
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4123 |
"Created: / 4.8.1998 / 16:52:13 / cg" |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4124 |
! |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
4125 |
|
293 | 4126 |
fontFamilies |
4127 |
"return a set of all available font families on this display" |
|
4128 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4129 |
^ self fontFamiliesFiltering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4130 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4131 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4132 |
Display fontFamilies |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4133 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4134 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4135 |
"Modified: 27.2.1996 / 01:31:14 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4136 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4137 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4138 |
fontFamiliesFiltering:aFilterBlock |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4139 |
"return a set of all available font families on this display, |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4140 |
but only those matching aFilterBlock (if nonNil)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4141 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4142 |
|fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4143 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4144 |
fonts := self fontsFiltering:aFilterBlock. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4145 |
fonts size == 0 ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4146 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4147 |
^ (fonts collect:[:descr | descr family]) asSortedCollection |
293 | 4148 |
|
4149 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4150 |
Display fontFamiliesFiltering:[:f | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4151 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 4152 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4153 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4154 |
"Modified: 29.2.1996 / 04:31:51 / cg" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4155 |
! |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4156 |
|
991 | 4157 |
fontMetricsOf:fontId into:aBlock |
4158 |
"evaluate aBlock, passing a fonts metrics as arguments" |
|
4159 |
||
1973 | 4160 |
|encoding avgAscent avgDescent |
991 | 4161 |
maxAscent maxDescent minWidth maxWidth avgWidth| |
4162 |
||
4163 |
encoding := self encodingOf:fontId. |
|
4164 |
avgAscent := self ascentOf:fontId. |
|
4165 |
avgDescent := self descentOf:fontId. |
|
4166 |
maxAscent := self maxAscentOf:fontId. |
|
4167 |
maxDescent := self maxDescentOf:fontId. |
|
4168 |
minWidth := self minWidthOfFont:fontId. |
|
4169 |
maxWidth := self maxWidthOfFont:fontId. |
|
4170 |
avgWidth := self widthOf:' ' inFont:fontId. |
|
4171 |
aBlock value:encoding |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4172 |
value:avgAscent |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4173 |
value:avgDescent |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4174 |
value:maxAscent |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4175 |
value:maxDescent |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4176 |
value:minWidth |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4177 |
value:maxWidth |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4178 |
value:avgWidth |
991 | 4179 |
! |
4180 |
||
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
4181 |
fontResolutionOf:fontId |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
4182 |
"return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution, |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
4183 |
but due to errors in some XServer installations, some use 75dpi fonts on higher |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
4184 |
resolution displays and vice/versa." |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
4185 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
4186 |
^ self resolution |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
4187 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
4188 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4189 |
fontsFiltering:aFilterBlock |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4190 |
"return a set of all available font on this display, |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4191 |
but only those matching aFilterBlock (if nonNil)." |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4192 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4193 |
|allFonts fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4194 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4195 |
allFonts := self listOfAvailableFonts. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4196 |
allFonts isNil ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4197 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4198 |
fonts := Set new. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4199 |
allFonts do:[:fntDescr | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4200 |
(aFilterBlock isNil or:[aFilterBlock value:fntDescr]) ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4201 |
fntDescr family notNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4202 |
fonts add:fntDescr |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4203 |
] |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4204 |
] |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4205 |
]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4206 |
^ fonts |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4207 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4208 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4209 |
Display fontsFiltering:[:f | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4210 |
f encoding notNil and:[f encoding startsWith:'jis']] |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4211 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4212 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4213 |
"Modified: 29.2.1996 / 04:30:35 / cg" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4214 |
! |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4215 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4216 |
fontsInFamily:aFamilyName face:aFaceName filtering:filter |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4217 |
"return a set of all available fonts in aFamily/aFace on this display. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4218 |
But only thise matching filter (if nonNil)." |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4219 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4220 |
|allFonts fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4221 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4222 |
allFonts := self listOfAvailableFonts. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4223 |
allFonts isNil ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4224 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4225 |
fonts := Set new. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4226 |
allFonts do:[:fntDescr | |
1906 | 4227 |
(aFamilyName match:fntDescr family) ifTrue:[ |
4228 |
(aFaceName match:fntDescr face) ifTrue:[ |
|
4229 |
(filter isNil or:[filter value:fntDescr]) ifTrue:[ |
|
4230 |
fonts add:fntDescr |
|
4231 |
] |
|
4232 |
] |
|
4233 |
] |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4234 |
]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4235 |
^ fonts |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4236 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4237 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4238 |
Display fontsInFamily:'fixed' face:'medium' filtering:[:f | |
1906 | 4239 |
f encoding notNil and:[f encoding startsWith:'jis']] |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4240 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4241 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4242 |
"Created: 29.2.1996 / 04:32:56 / cg" |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4243 |
"Modified: 30.6.1997 / 11:07:21 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4244 |
! |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4245 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4246 |
fontsInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4247 |
"return a set of all available font in aFamily/aFace/aStyle |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4248 |
on this display. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4249 |
But only those matching filter (if nonNIl)." |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4250 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4251 |
|allFonts fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4252 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4253 |
allFonts := self listOfAvailableFonts. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4254 |
allFonts isNil ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4255 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4256 |
fonts := Set new. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4257 |
allFonts do:[:fntDescr | |
1906 | 4258 |
(aFamilyName match:fntDescr family) ifTrue:[ |
4259 |
(aFaceName match:fntDescr face) ifTrue:[ |
|
4260 |
(aStyleName match:fntDescr style) ifTrue:[ |
|
4261 |
(filter isNil or:[filter value:fntDescr]) ifTrue:[ |
|
4262 |
fonts add:fntDescr |
|
4263 |
] |
|
4264 |
] |
|
4265 |
] |
|
4266 |
] |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4267 |
]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4268 |
^ fonts |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4269 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4270 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4271 |
Display fontsInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
1906 | 4272 |
f encoding notNil and:[f encoding startsWith:'jis']] |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4273 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4274 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4275 |
Display fontsInFamily:'fixed' face:'*' style:'roman' filtering:[:f | |
1906 | 4276 |
f encoding notNil and:[f encoding startsWith:'jis']] |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4277 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4278 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4279 |
"Created: 29.2.1996 / 04:25:30 / cg" |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4280 |
"Modified: 30.6.1997 / 11:07:08 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4281 |
! |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4282 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4283 |
fontsInFamily:aFamilyName filtering:filterBlock |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4284 |
"return a set of all available font in aFamily on this display. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4285 |
But only those matching filterBlock (if nonNil)." |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4286 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4287 |
|allFonts fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4288 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4289 |
allFonts := self listOfAvailableFonts. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4290 |
allFonts isNil ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4291 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4292 |
fonts := Set new. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4293 |
allFonts do:[:fntDescr | |
1906 | 4294 |
(aFamilyName match:fntDescr family) ifTrue:[ |
4295 |
(filterBlock isNil or:[filterBlock value:fntDescr]) ifTrue:[ |
|
4296 |
fonts add:fntDescr |
|
4297 |
] |
|
4298 |
] |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4299 |
]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4300 |
^ fonts |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4301 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4302 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4303 |
Display fontsInFamily:'fixed' filtering:[:f | |
1906 | 4304 |
f encoding notNil and:[f encoding startsWith:'jis']] |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4305 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4306 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4307 |
Display fontsInFamily:'*' filtering:[:f | |
1906 | 4308 |
f encoding notNil and:[f encoding startsWith:'jis']] |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4309 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4310 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4311 |
"Created: 29.2.1996 / 04:27:49 / cg" |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
4312 |
"Modified: 30.6.1997 / 11:06:36 / cg" |
293 | 4313 |
! |
4314 |
||
439
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4315 |
fullNameOf:aFontId |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4316 |
"return the full name of a font. |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4317 |
Here, we return nil, not knowing anything about fonts" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4318 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4319 |
^ nil |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4320 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4321 |
"Created: 23.2.1996 / 00:43:19 / cg" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4322 |
! |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
4323 |
|
293 | 4324 |
getDefaultFont |
4325 |
"return a default font id |
|
4326 |
- used when class Font cannot find anything usable" |
|
4327 |
||
4328 |
^ self subclassResponsibility |
|
4329 |
! |
|
4330 |
||
2854 | 4331 |
getFontWithFamily:familyString face:faceString style:styleString size:sizeArg encoding:encodingSym |
293 | 4332 |
|
4333 |
"try to get the specified font, return id. |
|
4334 |
If not available, try next smaller font. |
|
4335 |
If no font fits, return nil" |
|
4336 |
||
4337 |
^ self subclassResponsibility |
|
4338 |
! |
|
4339 |
||
4340 |
listOfAvailableFonts |
|
4341 |
"return a list containing all fonts on this display. |
|
4342 |
The returned list is an array of 4-element arrays, each |
|
4343 |
containing family, face, style, size and encoding." |
|
4344 |
||
535 | 4345 |
^ self subclassResponsibility |
293 | 4346 |
! |
4347 |
||
4348 |
releaseFont:aFontId |
|
4349 |
"free a font" |
|
4350 |
||
4351 |
^ self subclassResponsibility |
|
4352 |
! |
|
4353 |
||
4354 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName |
|
4355 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
|
4356 |
on this display" |
|
4357 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4358 |
^ self sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4359 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4360 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4361 |
Display sizesInFamily:'times' face:'medium' style:'italic' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4362 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4363 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4364 |
"Modified: 27.2.1996 / 01:38:42 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4365 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4366 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4367 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4368 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4369 |
on this display. |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4370 |
But only those matching filter (if nonNIl)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4371 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4372 |
|fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4373 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4374 |
fonts := self fontsInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4375 |
fonts size == 0 ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4376 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4377 |
^ fonts collect:[:descr | descr size]. |
293 | 4378 |
|
4379 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4380 |
Display sizesInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4381 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 4382 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4383 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4384 |
"Created: 27.2.1996 / 01:37:56 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4385 |
"Modified: 29.2.1996 / 04:26:52 / cg" |
293 | 4386 |
! |
4387 |
||
4388 |
stylesInFamily:aFamilyName face:aFaceName |
|
4389 |
"return a set of all available font styles in aFamily/aFace on this display" |
|
4390 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4391 |
^ self stylesInFamily:aFamilyName face:aFaceName filtering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4392 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4393 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4394 |
Display stylesInFamily:'times' face:'medium' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4395 |
Display stylesInFamily:'times' face:'bold' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4396 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4397 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4398 |
"Modified: 27.2.1996 / 01:35:43 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4399 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4400 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4401 |
stylesInFamily:aFamilyName face:aFaceName filtering:filter |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4402 |
"return a set of all available font styles in aFamily/aFace on this display. |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4403 |
But only thise matching filter (if nonNil)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4404 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4405 |
|fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4406 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4407 |
fonts := self fontsInFamily:aFamilyName face:aFaceName filtering:filter. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4408 |
fonts size == 0 ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4409 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4410 |
^ (fonts collect:[:descr | descr style]) asSortedCollection |
293 | 4411 |
|
4412 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4413 |
Display stylesInFamily:'fixed' face:'medium' filtering:[:f | |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4414 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 4415 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4416 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
4417 |
"Created: 27.2.1996 / 01:35:22 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
4418 |
"Modified: 29.2.1996 / 04:33:59 / cg" |
293 | 4419 |
! |
4420 |
||
4421 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
|
4422 |
"return the width in pixels of a substring in a specific font" |
|
4423 |
||
4424 |
^ self subclassResponsibility |
|
4425 |
! |
|
4426 |
||
4427 |
widthOf:aString inFont:aFontId |
|
4428 |
"return the width in pixels of a string in a specific font" |
|
4429 |
||
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4430 |
^ self widthOf:aString from:1 to:(aString size) inFont:aFontId |
293 | 4431 |
! ! |
4432 |
||
4433 |
!DeviceWorkstation methodsFor:'grabbing '! |
|
4434 |
||
4435 |
activeKeyboardGrab |
|
4436 |
"return the view, which currently has the keyboard grabbed, |
|
4437 |
or nil, if there is none" |
|
4438 |
||
4439 |
^ activeKeyboardGrab |
|
4440 |
! |
|
4441 |
||
4442 |
activePointerGrab |
|
4443 |
"return the view, which currently has the pointer grabbed, |
|
4444 |
or nil, if there is none" |
|
4445 |
||
4446 |
^ activePointerGrab |
|
4447 |
! |
|
4448 |
||
4449 |
grabKeyboardIn:aWindowId |
|
4450 |
"grab the keyboard - all keyboard input will be sent to the view |
|
4451 |
with id aWindowId" |
|
4452 |
||
4453 |
^ self subclassResponsibility |
|
4454 |
! |
|
4455 |
||
4456 |
grabKeyboardInView:aView |
|
4457 |
"grab the keyboard - all keyboard input will be sent to aView. |
|
4458 |
Return true if ok, false if it failed for some reason." |
|
4459 |
||
4460 |
activeKeyboardGrab notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4461 |
self ungrabKeyboard. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4462 |
activeKeyboardGrab := nil |
293 | 4463 |
]. |
4464 |
(self grabKeyboardIn:(aView id)) ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4465 |
activeKeyboardGrab := aView. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4466 |
^ true |
293 | 4467 |
]. |
4468 |
^ false |
|
4469 |
! |
|
4470 |
||
4471 |
grabPointerIn:aWindowId |
|
4472 |
"grap the pointer; all pointer events will be reported to the view |
|
4473 |
with id aWindowId. Return true if ok, false if it failed for some reason." |
|
4474 |
||
4475 |
^ self grabPointerIn:aWindowId withCursor:nil pointerMode:#async keyboardMode:#sync confineTo:nil |
|
4476 |
! |
|
4477 |
||
2583 | 4478 |
grabPointerIn:aWindowId withCursor:aCursorIdOrNil |
4479 |
"grap the pointer; all pointer events will be reported to the view |
|
4480 |
with id aWindowId. Return true if ok, false if it failed for some reason." |
|
4481 |
||
4482 |
^ self grabPointerIn:aWindowId withCursor:aCursorIdOrNil pointerMode:#async keyboardMode:#sync confineTo:nil |
|
4483 |
! |
|
4484 |
||
293 | 4485 |
grabPointerIn:aWindowId withCursor:cursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
4486 |
"grap the pointer - all pointer events will be reported to aWindowId. The cursor will be set to cursorId |
|
4487 |
for the duration of the grab. For pMode/kMode, see X documentation. The pointer is restricted to |
|
4488 |
confineId - if non-nil." |
|
4489 |
||
4490 |
^ self subclassResponsibility |
|
4491 |
! |
|
4492 |
||
4493 |
grabPointerInView:aView |
|
4494 |
"grap the pointer; all pointer events will be reported to |
|
4495 |
aView. Return true if ok, false if it failed for some reason." |
|
4496 |
||
4497 |
activePointerGrab notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4498 |
self ungrabPointer. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4499 |
activePointerGrab := nil |
293 | 4500 |
]. |
4501 |
(self grabPointerIn:(aView id)) ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4502 |
activePointerGrab := aView. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
4503 |
^ true |
293 | 4504 |
]. |
4505 |
^ false |
|
4506 |
! |
|
4507 |
||
4508 |
setActivePointerGrab:aView |
|
4509 |
"DO NOT USE. private kludge - will vanish" |
|
4510 |
||
4511 |
activePointerGrab := aView |
|
4512 |
! |
|
4513 |
||
4514 |
ungrabKeyboard |
|
4515 |
"release the keyboard" |
|
4516 |
||
4517 |
^ self subclassResponsibility |
|
4518 |
! |
|
4519 |
||
4520 |
ungrabPointer |
|
4521 |
"release the pointer" |
|
4522 |
||
4523 |
^ self subclassResponsibility |
|
4524 |
! ! |
|
4525 |
||
4526 |
!DeviceWorkstation methodsFor:'graphic context stuff'! |
|
4527 |
||
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
4528 |
noClipIn:aDrawableId gc:aGCId |
293 | 4529 |
"disable clipping rectangle" |
4530 |
||
4531 |
^ self subclassResponsibility |
|
4532 |
! |
|
4533 |
||
4534 |
setBackground:bgColorIndex in:aGCId |
|
4535 |
"set background color to be drawn with" |
|
4536 |
||
4537 |
^ self subclassResponsibility |
|
4538 |
! |
|
4539 |
||
4540 |
setBitmapMask:aBitmapId in:aGCId |
|
4541 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
|
4542 |
||
4543 |
^ self subclassResponsibility |
|
4544 |
! |
|
4545 |
||
1682 | 4546 |
setClipByChildren:aBool in:aDrawableID gc:aGCId |
293 | 4547 |
"enable/disable drawing into child views" |
4548 |
||
4549 |
^ self subclassResponsibility |
|
4550 |
! |
|
4551 |
||
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
4552 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:drawableId gc:aGCId |
293 | 4553 |
"clip to a rectangle" |
4554 |
||
4555 |
^ self subclassResponsibility |
|
4556 |
! |
|
4557 |
||
787 | 4558 |
setDashes:dashList dashOffset:offset in:aGCId |
4559 |
"set dash attributes. |
|
4560 |
Ignored here - it may be left unimplemented by some devices." |
|
4561 |
||
4562 |
^ self subclassResponsibility |
|
4563 |
||
4564 |
"Created: 4.6.1996 / 18:50:38 / cg" |
|
4565 |
"Modified: 4.6.1996 / 19:05:22 / cg" |
|
4566 |
! |
|
4567 |
||
293 | 4568 |
setFont:aFontId in:aGCId |
4569 |
"set font to be drawn in" |
|
4570 |
||
4571 |
^ self subclassResponsibility |
|
4572 |
! |
|
4573 |
||
4574 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
|
4575 |
"set foreground and background colors to be drawn with" |
|
4576 |
||
4577 |
^ self subclassResponsibility |
|
4578 |
! |
|
4579 |
||
4580 |
setForeground:fgColorIndex in:aGCId |
|
4581 |
"set foreground color to be drawn with" |
|
4582 |
||
4583 |
^ self subclassResponsibility |
|
4584 |
! |
|
4585 |
||
4586 |
setFunction:aFunctionSymbol in:aGCId |
|
4587 |
"set alu function to be drawn with" |
|
4588 |
||
4589 |
^ self subclassResponsibility |
|
4590 |
! |
|
4591 |
||
4592 |
setGraphicsExposures:aBoolean in:aGCId |
|
4593 |
"set or clear the graphics exposures flag" |
|
4594 |
||
4595 |
^ self subclassResponsibility |
|
4596 |
! |
|
4597 |
||
4598 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
|
4599 |
"set line attributes" |
|
4600 |
||
4601 |
^ self subclassResponsibility |
|
4602 |
! |
|
4603 |
||
4604 |
setMaskOriginX:orgX y:orgY in:aGCid |
|
4605 |
"set the mask origin" |
|
4606 |
||
4607 |
^ self subclassResponsibility |
|
4608 |
! |
|
4609 |
||
4610 |
setPixmapMask:aPixmapId in:aGCId |
|
4611 |
"set or clear the drawing mask - a pixmap mask providing full color" |
|
4612 |
||
4613 |
^ self subclassResponsibility |
|
4614 |
! ! |
|
4615 |
||
0 | 4616 |
!DeviceWorkstation methodsFor:'initialize / release'! |
4617 |
||
1973 | 4618 |
brokenConnection |
4619 |
"the connection to the display device was lost." |
|
4620 |
||
4621 |
displayId := nil. |
|
1989 | 4622 |
dispatching := false. |
1973 | 4623 |
|
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4624 |
LastActiveScreen == self ifTrue:[ |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4625 |
LastActiveScreen := nil. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4626 |
LastActiveProcess := nil. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4627 |
]. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4628 |
|
1973 | 4629 |
"/ tell all of my views about this. |
4630 |
"/ first, all topViews get a notification ... |
|
4631 |
||
4632 |
self allViewsDo:[:aView | |
|
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4633 |
aView isTopView ifTrue:[ |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4634 |
aView destroyed |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4635 |
] |
1973 | 4636 |
]. |
4637 |
||
4638 |
self releaseDeviceResources. |
|
4639 |
||
4640 |
"Modified: 11.4.1997 / 10:44:33 / cg" |
|
4641 |
! |
|
4642 |
||
293 | 4643 |
close |
4644 |
"close down connection to Display - usually never done" |
|
4645 |
||
1196 | 4646 |
self releaseDeviceResources. |
1194
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4647 |
self closeConnection. |
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4648 |
|
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4649 |
"Modified: 13.1.1997 / 22:13:18 / cg" |
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4650 |
! |
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4651 |
|
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4652 |
closeConnection |
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4653 |
"close down connection to Display - usually never done" |
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4654 |
|
293 | 4655 |
^ self subclassResponsibility |
1194
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4656 |
|
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
4657 |
"Created: 13.1.1997 / 22:10:07 / cg" |
293 | 4658 |
! |
4659 |
||
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4660 |
exitOnLastClose:aBoolean |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4661 |
"set/clear the flag which controls if the |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4662 |
event dispatching should stop when the last view is closed." |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4663 |
|
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4664 |
self == Display ifTrue:[ |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4665 |
ExitOnLastClose := aBoolean |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4666 |
]. |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4667 |
exitOnLastClose := aBoolean |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4668 |
|
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4669 |
"Modified: 23.4.1996 / 22:01:28 / cg" |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4670 |
! |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
4671 |
|
0 | 4672 |
initialize |
4673 |
"initialize the receiver for a connection to the default display" |
|
4674 |
||
2025 | 4675 |
idToTableIndexMapping notNil ifTrue:[ |
2027
50a7f23a6210
oops - multiple calls to Display initialize do happen ...
Claus Gittinger <cg@exept.de>
parents:
2025
diff
changeset
|
4676 |
"/ assume, I am already initialized ... |
50a7f23a6210
oops - multiple calls to Display initialize do happen ...
Claus Gittinger <cg@exept.de>
parents:
2025
diff
changeset
|
4677 |
^ self. |
2025 | 4678 |
]. |
4679 |
||
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
4680 |
idToTableIndexMapping := Dictionary new:100. |
1406
2aa01c6279f0
fast mapping from viewID to view (experimental)
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
4681 |
|
0 | 4682 |
^ self initializeFor:nil |
1406
2aa01c6279f0
fast mapping from viewID to view (experimental)
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
4683 |
|
2025 | 4684 |
"Modified: / 27.1.1998 / 20:17:27 / cg" |
0 | 4685 |
! |
4686 |
||
2861
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4687 |
initializeDefaultValues |
2866 | 4688 |
isSlow := false. |
4689 |
motionEventCompression := true. |
|
2861
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4690 |
buttonTranslation := ButtonTranslation. |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4691 |
multiClickTimeDelta := MultiClickTimeDelta. |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4692 |
|
2867 | 4693 |
shiftDown := false. |
4694 |
ctrlDown := false. |
|
4695 |
metaDown := false. |
|
4696 |
altDown := false. |
|
4697 |
||
2861
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4698 |
self initializeModifierMappings |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4699 |
|
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4700 |
|
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4701 |
! |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4702 |
|
1196 | 4703 |
initializeDeviceResources |
4704 |
"initialize heavily used device resources - to avoid looking them up later" |
|
4705 |
||
1623 | 4706 |
blackColor isNil ifTrue:[ |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4707 |
blackColor := Color black onDevice:self. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4708 |
whiteColor := Color white onDevice:self. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4709 |
Color getPrimaryColorsOn:self. |
1623 | 4710 |
] |
1369 | 4711 |
|
4712 |
"Modified: 24.2.1997 / 22:07:50 / cg" |
|
1196 | 4713 |
! |
4714 |
||
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4715 |
initializeDeviceSignals |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4716 |
deviceErrorSignal := DeviceErrorSignal newSignalMayProceed:false. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4717 |
deviceErrorSignal nameClass:self message:#deviceErrorSignal. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4718 |
deviceIOErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4719 |
deviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4720 |
! |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4721 |
|
0 | 4722 |
initializeFor:aDisplayOrNilForAny |
4723 |
"initialize the receiver for a connection to a display. If the |
|
4724 |
argument is non-nil, it should specify which workstation should be |
|
4725 |
connected to (in a device specific manner). For X displays, this is |
|
4726 |
to be the display-string i.e. hostname:displayNr. |
|
4727 |
If the argument is nil, connect to the default display." |
|
4728 |
||
71 | 4729 |
^ self subclassResponsibility |
0 | 4730 |
! |
4731 |
||
293 | 4732 |
initializeKeyboardMap |
4733 |
"keystrokes from the server are translated via the keyboard map. |
|
4734 |
Untranslated keystrokes arrive either as characters, or symbols |
|
4735 |
(which are the keySyms as symbol). The mapping table which is |
|
4736 |
setup here, is used in sendKeyPress:... later. |
|
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
4737 |
Here, an empty (no-translation) keyboard map is setup initially; |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
4738 |
this is usually filled via the keyboard.rc startup file. |
293 | 4739 |
" |
4740 |
||
4741 |
keyboardMap isNil ifTrue:[ |
|
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
4742 |
keyboardMap := KeyboardMap new. |
293 | 4743 |
]. |
4744 |
||
4745 |
" |
|
4746 |
no more setup here - moved everything out into 'display.rc' file |
|
4747 |
" |
|
0 | 4748 |
! |
4749 |
||
2861
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4750 |
initializeModifierMappings |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4751 |
shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil. |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4752 |
|
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4753 |
shiftModifiers := #(Shift_L Shift_R Shift). |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4754 |
ctrlModifiers := #(Control_L Control_R Control). |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4755 |
metaModifiers := #(Alt_L Meta_L Meta_R Meta). |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4756 |
altModifiers := #(Alt_R Alt). |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4757 |
|
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4758 |
|
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4759 |
! |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
4760 |
|
814 | 4761 |
initializeScreenProperties |
4762 |
"setup screen specific properties." |
|
4763 |
||
885
07df2e77a8fe
dont clobber the supportsDeepIcons flag
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
4764 |
supportsDeepIcons isNil ifTrue:[ |
1675 | 4765 |
supportsDeepIcons := false. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
4766 |
]. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
4767 |
|
1768 | 4768 |
fixColors := fixGrayColors := ditherColors := nil. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
4769 |
numFixRed := numFixGreen := numFixBlue := 0. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
4770 |
|
1622 | 4771 |
"Modified: 21.4.1997 / 12:04:37 / cg" |
814 | 4772 |
! |
4773 |
||
276
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
4774 |
invalidateConnection |
609 | 4775 |
"clear my connection handle - sent after an imageRestart to |
4776 |
forget about our previous life" |
|
4777 |
||
276
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
4778 |
displayId := nil |
609 | 4779 |
|
4780 |
"Modified: 24.4.1996 / 19:38:46 / cg" |
|
276
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
4781 |
! |
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
4782 |
|
0 | 4783 |
reinitialize |
4784 |
"reinit after snapin" |
|
4785 |
||
505
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
4786 |
|prevKnownViews prevMapping prevWidth prevHeight| |
0 | 4787 |
|
2846 | 4788 |
self releaseDeviceFonts. |
2845 | 4789 |
self releaseDeviceCursors. |
4790 |
self releaseDeviceColors. |
|
4791 |
||
4792 |
"/ Color flushDeviceColorsFor:self. |
|
414
bf996c417cc8
flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents:
405
diff
changeset
|
4793 |
|
0 | 4794 |
displayId := nil. |
51 | 4795 |
dispatching := false. |
151 | 4796 |
dispatchProcess := nil. |
46 | 4797 |
|
505
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
4798 |
prevWidth := width. |
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
4799 |
prevHeight := height. |
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
4800 |
|
46 | 4801 |
"/ prevMapping := idToViewMapping. |
4802 |
"/ idToViewMapping := nil. |
|
4803 |
||
0 | 4804 |
prevKnownViews := knownViews. |
2403 | 4805 |
idToTableIndexMapping := nil. |
0 | 4806 |
knownViews := nil. |
4807 |
knownIds := nil. |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
4808 |
lastId := nil. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
4809 |
lastView := nil. |
0 | 4810 |
|
4811 |
self initializeFor:nil. |
|
899
fda82596dea6
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
4812 |
displayId isNil ifTrue:[ |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4813 |
'DevWorkstation [error]: could not connect to display' errorPrintCR. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4814 |
Smalltalk exit. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4815 |
^ self |
899
fda82596dea6
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
4816 |
]. |
0 | 4817 |
|
43 | 4818 |
" |
4819 |
first, all Forms must be recreated |
|
51 | 4820 |
(since they may be needed for view recreation as |
43 | 4821 |
background or icons) |
4822 |
" |
|
0 | 4823 |
Form reinitializeAllOn:self. |
4824 |
||
46 | 4825 |
"/ prevMapping notNil ifTrue:[ |
0 | 4826 |
prevKnownViews notNil ifTrue:[ |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4827 |
" |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4828 |
first round: flush all device specific stuff |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4829 |
" |
51 | 4830 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4831 |
prevKnownViews do:[:aView | |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4832 |
(aView notNil and:[aView ~~ 0]) ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4833 |
aView prepareForReinit |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4834 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4835 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4836 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4837 |
" |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4838 |
2nd round: all views should reinstall themself |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4839 |
on the new display |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4840 |
" |
51 | 4841 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
505
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
4842 |
|
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4843 |
prevKnownViews do:[:aView | |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4844 |
(aView notNil and:[aView ~~ 0]) ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4845 |
"have to re-create the view" |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4846 |
UserInterruptSignal catch:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4847 |
AbortSignal catch:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4848 |
GraphicsContext drawingOnClosedDrawableSignal handle:[:ex | |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4849 |
'DeviceWorkstation [warning]: drawing attempt on closed drawable during reinit' errorPrintCR. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4850 |
ex return |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4851 |
] do:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4852 |
aView reinitialize |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4853 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4854 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4855 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4856 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4857 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4858 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4859 |
(prevWidth ~~ width |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4860 |
or:[prevHeight ~~ height]) ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4861 |
" |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4862 |
3rd round: all views get a chance to handle |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4863 |
changed environment (colors, font sizes etc) |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4864 |
" |
505
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
4865 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4866 |
prevKnownViews do:[:aView | |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4867 |
(aView notNil and:[aView ~~ 0]) ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4868 |
aView reAdjustGeometry |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4869 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4870 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4871 |
] |
0 | 4872 |
]. |
8 | 4873 |
dispatching := false. |
505
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
4874 |
|
2139
717e95ca7308
handle user interrupt during reinitialization
Claus Gittinger <cg@exept.de>
parents:
2126
diff
changeset
|
4875 |
"Modified: / 7.6.1998 / 02:45:13 / cg" |
1196 | 4876 |
! |
4877 |
||
4878 |
releaseDeviceResources |
|
2837 | 4879 |
"release any cached device resources. |
4880 |
This is invoked when closed or when the display connection is broken |
|
4881 |
(i.e. be prepared to not be able to release resources regularily)" |
|
4882 |
||
4883 |
"/ blackColor notNil ifTrue:[ |
|
4884 |
"/ blackColor on:nil. |
|
4885 |
"/ ]. |
|
4886 |
"/ whiteColor notNil ifTrue:[ |
|
4887 |
"/ whiteColor on:nil. |
|
4888 |
"/ ]. |
|
4889 |
||
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4890 |
LastActiveScreen == self ifTrue:[ |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4891 |
LastActiveScreen := nil. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4892 |
LastActiveProcess := nil. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4893 |
]. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
4894 |
|
2837 | 4895 |
blackColor := whiteColor := nil. |
1225
797de68f0760
release deviceResources when closing a connection
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
4896 |
|
1231 | 4897 |
Image releaseResourcesOnDevice:self. |
2837 | 4898 |
self releaseDeviceColors. |
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2838
diff
changeset
|
4899 |
self releaseDeviceCursors. |
2846 | 4900 |
self releaseDeviceFonts. |
1225
797de68f0760
release deviceResources when closing a connection
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
4901 |
DeviceGraphicsContext releaseResourcesOnDevice:self. |
797de68f0760
release deviceResources when closing a connection
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
4902 |
|
2837 | 4903 |
focusView := activeView := rootView := lastView := nil. |
4904 |
activeKeyboardGrab := activePointerGrab := nil. |
|
4905 |
AllScreens remove:self ifAbsent:nil. |
|
4906 |
||
1231 | 4907 |
"Modified: 16.1.1997 / 19:34:11 / cg" |
133 | 4908 |
! ! |
4909 |
||
71 | 4910 |
!DeviceWorkstation methodsFor:'interactive queries'! |
4911 |
||
1843 | 4912 |
colorFromUser |
4913 |
"{ Pragma: +optSpace }" |
|
4914 |
||
4915 |
"let user specify a point on the screen (by pressing the left button), |
|
4916 |
return the color of that pixel." |
|
4917 |
||
1973 | 4918 |
|p| |
1843 | 4919 |
|
4920 |
p := self pointFromUser. |
|
4921 |
^ self rootView colorAt:p |
|
4922 |
||
4923 |
" |
|
4924 |
Display colorFromUser |
|
4925 |
" |
|
4926 |
||
4927 |
"Modified: 1.8.1997 / 20:00:41 / cg" |
|
4928 |
! |
|
4929 |
||
293 | 4930 |
originFromUser:extent |
1198 | 4931 |
"{ Pragma: +optSpace }" |
4932 |
||
293 | 4933 |
"let user specify a rectangles origin on the screen, return the rectangle. |
4934 |
Start with initialRectangle. |
|
4935 |
Can be used for dragging operations." |
|
4936 |
||
4937 |
|curs origin root rect| |
|
4938 |
||
1499 | 4939 |
curs := Cursor origin onDevice:self. |
293 | 4940 |
|
4941 |
" |
|
4942 |
just in case; wait for button to be down ... |
|
4943 |
" |
|
2252 | 4944 |
[self leftButtonPressed] whileFalse:[Delay waitForSeconds:0.05]. |
293 | 4945 |
|
4946 |
root := self rootView. |
|
4947 |
||
4948 |
" |
|
4949 |
grab and wait for leftButton being pressed |
|
4950 |
" |
|
4951 |
origin := self pointerPosition. |
|
4952 |
||
1722 | 4953 |
root clippedByChildren:false. |
1198 | 4954 |
root foreground:blackColor background:whiteColor. |
293 | 4955 |
|
4956 |
root xoring:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4957 |
|left right top bottom newOrigin newCorner p| |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4958 |
|
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4959 |
rect := origin extent:extent. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4960 |
root displayRectangle:rect. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4961 |
|
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4962 |
self |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4963 |
grabPointerIn:root id |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4964 |
withCursor:curs id |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4965 |
pointerMode:#async |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4966 |
keyboardMode:#sync |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4967 |
confineTo:nil. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4968 |
|
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4969 |
[self leftButtonPressed] whileTrue:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4970 |
newOrigin := self pointerPosition. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4971 |
|
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4972 |
(newOrigin ~= origin) ifTrue:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4973 |
root displayRectangle:rect. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4974 |
|
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4975 |
self |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4976 |
grabPointerIn:root id |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4977 |
withCursor:curs id |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4978 |
pointerMode:#async |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4979 |
keyboardMode:#sync |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4980 |
confineTo:nil. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4981 |
|
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4982 |
rect := newOrigin extent:extent. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4983 |
root displayRectangle:rect. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4984 |
self disposeButtonEventsFor:nil. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4985 |
self flush. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4986 |
origin := newOrigin. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4987 |
] ifFalse:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4988 |
Delay waitForSeconds:0.05 |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4989 |
] |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4990 |
]. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4991 |
root displayRectangle:rect. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
4992 |
self ungrabPointer. |
293 | 4993 |
]. |
4994 |
||
4995 |
self ungrabPointer. |
|
4996 |
||
4997 |
"flush all events pending on my display" |
|
4998 |
||
1722 | 4999 |
root clippedByChildren:true. |
293 | 5000 |
|
5001 |
self flush. |
|
5002 |
self disposeButtonEventsFor:nil. |
|
5003 |
||
5004 |
^ rect |
|
5005 |
||
5006 |
" |
|
5007 |
Display originFromUser:200@200 |
|
5008 |
" |
|
1198 | 5009 |
|
2252 | 5010 |
"Modified: / 18.8.1998 / 15:00:14 / cg" |
293 | 5011 |
! |
5012 |
||
5013 |
pointFromUser |
|
1198 | 5014 |
"{ Pragma: +optSpace }" |
5015 |
||
293 | 5016 |
"let user specify a point on the screen (by pressing the left button)" |
5017 |
||
5018 |
^ self pointFromUserShowing:(Cursor crossHair). |
|
5019 |
||
5020 |
" |
|
5021 |
Display pointFromUser |
|
5022 |
" |
|
1198 | 5023 |
|
5024 |
"Modified: 13.1.1997 / 22:53:05 / cg" |
|
293 | 5025 |
! |
5026 |
||
81 | 5027 |
pointFromUserShowing:aCursor |
1198 | 5028 |
"{ Pragma: +optSpace }" |
5029 |
||
81 | 5030 |
"let user specify a point on the screen (by pressing leftButton). |
5031 |
Show aCursor while waiting." |
|
5032 |
||
5033 |
|p| |
|
23 | 5034 |
|
5035 |
self ungrabPointer. |
|
1499 | 5036 |
self grabPointerIn:(self rootWindowId) withCursor:((aCursor onDevice:self) id) |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5037 |
pointerMode:#async keyboardMode:#sync confineTo:nil. |
134 | 5038 |
activePointerGrab := rootView. |
81 | 5039 |
|
157 | 5040 |
" |
5041 |
wait for leftButton ... |
|
5042 |
" |
|
2252 | 5043 |
[self leftButtonPressed] whileFalse:[Delay waitForSeconds:0.05]. |
157 | 5044 |
|
23 | 5045 |
p := self pointerPosition. |
5046 |
||
5047 |
self ungrabPointer. |
|
5048 |
||
5049 |
"flush all events pending on myself" |
|
81 | 5050 |
self disposeButtonEventsFor:nil. |
23 | 5051 |
^ p |
5052 |
||
71 | 5053 |
" |
81 | 5054 |
Display pointFromUserShowing:(Cursor stop) |
133 | 5055 |
Display pointFromUserShowing:(Cursor crossHair) |
157 | 5056 |
Display pointFromUserShowing:(Cursor origin) |
81 | 5057 |
Display pointFromUser |
5058 |
" |
|
1198 | 5059 |
|
2252 | 5060 |
"Modified: / 18.8.1998 / 15:00:19 / cg" |
81 | 5061 |
! |
5062 |
||
293 | 5063 |
rectangleFromUser |
1198 | 5064 |
"{ Pragma: +optSpace }" |
5065 |
||
293 | 5066 |
"let user specify a rectangle in the screen, return the rectangle" |
5067 |
||
5068 |
|origin| |
|
81 | 5069 |
|
5070 |
" |
|
293 | 5071 |
get origin |
5072 |
" |
|
1499 | 5073 |
origin := self pointFromUserShowing:(Cursor origin onDevice:self). |
293 | 5074 |
|
5075 |
" |
|
5076 |
get corner |
|
5077 |
" |
|
5078 |
^ self rectangleFromUser:(origin corner:origin). |
|
5079 |
||
5080 |
" |
|
5081 |
Display rectangleFromUser |
|
71 | 5082 |
" |
1198 | 5083 |
|
1499 | 5084 |
"Modified: 28.3.1997 / 16:14:44 / cg" |
23 | 5085 |
! |
5086 |
||
81 | 5087 |
rectangleFromUser:initialRectangle |
1198 | 5088 |
"{ Pragma: +optSpace }" |
5089 |
||
81 | 5090 |
"let user specify a rectangle on the screen, return the rectangle. |
133 | 5091 |
Start with initialRectangle. |
5092 |
A helper for rectangleFromUser; can also be used for resizing operations." |
|
81 | 5093 |
|
1824 | 5094 |
^ self rectangleFromUser:initialRectangle keepExtent:false |
5095 |
||
5096 |
" |
|
5097 |
Display rectangleFromUser:(100@100 corner:300@300) |
|
5098 |
" |
|
5099 |
||
5100 |
"Modified: 24.7.1997 / 16:04:54 / cg" |
|
5101 |
! |
|
5102 |
||
5103 |
rectangleFromUser:initialRectangle keepExtent:keepExtent |
|
5104 |
"{ Pragma: +optSpace }" |
|
5105 |
||
5106 |
"let user specify a rectangle on the screen, return the rectangle. |
|
5107 |
Start with initialRectangle. |
|
5108 |
A helper for rectangleFromUser; can also be used for resizing operations." |
|
5109 |
||
2324
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
5110 |
|curs1 origin corner root rect doRegrab| |
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
5111 |
|
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
5112 |
"/ regrabbing leads to horrible flicker and |
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
5113 |
"/ events being sent to applications under the mouse. |
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
5114 |
"/ on windows displays. |
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
5115 |
doRegrab := self class ~~ WinWorkstation. |
157 | 5116 |
|
1824 | 5117 |
keepExtent ifTrue:[ |
2428 | 5118 |
curs1 := Cursor origin |
1824 | 5119 |
] ifFalse:[ |
2428 | 5120 |
curs1 := Cursor corner |
1824 | 5121 |
]. |
5122 |
curs1 := curs1 onDevice:self. |
|
134 | 5123 |
root := self rootView. |
81 | 5124 |
|
5125 |
" |
|
5126 |
grab and wait for leftButton being pressed |
|
5127 |
" |
|
5128 |
origin := initialRectangle origin. |
|
5129 |
||
1722 | 5130 |
root clippedByChildren:false. |
1198 | 5131 |
root foreground:blackColor background:whiteColor. |
81 | 5132 |
|
5133 |
root xoring:[ |
|
2428 | 5134 |
|left right top bottom newOrigin newCorner p curs| |
5135 |
||
5136 |
keepExtent ifFalse:[ |
|
5137 |
corner := origin. |
|
5138 |
rect := origin corner:corner. |
|
5139 |
root displayRectangle:rect. |
|
5140 |
]. |
|
5141 |
||
5142 |
self |
|
5143 |
grabPointerIn:root id |
|
5144 |
withCursor:curs1 id |
|
5145 |
pointerMode:#async |
|
5146 |
keyboardMode:#sync |
|
5147 |
confineTo:nil. |
|
5148 |
||
5149 |
" |
|
5150 |
just in case; wait for button to be down ... |
|
5151 |
" |
|
5152 |
[self leftButtonPressed] whileFalse:[Delay waitForSeconds:0.05]. |
|
5153 |
||
5154 |
keepExtent ifTrue:[ |
|
5155 |
p := self pointerPosition. |
|
5156 |
origin := p. |
|
5157 |
corner := origin + initialRectangle extent. |
|
5158 |
rect := origin corner:corner. |
|
5159 |
root displayRectangle:rect. |
|
5160 |
]. |
|
5161 |
||
5162 |
[self leftButtonPressed] whileTrue:[ |
|
5163 |
left := initialRectangle origin x. |
|
5164 |
top := initialRectangle origin y. |
|
5165 |
right := initialRectangle corner x. |
|
5166 |
bottom := initialRectangle corner y. |
|
5167 |
||
5168 |
p := self pointerPosition. |
|
5169 |
keepExtent ifTrue:[ |
|
5170 |
newOrigin := p. |
|
5171 |
newCorner := newOrigin + initialRectangle extent. |
|
5172 |
curs := curs1. |
|
5173 |
] ifFalse:[ |
|
5174 |
p x < initialRectangle left ifTrue:[ |
|
5175 |
p y < initialRectangle top ifTrue:[ |
|
5176 |
curs := Cursor topLeft. |
|
5177 |
left := p x. |
|
5178 |
top := p y. |
|
5179 |
] ifFalse:[ |
|
5180 |
curs := Cursor bottomLeft. |
|
5181 |
left := p x. |
|
5182 |
bottom := p y |
|
5183 |
] |
|
5184 |
] ifFalse:[ |
|
5185 |
p y < initialRectangle top ifTrue:[ |
|
5186 |
curs := Cursor topRight. |
|
5187 |
right := p x. |
|
5188 |
top := p y |
|
5189 |
] ifFalse:[ |
|
5190 |
curs := Cursor bottomRight. |
|
5191 |
right := p x. |
|
5192 |
bottom := p y |
|
5193 |
] |
|
5194 |
]. |
|
5195 |
||
5196 |
newOrigin := left @ top. |
|
5197 |
newCorner := right @ bottom. |
|
5198 |
]. |
|
5199 |
||
5200 |
((newOrigin ~= origin) or:[newCorner ~= corner]) ifTrue:[ |
|
5201 |
root displayRectangle:rect. |
|
5202 |
doRegrab ifTrue:[ |
|
5203 |
self grabPointerIn:root id |
|
5204 |
withCursor:curs id |
|
5205 |
pointerMode:#async |
|
5206 |
keyboardMode:#sync |
|
5207 |
confineTo:nil. |
|
5208 |
]. |
|
5209 |
||
5210 |
origin := newOrigin. |
|
5211 |
corner := newCorner. |
|
5212 |
rect := origin corner:corner. |
|
5213 |
root displayRectangle:rect. |
|
5214 |
self disposeButtonEventsFor:nil. |
|
5215 |
self flush. |
|
5216 |
] ifFalse:[ |
|
5217 |
Delay waitForSeconds:0.05 |
|
5218 |
] |
|
5219 |
]. |
|
5220 |
root displayRectangle:rect. |
|
5221 |
self ungrabPointer. |
|
23 | 5222 |
]. |
5223 |
||
5224 |
self ungrabPointer. |
|
5225 |
||
5226 |
"flush all events pending on my display" |
|
81 | 5227 |
|
1722 | 5228 |
root clippedByChildren:true. |
81 | 5229 |
|
151 | 5230 |
self flush. |
81 | 5231 |
self disposeButtonEventsFor:nil. |
5232 |
||
5233 |
^ rect |
|
157 | 5234 |
|
5235 |
" |
|
1824 | 5236 |
Display rectangleFromUser |
157 | 5237 |
Display rectangleFromUser:(100@100 corner:300@300) |
1824 | 5238 |
Display rectangleFromUser:(100@100 corner:300@300) keepExtent:true |
5239 |
" |
|
5240 |
||
2252 | 5241 |
"Created: / 24.7.1997 / 15:26:47 / cg" |
2324
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
5242 |
"Modified: / 10.9.1998 / 17:38:41 / cg" |
81 | 5243 |
! |
5244 |
||
293 | 5245 |
topviewFromUser |
1198 | 5246 |
"{ Pragma: +optSpace }" |
5247 |
||
293 | 5248 |
"let user specify a view on the screen; if the selected view is |
5249 |
not an ST/X view, nil is returned. |
|
5250 |
Otherwise, the topview is returned." |
|
5251 |
||
5252 |
|v| |
|
5253 |
||
5254 |
v := self viewFromUser. |
|
5255 |
v notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5256 |
v := v topView |
293 | 5257 |
]. |
5258 |
^ v |
|
157 | 5259 |
|
5260 |
" |
|
293 | 5261 |
Display topviewFromUser |
157 | 5262 |
" |
1198 | 5263 |
|
5264 |
"Modified: 13.1.1997 / 22:53:15 / cg" |
|
190 | 5265 |
! |
5266 |
||
23 | 5267 |
viewFromUser |
1198 | 5268 |
"{ Pragma: +optSpace }" |
5269 |
||
23 | 5270 |
"let user specify a view on the screen; if the selected view is |
133 | 5271 |
not an ST/X view, nil is returned. |
5272 |
This returns the view being clicked in, which is not always a topView. |
|
5273 |
(send topView to the returned view or use topviewFromUser, |
|
5274 |
to get the topview)" |
|
23 | 5275 |
|
71 | 5276 |
^ self viewFromPoint:(self pointFromUser) |
5277 |
||
5278 |
" |
|
133 | 5279 |
Display viewFromUser |
71 | 5280 |
" |
5281 |
" |
|
5282 |
|v| |
|
5283 |
v := Display viewFromUser. |
|
5284 |
v notNil ifTrue:[v topView] ifFalse:[nil] |
|
5285 |
" |
|
1198 | 5286 |
|
5287 |
"Modified: 13.1.1997 / 22:53:17 / cg" |
|
71 | 5288 |
! |
5289 |
||
293 | 5290 |
viewIdFromUser |
1198 | 5291 |
"{ Pragma: +optSpace }" |
5292 |
||
293 | 5293 |
"let user specify a view on the screen, return its window id. |
5294 |
This works even for non smalltalk views. |
|
5295 |
This returns the id of the view being clicked in, |
|
5296 |
which is not always a topView." |
|
5297 |
||
5298 |
^ self viewIdFromPoint:(self pointFromUser) |
|
71 | 5299 |
|
5300 |
" |
|
293 | 5301 |
Display viewIdFromUser |
71 | 5302 |
" |
293 | 5303 |
|
5304 |
"Created: 18.9.1995 / 23:07:20 / claus" |
|
1198 | 5305 |
"Modified: 13.1.1997 / 22:53:20 / cg" |
0 | 5306 |
! ! |
5307 |
||
5308 |
!DeviceWorkstation methodsFor:'keyboard mapping'! |
|
5309 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5310 |
altModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5311 |
"Return the set of keys which are treated as Alt-keys. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5312 |
This set is initialized at startup from what the server thinks |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5313 |
are alt-keys." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5314 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5315 |
^ altModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5316 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5317 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5318 |
Display altModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5319 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5320 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5321 |
"Created: 2.1.1996 / 14:57:13 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5322 |
"Modified: 2.1.1996 / 15:01:54 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5323 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5324 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5325 |
altModifiers:arrayOfAltModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5326 |
"Change the set of keys which are treated as Alt-keys." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5327 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5328 |
altModifiers := arrayOfAltModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5329 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5330 |
"Created: 2.1.1996 / 14:58:24 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5331 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5332 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5333 |
metaModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5334 |
"Return the set of keys which are treated as Meta-keys (i.e. Cmd-keys). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5335 |
This set is initialized at startup from what the server thinks |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5336 |
are meta-keys." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5337 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5338 |
^ metaModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5339 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5340 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5341 |
Display metaModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5342 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5343 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5344 |
"Created: 2.1.1996 / 14:57:35 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5345 |
"Modified: 2.1.1996 / 15:02:00 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5346 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5347 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5348 |
metaModifiers:arrayOfMetaModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5349 |
"Change the set of keys which are treated as Meta-keys (i.e. Cmd keys)." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5350 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5351 |
metaModifiers := arrayOfMetaModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5352 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5353 |
"Created: 2.1.1996 / 14:58:41 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5354 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5355 |
|
293 | 5356 |
modifierKeyProcessing:key down:pressed |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5357 |
"internal, private method. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5358 |
Called with every keyPress/keyRelease to update the xxxDown flags." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5359 |
|
293 | 5360 |
(altModifiers notNil and:[altModifiers includes:key]) ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5361 |
altDown := pressed |
293 | 5362 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5363 |
(metaModifiers notNil and:[metaModifiers includes:key]) ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5364 |
metaDown := pressed |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5365 |
] ifFalse:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5366 |
(shiftModifiers notNil and:[shiftModifiers includes:key]) ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5367 |
shiftDown := pressed |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5368 |
] ifFalse:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5369 |
(ctrlModifiers notNil and:[ctrlModifiers includes:key]) ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5370 |
ctrlDown := pressed |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5371 |
] |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5372 |
] |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5373 |
] |
293 | 5374 |
] |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5375 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5376 |
"Modified: 2.1.1996 / 15:00:25 / cg" |
293 | 5377 |
! |
5378 |
||
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5379 |
modifierKeyTopFor:key |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5380 |
"reverse translation for a modifier key |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5381 |
(i.e. to get the keyTop from a modifier)" |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5382 |
|
532 | 5383 |
|t modifiers| |
5384 |
||
5385 |
key == #Alt ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5386 |
modifiers := altModifiers |
532 | 5387 |
] ifFalse:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5388 |
key == #Cmd ifTrue:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5389 |
modifiers := metaModifiers |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5390 |
] |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5391 |
]. |
2053 | 5392 |
|
5393 |
"/ temporary kludge ... |
|
532 | 5394 |
(modifiers size > 0) ifTrue:[ |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5395 |
(modifiers includes:'Num_Lock') ifTrue:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5396 |
modifiers := modifiers copy. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5397 |
modifiers remove:'Num_Lock' |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5398 |
] |
2053 | 5399 |
]. |
5400 |
||
5401 |
(modifiers size > 0) ifTrue:[ |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5402 |
t := modifiers first. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5403 |
(t includes:$_) ifTrue:[ |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5404 |
t := t copyTo:(t indexOf:$_)-1 |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5405 |
]. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
5406 |
^ t |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5407 |
]. |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5408 |
^ key |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5409 |
|
2053 | 5410 |
"Created: / 28.2.1996 / 17:07:08 / cg" |
5411 |
"Modified: / 7.2.1998 / 16:18:17 / cg" |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5412 |
! |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5413 |
|
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5414 |
modifierKeyTranslationFor:untranslatedKey |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5415 |
"map possible modifiers to a smaller set of common symbols. |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5416 |
Especially, left/right keys are mapped to a common one." |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5417 |
|
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5418 |
"should this come from a configurable variable ?" |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5419 |
|
1022 | 5420 |
"/ the next statement will vanish .... |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5421 |
(untranslatedKey == #Control |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5422 |
or:[untranslatedKey == #'Control_L' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5423 |
or:[untranslatedKey == #'Control_R']]) ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5424 |
^ #Ctrl |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5425 |
]. |
1022 | 5426 |
|
5427 |
(untranslatedKey == #Ctrl |
|
5428 |
or:[untranslatedKey == #'Ctrl_L' |
|
5429 |
or:[untranslatedKey == #'Ctrl_R']]) ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5430 |
^ #Ctrl |
1022 | 5431 |
]. |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5432 |
(untranslatedKey == #'Shift' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5433 |
or:[untranslatedKey == #'Shift_L' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5434 |
or:[untranslatedKey == #'Shift_R']]) ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5435 |
^ #Shift |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5436 |
]. |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5437 |
(untranslatedKey == #'Alt' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5438 |
or:[untranslatedKey == #'Alt_L' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5439 |
or:[untranslatedKey == #'Alt_R']]) ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5440 |
^ #Alt |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5441 |
]. |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5442 |
(untranslatedKey == #'Meta' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5443 |
or:[untranslatedKey == #'Meta_L' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5444 |
or:[untranslatedKey == #'Meta_R']]) ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5445 |
^ #Meta |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5446 |
]. |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5447 |
(untranslatedKey == #'Cmd' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5448 |
or:[untranslatedKey == #'Cmd_L' |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5449 |
or:[untranslatedKey == #'Cmd_R']]) ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5450 |
^ #Cmd |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5451 |
]. |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5452 |
^ nil |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5453 |
|
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5454 |
"Created: 28.2.1996 / 16:40:46 / cg" |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5455 |
"Modified: 28.2.1996 / 17:11:34 / cg" |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5456 |
! |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5457 |
|
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
5458 |
translateKey:untranslatedKey forView:aView |
51 | 5459 |
"Return the key translated via the translation table. |
89 | 5460 |
Your application program should never depend on the values returned |
5461 |
by this method, but instead use symbolic keys (such as #FindNext). |
|
5462 |
Doing so allows easier reconfiguration by changing the translation map |
|
5463 |
in the 'smalltalk.rc' or 'display.rc' startup files. |
|
51 | 5464 |
|
5465 |
First, the modifier is prepended, making character X into |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5466 |
AltX, CtrlX or CmdX (on many systems, no separate Cmd (or Meta) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5467 |
key exists; on those we always get AltX if the metaModifiers are not set correctly). |
89 | 5468 |
If multiple modifiers are active, the symbol becoms the concatenation |
5469 |
as in AltCtrlq (for control-alt-q). Shift will affect the last component, |
|
5470 |
thus the above with shift becoms: AltCtrlQ instead. |
|
5471 |
Some keyboards offer both Alt and Meta keys - on those, the first has a |
|
5472 |
prefix of Alt, the second has Cmd as prefix. Keyboards with only an Alt |
|
5473 |
key will will create prefix codes of Cmd for that. |
|
5474 |
For symbolic keys (i.e.Tab, Backspace etc, shift is ignored). |
|
51 | 5475 |
Then the result is used as a key into the translation keyboardMap |
5476 |
to get the final return value." |
|
5477 |
||
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5478 |
|xlatedKey s modifier| |
51 | 5479 |
|
5480 |
xlatedKey := untranslatedKey. |
|
145 | 5481 |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5482 |
modifier := self modifierKeyTranslationFor:untranslatedKey. |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5483 |
"/ |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5484 |
"/ only prepend, if this is not a modifier |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5485 |
"/ |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5486 |
modifier isNil ifTrue:[ |
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5487 |
s := xlatedKey asString. |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5488 |
ctrlDown ifTrue:[ |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5489 |
xlatedKey := 'Ctrl' , s |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5490 |
]. |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5491 |
metaDown ifTrue:[ |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5492 |
xlatedKey := 'Cmd' , s |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5493 |
]. |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5494 |
altDown ifTrue:[ |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5495 |
xlatedKey := 'Alt' , s |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5496 |
]. |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5497 |
xlatedKey isCharacter ifFalse:[ |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5498 |
xlatedKey := xlatedKey asSymbol |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5499 |
]. |
51 | 5500 |
]. |
5501 |
||
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
5502 |
xlatedKey := aView keyboardMap valueFor:xlatedKey. |
259 | 5503 |
xlatedKey isCharacter ifFalse:[ |
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
5504 |
xlatedKey := xlatedKey asSymbol |
259 | 5505 |
]. |
51 | 5506 |
^ xlatedKey |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5507 |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
5508 |
"Modified: 28.2.1996 / 17:12:16 / cg" |
293 | 5509 |
! ! |
5510 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5511 |
!DeviceWorkstation methodsFor:'keyboard queries'! |
293 | 5512 |
|
5513 |
altDown |
|
5514 |
"return true, if the alt-key is currently pressed." |
|
5515 |
||
5516 |
^ altDown |
|
249
f33de7016dba
modifierKeyProcessing (altDown/metaDown ...) now done in smalltalk
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
5517 |
! |
f33de7016dba
modifierKeyProcessing (altDown/metaDown ...) now done in smalltalk
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
5518 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5519 |
ctrlDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5520 |
"return true, if the control-key is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5521 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5522 |
^ ctrlDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5523 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5524 |
|
1114
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5525 |
leftShiftDown |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5526 |
"return true, if the left shift-key is currently pressed. |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5527 |
Here, we dont differentiate between left and right shift keys." |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5528 |
|
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5529 |
^ shiftDown |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5530 |
|
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5531 |
"Created: 9.11.1996 / 19:06:48 / cg" |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5532 |
! |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5533 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5534 |
metaDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5535 |
"return true, if the meta-key (alt-key on systems without meta) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5536 |
is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5537 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5538 |
^ metaDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5539 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5540 |
|
1114
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5541 |
rightShiftDown |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5542 |
"return true, if the right shift-key is currently pressed. |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5543 |
Here, we dont differentiate between left and right shift keys." |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5544 |
|
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5545 |
^ shiftDown |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5546 |
|
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5547 |
"Created: 9.11.1996 / 19:06:56 / cg" |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5548 |
! |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
5549 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5550 |
shiftDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5551 |
"return true, if the shift-key is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5552 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5553 |
^ shiftDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5554 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5555 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5556 |
!DeviceWorkstation methodsFor:'misc'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
5557 |
|
293 | 5558 |
beep |
1198 | 5559 |
"{ Pragma: +optSpace }" |
5560 |
||
293 | 5561 |
"output an audible beep or bell" |
5562 |
||
1906 | 5563 |
NoBeep ~~ true ifTrue:[ |
5564 |
Stdout nextPut:(Character bell) |
|
5565 |
] |
|
1198 | 5566 |
|
5567 |
"Modified: 13.1.1997 / 22:56:13 / cg" |
|
293 | 5568 |
! |
5569 |
||
5570 |
buffered |
|
5571 |
"buffer drawing - do not send it immediately to the display. |
|
5572 |
This is the default; see comment in #unBuffered." |
|
5573 |
||
5574 |
^ self |
|
5575 |
! |
|
5576 |
||
5577 |
compressMotionEvents:aBoolean |
|
5578 |
"turn on/off motion event compression |
|
5579 |
- compressions makes always sense except in free-hand drawing of curves" |
|
5580 |
||
5581 |
motionEventCompression := aBoolean |
|
115 | 5582 |
! |
5583 |
||
2744
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
5584 |
flush |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
5585 |
"send all buffered drawing to the display. |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
5586 |
This used to be called #synchronizeOutput, but has been renamed |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
5587 |
for ST-80 compatibility." |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
5588 |
|
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
5589 |
^ self |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
5590 |
! |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
5591 |
|
2716
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
5592 |
focusView |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
5593 |
^ focusView |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
5594 |
! |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
5595 |
|
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
5596 |
focusView:aView |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
5597 |
focusView := aView |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
5598 |
! |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
5599 |
|
2536 | 5600 |
repadBits:givenBits width:imageWidth height:imageHeight depth:imageDepth from:givenPadding to:wantedPadding |
5601 |
"repadding support - required for some devices when drawing images" |
|
5602 |
||
5603 |
|newBits bytesPerLineGiven bytesPerLineWanted |
|
5604 |
dstIndex "{ Class: SmallInteger }" |
|
5605 |
srcIndex "{ Class: SmallInteger }"| |
|
5606 |
||
5607 |
bytesPerLineGiven := ((width * imageDepth) + givenPadding - 1) // 8. |
|
5608 |
bytesPerLineWanted := ((width * imageDepth) + wantedPadding - 1) // 8. |
|
5609 |
||
5610 |
bytesPerLineGiven == bytesPerLineWanted ifTrue:[^ givenBits]. |
|
5611 |
||
5612 |
newBits := ByteArray new:(bytesPerLineWanted * height). |
|
5613 |
srcIndex := dstIndex := 1. |
|
5614 |
1 to:height do:[:row | |
|
2648 | 5615 |
newBits |
5616 |
replaceFrom:dstIndex |
|
5617 |
to:(dstIndex + bytesPerLineWanted - 1) |
|
5618 |
with:givenBits |
|
5619 |
startingAt:srcIndex. |
|
5620 |
dstIndex := dstIndex + bytesPerLineWanted. |
|
5621 |
srcIndex := srcIndex + bytesPerLineGiven. |
|
2536 | 5622 |
]. |
5623 |
^ newBits. |
|
5624 |
||
5625 |
! |
|
5626 |
||
1926 | 5627 |
restoreWindows |
5628 |
"restore the display. |
|
5629 |
Here, a view is popped over all of the screen temporarily" |
|
5630 |
||
5631 |
|v| |
|
5632 |
||
5633 |
v := PopUpView onDevice:self. |
|
5634 |
v origin:0@0 corner:(self bounds corner). |
|
5635 |
v map. |
|
5636 |
v unmap. |
|
5637 |
||
5638 |
" |
|
5639 |
Display restoreWindows |
|
5640 |
" |
|
5641 |
||
5642 |
"Modified: 15.10.1997 / 19:06:26 / cg" |
|
5643 |
! |
|
5644 |
||
293 | 5645 |
ringBell |
1198 | 5646 |
"{ Pragma: +optSpace }" |
5647 |
||
293 | 5648 |
"alias for beep; for ST-80 compatibility" |
5649 |
||
5650 |
self beep |
|
1198 | 5651 |
|
5652 |
"Modified: 13.1.1997 / 22:56:02 / cg" |
|
115 | 5653 |
! |
5654 |
||
293 | 5655 |
setInputFocusTo:aWindowId |
5656 |
^ self subclassResponsibility |
|
115 | 5657 |
! |
5658 |
||
293 | 5659 |
sync |
1198 | 5660 |
"{ Pragma: +optSpace }" |
5661 |
||
5662 |
"send all buffered drawing to the display and wait until its processed/drawn. |
|
5663 |
See also #flush, which does not wait. |
|
5664 |
ST-80 seems to only support flush." |
|
293 | 5665 |
|
5666 |
self flush |
|
1198 | 5667 |
|
5668 |
"Modified: 13.1.1997 / 22:55:44 / cg" |
|
115 | 5669 |
! |
5670 |
||
293 | 5671 |
synchronizeOutput |
1198 | 5672 |
"{ Pragma: +optSpace }" |
5673 |
||
293 | 5674 |
"send all buffered drawing to the display. |
5675 |
OBSOLETE: please use #flush for ST-80 compatibility." |
|
5676 |
||
5677 |
self obsoleteMethodWarning:'use #flush'. |
|
5678 |
^ self flush |
|
1198 | 5679 |
|
5680 |
"Modified: 13.1.1997 / 22:53:44 / cg" |
|
115 | 5681 |
! |
5682 |
||
293 | 5683 |
unBuffered |
5684 |
"make all drawing be sent immediately to the display. |
|
5685 |
This may horribly slow down your drawings, but will result |
|
5686 |
in any errors to be delivered right after the bad operation |
|
5687 |
(in X only). Only useful for debugging." |
|
5688 |
||
5689 |
^ self |
|
5690 |
! ! |
|
5691 |
||
1717
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5692 |
!DeviceWorkstation methodsFor:'pointer stuff'! |
293 | 5693 |
|
2869 | 5694 |
anyButtonMotionMask |
5695 |
"return an integer for masking out any button from a motion |
|
5696 |
buttonStates value. This is very device specific and to |
|
5697 |
be redefined by concrete subclasses." |
|
5698 |
||
5699 |
^ self subclassResponsibility |
|
5700 |
||
5701 |
"Created: 15.10.1997 / 19:17:00 / cg" |
|
5702 |
! |
|
5703 |
||
1926 | 5704 |
anyButtonPressed |
5705 |
"return true, if the any button is currently pressed" |
|
5706 |
||
5707 |
^ (self buttonStates bitAnd:self anyButtonStateMask) ~~ 0 |
|
5708 |
||
5709 |
"Created: 15.10.1997 / 19:16:32 / cg" |
|
5710 |
! |
|
5711 |
||
5712 |
anyButtonStateMask |
|
5713 |
"return an integer for masking out any button from a |
|
5714 |
buttonStates value. This is very device specific and to |
|
5715 |
be redefined by concrete subclasses." |
|
5716 |
||
5717 |
^ self subclassResponsibility |
|
5718 |
||
5719 |
"Created: 15.10.1997 / 19:17:00 / cg" |
|
5720 |
! |
|
5721 |
||
2880
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5722 |
button1MotionMask |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5723 |
"return an integer for masking out the left button from a |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5724 |
motion buttonStates value. This is very device specific and to |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5725 |
be redefined by concrete subclasses." |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5726 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5727 |
^ self subclassResponsibility |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5728 |
! |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5729 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5730 |
button2MotionMask |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5731 |
"return an integer for masking out the middle button from a |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5732 |
motion buttonStates value. This is very device specific and to |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5733 |
be redefined by concrete subclasses." |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5734 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5735 |
^ self subclassResponsibility |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5736 |
! |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5737 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5738 |
button3MotionMask |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5739 |
"return an integer for masking out the right button from a |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5740 |
motion buttonStates value. This is very device specific and to |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5741 |
be redefined by concrete subclasses." |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5742 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5743 |
^ self subclassResponsibility |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5744 |
! |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
5745 |
|
293 | 5746 |
buttonStates |
5747 |
"return an integer representing the state of the pointer buttons; |
|
5748 |
a one-bit represents a pressed button. The bit positions are device specific |
|
5749 |
and to be returned by the *ButtonStateMask methods. |
|
5750 |
Must be redefined by concrete subclasses." |
|
5751 |
||
5752 |
^ self subclassResponsibility |
|
115 | 5753 |
! |
5754 |
||
293 | 5755 |
leftButtonPressed |
5756 |
"return true, if the left button is currently pressed" |
|
5757 |
||
5758 |
^ (self buttonStates bitAnd:self leftButtonStateMask) ~~ 0 |
|
5759 |
! |
|
5760 |
||
5761 |
leftButtonStateMask |
|
5762 |
"return an integer for masking out the left button from a |
|
5763 |
buttonStates value. This is very device specific and to |
|
5764 |
be redefined by concrete subclasses." |
|
5765 |
||
5766 |
^ self subclassResponsibility |
|
115 | 5767 |
! |
5768 |
||
293 | 5769 |
middleButtonPressed |
5770 |
"return true, if the middle button is currently pressed" |
|
5771 |
||
5772 |
^ (self buttonStates bitAnd:self middleButtonStateMask) ~~ 0 |
|
115 | 5773 |
! |
5774 |
||
293 | 5775 |
middleButtonStateMask |
5776 |
"return an integer for masking out the middle button from a |
|
5777 |
buttonStates value. This is very device specific and to |
|
5778 |
be redefined by concrete subclasses." |
|
5779 |
||
5780 |
^ self subclassResponsibility |
|
115 | 5781 |
! |
5782 |
||
293 | 5783 |
pointerPosition |
5784 |
"return the current pointer position in root-window coordinates. |
|
5785 |
Must be redefined by concrete subclasses." |
|
5786 |
||
5787 |
^ self subclassResponsibility |
|
115 | 5788 |
! |
5789 |
||
293 | 5790 |
rightButtonPressed |
5791 |
"return true, if the right button is currently pressed" |
|
5792 |
||
5793 |
^ (self buttonStates bitAnd:self rightButtonStateMask) ~~ 0 |
|
115 | 5794 |
! |
5795 |
||
293 | 5796 |
rightButtonStateMask |
5797 |
"return an integer for masking out the right button from a |
|
5798 |
buttonStates value. This is very device specific and to |
|
5799 |
be redefined by concrete subclasses." |
|
5800 |
||
5801 |
^ self subclassResponsibility |
|
115 | 5802 |
! |
5803 |
||
293 | 5804 |
rootPositionOfLastEvent |
5805 |
"return the position in root-window coordinates |
|
5806 |
of the last button, key or pointer event. |
|
5807 |
Must be redefined by concrete subclasses." |
|
5808 |
||
5809 |
^ self subclassResponsibility |
|
1717
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5810 |
! |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5811 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5812 |
setPointerPosition:newPosition |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5813 |
"change the pointer position in root-window coordinates." |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5814 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5815 |
self setPointerPosition:newPosition in:rootView id |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5816 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5817 |
" |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5818 |
Display setPointerPosition:10@30 |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5819 |
" |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5820 |
! |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5821 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5822 |
setPointerPosition:newPosition in:aWindowID |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5823 |
"change the pointer position relative to some views origin. |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5824 |
Must be redefined by concrete subclasses." |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5825 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5826 |
^ self subclassResponsibility |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5827 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5828 |
" |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5829 |
Display setPointerPosition:10@30 |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
5830 |
" |
293 | 5831 |
! ! |
5832 |
||
5833 |
!DeviceWorkstation methodsFor:'printing & storing'! |
|
5834 |
||
5835 |
printOn:aStream |
|
5836 |
"for your convenience, add the name of the display connection |
|
5837 |
or 'default' to the printed representation." |
|
5838 |
||
5839 |
|name| |
|
5840 |
||
5841 |
super printOn:aStream. |
|
5842 |
||
5843 |
aStream nextPut:$(. |
|
5844 |
(name := self displayName) isNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5845 |
name := 'defaultDisplay' |
293 | 5846 |
]. |
5847 |
aStream nextPutAll:name. |
|
5848 |
aStream nextPut:$) |
|
5849 |
! ! |
|
5850 |
||
5851 |
!DeviceWorkstation methodsFor:'retrieving pixels'! |
|
5852 |
||
1461
6d8b022bfcd8
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1460
diff
changeset
|
5853 |
getBitsFromId:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
1460
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5854 |
"get bits from a view drawable into the imageBits. The storage for the bits |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5855 |
must be big enough for the data to fit. If ok, returns an array with some |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5856 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5857 |
number of bytes per scanline. The number of bytes per scanline is not known |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5858 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5859 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5860 |
self subclassResponsibility |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5861 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5862 |
"Created: 19.3.1997 / 13:41:21 / cg" |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5863 |
! |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5864 |
|
1461
6d8b022bfcd8
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1460
diff
changeset
|
5865 |
getBitsFromPixmapId:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
1460
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5866 |
"get bits from a drawable into the imageBits. The storage for the bits |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5867 |
must be big enough for the data to fit. If ok, returns an array with some |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5868 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5869 |
number of bytes per scanline. The number of bytes per scanline is not known |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5870 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5871 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5872 |
^ self |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5873 |
getBitsFromId:aDrawableId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5874 |
x:srcx |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5875 |
y:srcy |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5876 |
width:w |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5877 |
height:h |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5878 |
into:imageBits |
1460
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5879 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5880 |
"Created: 19.3.1997 / 13:43:04 / cg" |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5881 |
"Modified: 19.3.1997 / 13:43:38 / cg" |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5882 |
! |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5883 |
|
1461
6d8b022bfcd8
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1460
diff
changeset
|
5884 |
getBitsFromViewId:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
1460
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5885 |
"get bits from a drawable into the imageBits. The storage for the bits |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5886 |
must be big enough for the data to fit. If ok, returns an array with some |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5887 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5888 |
number of bytes per scanline. The number of bytes per scanline is not known |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5889 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5890 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5891 |
^ self |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5892 |
getBitsFromId:aDrawableId |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5893 |
x:srcx |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5894 |
y:srcy |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5895 |
width:w |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5896 |
height:h |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
5897 |
into:imageBits |
1460
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5898 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5899 |
"Created: 19.3.1997 / 13:43:04 / cg" |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5900 |
"Modified: 19.3.1997 / 13:43:42 / cg" |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5901 |
! |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
5902 |
|
2712
641bad954139
need gc-arg in getPixel (for WIN32)
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
5903 |
getPixelX:x y:y from:aDrawableId with:gcId |
293 | 5904 |
"return the pixel value at x/y" |
5905 |
||
5906 |
^ self subclassResponsibility |
|
2712
641bad954139
need gc-arg in getPixel (for WIN32)
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
5907 |
|
641bad954139
need gc-arg in getPixel (for WIN32)
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
5908 |
"Created: / 22.5.1999 / 01:40:42 / cg" |
115 | 5909 |
! ! |
5910 |
||
1022 | 5911 |
!DeviceWorkstation methodsFor:'selections'! |
5912 |
||
1789 | 5913 |
clipBoardEncoding |
5914 |
"return the assumed default clibBoards encoding |
|
5915 |
if a raw string (i.e. without encoding information) is pasted. |
|
1794 | 5916 |
Useful on XWindows, if a sjis or euc string is pasted from a netscape |
1789 | 5917 |
or other program." |
5918 |
||
5919 |
^ clipBoardEncoding |
|
5920 |
||
5921 |
" |
|
5922 |
Screen current clipBoardEncoding |
|
5923 |
" |
|
5924 |
||
5925 |
"Created: 28.6.1997 / 13:46:02 / cg" |
|
1794 | 5926 |
"Modified: 28.6.1997 / 17:28:08 / cg" |
1789 | 5927 |
! |
5928 |
||
5929 |
clipBoardEncoding:aSymbol |
|
5930 |
"set the assumed default clibBoards encoding |
|
5931 |
if a raw string (i.e. without encoding information) is pasted. |
|
1794 | 5932 |
Useful on XWindows, if a sjis or euc string is pasted from a netscape |
1789 | 5933 |
or other program." |
5934 |
||
5935 |
clipBoardEncoding := aSymbol |
|
5936 |
||
5937 |
" |
|
1794 | 5938 |
Screen current clipBoardEncoding:#sjis |
5939 |
Screen current clipBoardEncoding:#euc |
|
1789 | 5940 |
Screen current clipBoardEncoding:nil |
5941 |
" |
|
5942 |
||
5943 |
"Created: 28.6.1997 / 13:46:12 / cg" |
|
1794 | 5944 |
"Modified: 28.6.1997 / 17:28:02 / cg" |
1789 | 5945 |
! |
5946 |
||
1131 | 5947 |
getCopyBuffer |
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5948 |
"return the copyBuffers contents. |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5949 |
This is an ST/X internal buffer (i.e. its not visible to alien views)." |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5950 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5951 |
^ copyBuffer |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5952 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5953 |
"Modified: 11.12.1996 / 12:55:42 / cg" |
1131 | 5954 |
"Created: 11.12.1996 / 13:34:34 / cg" |
5955 |
! |
|
5956 |
||
5957 |
getLastCopyBuffer |
|
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5958 |
"return the last copyBuffers contents. |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5959 |
This is an ST/X internal buffer (i.e. its not visible to alien views)." |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5960 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5961 |
^ lastCopyBuffer |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5962 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5963 |
"Modified: 11.12.1996 / 12:55:47 / cg" |
1131 | 5964 |
"Created: 11.12.1996 / 13:34:43 / cg" |
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5965 |
! |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5966 |
|
2881 | 5967 |
getSelectionFor:drawableId |
5968 |
"Retrieve the common per-display selection text. |
|
5969 |
For clipBoard mechanisms to work (into ST/X), |
|
5970 |
this must be redefined in a concrete subclass" |
|
5971 |
||
5972 |
^ nil |
|
5973 |
! |
|
5974 |
||
1022 | 5975 |
getTextSelectionFor:aDrawableId |
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5976 |
"Retrieve the common per-display selection text. |
1788 | 5977 |
For clipBoard mechanisms to work (into ST/X), |
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5978 |
this must be redefined in a concrete subclass" |
1022 | 5979 |
|
5980 |
^ nil |
|
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5981 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5982 |
"Modified: 11.12.1996 / 12:56:57 / cg" |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5983 |
! |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
5984 |
|
1343 | 5985 |
selectionAsString |
5986 |
"return my current selection as a string" |
|
5987 |
||
5988 |
|o s| |
|
5989 |
||
5990 |
o := self getCopyBuffer. |
|
5991 |
s := o. |
|
5992 |
o isString ifFalse:[ |
|
2648 | 5993 |
o isNil ifTrue:[ |
5994 |
s := '' |
|
5995 |
] ifFalse:[ |
|
5996 |
(o isStringCollection) ifTrue:[ |
|
5997 |
s := o asStringWithCRsFrom:1 to:(o size) compressTabs:false withCR:false. |
|
5998 |
s := s string. |
|
5999 |
] ifFalse:[ |
|
6000 |
s := o storeString |
|
6001 |
] |
|
6002 |
] |
|
1343 | 6003 |
]. |
6004 |
^ s |
|
6005 |
||
1992
14e554fc38b4
Remove 'condition is always false...'
Stefan Vogel <sv@exept.de>
parents:
1991
diff
changeset
|
6006 |
"Created: / 13.2.1997 / 13:10:30 / cg" |
14e554fc38b4
Remove 'condition is always false...'
Stefan Vogel <sv@exept.de>
parents:
1991
diff
changeset
|
6007 |
"Modified: / 20.1.1998 / 14:11:01 / stefan" |
1343 | 6008 |
! |
6009 |
||
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6010 |
setCopyBuffer:something |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6011 |
"set the copyBuffers contents. |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6012 |
This is an ST/X internal buffer (i.e. its not visible to alien views)." |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6013 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6014 |
copyBuffer := something. |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6015 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6016 |
"Created: 11.12.1996 / 12:54:23 / cg" |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6017 |
"Modified: 11.12.1996 / 12:55:53 / cg" |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6018 |
! |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6019 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6020 |
setLastCopyBuffer:something |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6021 |
"set the last copyBuffers contents. |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6022 |
This is an ST/X internal buffer (i.e. its not visible to alien views)." |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6023 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6024 |
lastCopyBuffer := something. |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6025 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6026 |
"Created: 11.12.1996 / 12:54:32 / cg" |
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6027 |
"Modified: 11.12.1996 / 12:55:59 / cg" |
1022 | 6028 |
! |
6029 |
||
1675 | 6030 |
setSelection:anObject owner:aWindowId |
6031 |
"set the common per-display object selection. |
|
6032 |
This can be used by other Smalltalk(X) applications only. |
|
1788 | 6033 |
For clipBoard mechanisms to work (out of ST/X), |
1675 | 6034 |
this must be redefined in a concrete subclass" |
6035 |
||
6036 |
^ nil |
|
6037 |
! |
|
6038 |
||
1022 | 6039 |
setTextSelection:aString owner:aWindowId |
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6040 |
"Set the common per-display selection text. |
1788 | 6041 |
For clipBoard mechanisms to work (out of ST/X), |
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6042 |
this must be redefined in a concrete subclass" |
1022 | 6043 |
|
6044 |
^ nil |
|
1130
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6045 |
|
d75bad6174be
added protocol to set/retrieve the per-display copyBuffer
Claus Gittinger <cg@exept.de>
parents:
1128
diff
changeset
|
6046 |
"Modified: 11.12.1996 / 12:56:36 / cg" |
1022 | 6047 |
! ! |
6048 |
||
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6049 |
!DeviceWorkstation methodsFor:'style defaults'! |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6050 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6051 |
defaultStyleValueFor:aKey |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6052 |
"return a default style value, given a key. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6053 |
These defaults are used if nothing is specified |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6054 |
in the style sheet |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6055 |
This allows for empty values in style sheets, and defaults |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6056 |
being provided by the display (which makes sense with Windows, |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6057 |
where the systemDefaults are used ..." |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6058 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6059 |
<resource: #style (#viewSpacing |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6060 |
#borderColor #borderWidth |
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
6061 |
#viewBackgroundColor #shadowColor #lightColor |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6062 |
)> |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6063 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6064 |
aKey == #viewSpacing ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6065 |
^ self verticalPixelPerMillimeter rounded "/ 1 millimeter |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6066 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6067 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6068 |
aKey == #borderColor ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6069 |
^ Color black |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6070 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6071 |
aKey == #borderWidth ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6072 |
^ 1 |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6073 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6074 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6075 |
aKey == #shadowColor ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6076 |
^ Color black |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6077 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6078 |
aKey == #lightColor ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6079 |
^ Color white |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6080 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6081 |
aKey == #viewBackgroundColor ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6082 |
^ Color white |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6083 |
]. |
1684 | 6084 |
aKey == #scrollerViewBackgroundColor ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6085 |
^ Color white |
1684 | 6086 |
]. |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6087 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6088 |
aKey == #textForegroundColor ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6089 |
^ Color black. |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6090 |
]. |
1684 | 6091 |
aKey == #textBackgroundColor ifTrue:[ |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6092 |
^ Color white. |
1684 | 6093 |
]. |
6094 |
aKey == #selectionForegroundColor ifTrue:[ |
|
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6095 |
^ Color white. |
1684 | 6096 |
]. |
6097 |
aKey == #selectionBackgroundColor ifTrue:[ |
|
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
6098 |
^ Color black. |
1684 | 6099 |
]. |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6100 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6101 |
^ nil. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6102 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6103 |
"Modified: 29.4.1997 / 11:16:57 / dq" |
1684 | 6104 |
"Modified: 29.4.1997 / 17:17:15 / cg" |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6105 |
! ! |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
6106 |
|
54 | 6107 |
!DeviceWorkstation methodsFor:'view registration'! |
0 | 6108 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
6109 |
addKnownView:aView withId:aWindowID |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
6110 |
"add the View aView with id:aWindowID to the list of known views/id's. |
51 | 6111 |
This map is needed later (on event arrival) to get the view from |
6112 |
the views id (which is passed along with the devices event) quickly." |
|
0 | 6113 |
|
1217 | 6114 |
|freeIdx newArr sz newSize wasBlocked| |
46 | 6115 |
|
1483 | 6116 |
wasBlocked := OperatingSystem blockInterrupts. |
6117 |
||
0 | 6118 |
knownViews isNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6119 |
knownViews := WeakArray new:50. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6120 |
knownIds := Array new:50. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6121 |
freeIdx := 1. |
54 | 6122 |
] ifFalse:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6123 |
freeIdx := knownViews identityIndexOf:nil. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6124 |
freeIdx == 0 ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6125 |
freeIdx := knownViews identityIndexOf:0. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6126 |
[freeIdx ~~ 0 |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6127 |
and:[(knownIds at:freeIdx) notNil]] whileTrue:[ |
1600 | 6128 |
"/ mhmh - the view is already clear in the weakArray |
6129 |
"/ but the id is not. |
|
6130 |
"/ (i.e. its collected, but not yet finalized) |
|
6131 |
"/ skip this entry. |
|
6132 |
"/ 'XXX ' print. (knownIds at:freeIdx) displayString printCR. |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6133 |
freeIdx := knownViews identityIndexOf:0 startingAt:(freeIdx + 1). |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6134 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6135 |
]. |
0 | 6136 |
]. |
46 | 6137 |
|
118 | 6138 |
freeIdx == 0 ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6139 |
sz := knownViews size. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6140 |
newSize := sz * 2. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6141 |
newArr := WeakArray new:newSize. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6142 |
newArr replaceFrom:1 to:sz with:knownViews. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6143 |
knownViews := newArr. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6144 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6145 |
newArr := Array new:newSize. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6146 |
newArr replaceFrom:1 to:sz with:knownIds. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6147 |
knownIds := newArr. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6148 |
freeIdx := sz + 1. |
54 | 6149 |
]. |
6150 |
knownViews at:freeIdx put:aView. |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
6151 |
knownIds at:freeIdx put:aWindowID. |
1483 | 6152 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
190 | 6153 |
|
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
6154 |
idToTableIndexMapping notNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6155 |
idToTableIndexMapping at:aWindowID put:freeIdx. |
1406
2aa01c6279f0
fast mapping from viewID to view (experimental)
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
6156 |
]. |
2aa01c6279f0
fast mapping from viewID to view (experimental)
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
6157 |
|
332
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
6158 |
"/ dispatching ifFalse:[ |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
6159 |
"/ self startDispatch |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
6160 |
"/ ]. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
6161 |
|
1515 | 6162 |
"Modified: 2.4.1997 / 19:15:46 / cg" |
1525 | 6163 |
! |
0 | 6164 |
|
2874
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6165 |
initializeTopViewHookFor:aView |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6166 |
"callBack from topViews initialize method. |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6167 |
empty here, but may be useful ..." |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6168 |
! |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6169 |
|
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6170 |
realizedTopViewHookFor:aView |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6171 |
"callBack from topViews realize method. |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6172 |
empty here, but may be useful ..." |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6173 |
! |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
6174 |
|
1478
042a65d624cd
reorganize knownViews/knownIds table when views are removed.
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
6175 |
removeKnownView:aView withId:aViewId |
51 | 6176 |
"remove aView from the list of known views/id's." |
0 | 6177 |
|
1973 | 6178 |
|index wasBlocked nV nI n dstIdx v id newSize| |
54 | 6179 |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6180 |
lastId := nil. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6181 |
lastView := nil. |
2824 | 6182 |
focusView == aView ifTrue:[ |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6183 |
focusView := nil |
2824 | 6184 |
]. |
46 | 6185 |
|
0 | 6186 |
knownViews notNil ifTrue:[ |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6187 |
wasBlocked := OperatingSystem blockInterrupts. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6188 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6189 |
index := 0. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6190 |
aViewId notNil ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6191 |
idToTableIndexMapping notNil ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6192 |
index := idToTableIndexMapping at:aViewId ifAbsent:0. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6193 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6194 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6195 |
index == 0 ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6196 |
aView notNil ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6197 |
index := knownViews identityIndexOf:aView. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6198 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6199 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6200 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6201 |
index ~~ 0 ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6202 |
idToTableIndexMapping notNil ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6203 |
aViewId notNil ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6204 |
idToTableIndexMapping removeKey:aViewId ifAbsent:nil |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6205 |
] ifFalse:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6206 |
id := knownIds at:index. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6207 |
id notNil ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6208 |
idToTableIndexMapping removeKey:id ifAbsent:nil. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6209 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6210 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6211 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6212 |
knownViews at:index put:nil. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6213 |
knownIds at:index put:nil. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6214 |
lastId := nil. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6215 |
lastView := nil. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6216 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6217 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6218 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6219 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6220 |
aView notNil ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6221 |
aView isTopView ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6222 |
"/ check for sparsely filled knownViews - array |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6223 |
wasBlocked := OperatingSystem blockInterrupts. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6224 |
n := 0. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6225 |
knownViews do:[:v | |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6226 |
(v notNil and:[v ~~ 0]) ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6227 |
n := n + 1 |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6228 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6229 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6230 |
n < (knownViews size * 2 // 3) ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6231 |
newSize := n * 3 // 2. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6232 |
newSize > 50 ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6233 |
nV := WeakArray new:newSize. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6234 |
nI := Array new:newSize. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6235 |
dstIdx := 1. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6236 |
1 to:knownViews size do:[:srcIdx | |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6237 |
v := knownViews at:srcIdx. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6238 |
(v notNil and:[v ~~ 0]) ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6239 |
nV at:dstIdx put:v. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6240 |
nI at:dstIdx put:(knownIds at:srcIdx). |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6241 |
dstIdx := dstIdx + 1. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6242 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6243 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6244 |
idToTableIndexMapping := nil. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6245 |
knownViews := nV. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6246 |
knownIds := nI. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6247 |
idToTableIndexMapping := Dictionary new. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6248 |
knownIds keysAndValuesDo:[:idx :id | |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6249 |
id notNil ifTrue:[ |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6250 |
idToTableIndexMapping at:id put:idx |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6251 |
] |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6252 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6253 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6254 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6255 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6256 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6257 |
]. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6258 |
self checkForEndOfDispatch. |
0 | 6259 |
] |
958 | 6260 |
|
1478
042a65d624cd
reorganize knownViews/knownIds table when views are removed.
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
6261 |
"Created: 22.3.1997 / 14:56:20 / cg" |
1493
b162273f59f9
oops - idToTableIndexMapping seems to become nil ?!
Claus Gittinger <cg@exept.de>
parents:
1484
diff
changeset
|
6262 |
"Modified: 27.3.1997 / 17:13:28 / cg" |
0 | 6263 |
! |
6264 |
||
293 | 6265 |
viewFromId:aWindowID |
6266 |
"given an Id, return the corresponding view." |
|
6267 |
||
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
6268 |
|index v idx| |
293 | 6269 |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6270 |
aWindowID = lastId ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6271 |
lastView notNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6272 |
^ lastView |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6273 |
] |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6274 |
]. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6275 |
|
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
6276 |
idToTableIndexMapping notNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6277 |
idx := idToTableIndexMapping at:aWindowID ifAbsent:nil. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6278 |
idx notNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6279 |
v := knownViews at:idx. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6280 |
(v notNil and:[v ~~ 0]) ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6281 |
lastView := v. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6282 |
lastId := aWindowID. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6283 |
^ v |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6284 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6285 |
] |
1407 | 6286 |
]. |
6287 |
||
2254 | 6288 |
knownIds isNil ifTrue:[ |
6289 |
^ nil |
|
6290 |
]. |
|
6291 |
||
293 | 6292 |
index := knownIds indexOf:aWindowID. |
1484 | 6293 |
index == 0 ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6294 |
^ nil |
1484 | 6295 |
]. |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6296 |
|
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
6297 |
v := knownViews at:index. |
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
6298 |
v == 0 ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6299 |
knownViews at:index put:nil. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6300 |
knownIds at:index put:nil. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6301 |
^ nil |
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
6302 |
]. |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6303 |
|
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6304 |
lastId := aWindowID. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6305 |
lastView := v. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6306 |
|
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
6307 |
^ v |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6308 |
|
1484 | 6309 |
"Modified: 22.3.1997 / 17:19:59 / cg" |
1525 | 6310 |
! |
6311 |
||
6312 |
viewIdKnown:aWindowID |
|
6313 |
"return true, if I still consider a windowId as being valid" |
|
6314 |
||
1547 | 6315 |
|index v| |
1525 | 6316 |
|
6317 |
aWindowID = lastId ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6318 |
lastView notNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6319 |
^ true |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6320 |
] |
1525 | 6321 |
]. |
6322 |
||
6323 |
idToTableIndexMapping notNil ifTrue:[ |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6324 |
index := idToTableIndexMapping at:aWindowID ifAbsent:nil. |
1525 | 6325 |
]. |
1547 | 6326 |
index isNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6327 |
index := knownIds indexOf:aWindowID. |
1547 | 6328 |
]. |
1526 | 6329 |
index ~~ 0 ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6330 |
v := knownViews at:index. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6331 |
^ (v notNil and:[v ~~ 0]) |
1526 | 6332 |
]. |
6333 |
^ false. |
|
1525 | 6334 |
|
6335 |
"Created: 4.4.1997 / 11:01:07 / cg" |
|
1547 | 6336 |
"Modified: 4.4.1997 / 19:07:55 / cg" |
0 | 6337 |
! ! |
6338 |
||
12 | 6339 |
!DeviceWorkstation methodsFor:'window stuff'! |
6340 |
||
2756 | 6341 |
activateWindow:aWindowId |
6342 |
"make a window active. |
|
6343 |
Noop here" |
|
6344 |
||
6345 |
"Created: / 5.6.1999 / 22:07:08 / cg" |
|
6346 |
! |
|
6347 |
||
293 | 6348 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
6349 |
"clear a rectangular area of a window to its view background" |
|
6350 |
||
2648 | 6351 |
"/ mhmh - should not be needed |
293 | 6352 |
^ self subclassResponsibility |
6353 |
! |
|
6354 |
||
6355 |
clearWindow:aWindowId |
|
6356 |
"clear a windows to its view background" |
|
6357 |
||
2648 | 6358 |
"/ mhmh - should not be needed |
293 | 6359 |
^ self subclassResponsibility |
6360 |
! |
|
6361 |
||
6362 |
lowerWindow:aWindowId |
|
609 | 6363 |
"lower a window" |
6364 |
||
293 | 6365 |
^ self subclassResponsibility |
609 | 6366 |
|
6367 |
"Modified: 24.4.1996 / 19:40:04 / cg" |
|
293 | 6368 |
! |
6369 |
||
2106
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6370 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h |
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6371 |
"map a window - either as icon or as a real view - needed for restart" |
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6372 |
|
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6373 |
"/ OBSOLETE interface - this looses the minExtent/maxExtent properties |
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6374 |
"/ use mapView:...minWidth:minHeight:maxWidth:maxHeight: |
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6375 |
|
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6376 |
^ self |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
6377 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
6378 |
width:w height:h minExtent:nil maxExtent:nil |
2106
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6379 |
! |
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
6380 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
6381 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
6382 |
width:w height:h minExtent:minExt maxExtent:maxExt |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
6383 |
"make a window visible - either as icon or as a real view - needed for restart" |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
6384 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
6385 |
^ self subclassResponsibility |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
6386 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
6387 |
"Modified: 24.4.1996 / 19:43:17 / cg" |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
6388 |
! |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
6389 |
|
293 | 6390 |
mapWindow:aWindowId |
609 | 6391 |
"map a window" |
6392 |
||
293 | 6393 |
^ self subclassResponsibility |
609 | 6394 |
|
6395 |
"Modified: 24.4.1996 / 19:43:06 / cg" |
|
293 | 6396 |
! |
6397 |
||
6398 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
|
609 | 6399 |
"move & resize a window" |
6400 |
||
1002 | 6401 |
"/ fallBack: move & resize as two individual operations |
6402 |
||
6403 |
self moveWindow:aWindowId x:x y:y. |
|
1003 | 6404 |
self resizeWindow:aWindowId width:w height:h. |
293 | 6405 |
! |
6406 |
||
6407 |
moveWindow:aWindowId x:x y:y |
|
609 | 6408 |
"move a window" |
6409 |
||
293 | 6410 |
^ self subclassResponsibility |
609 | 6411 |
|
6412 |
"Modified: 24.4.1996 / 19:40:36 / cg" |
|
293 | 6413 |
! |
6414 |
||
6415 |
raiseWindow:aWindowId |
|
609 | 6416 |
"raise a window" |
6417 |
||
293 | 6418 |
^ self subclassResponsibility |
609 | 6419 |
|
6420 |
"Modified: 24.4.1996 / 19:40:42 / cg" |
|
293 | 6421 |
! |
6422 |
||
2428 | 6423 |
reparentWindow:windowId to:newParentWindowId |
6424 |
"change a windows parent (an optional interface). |
|
6425 |
Returns true if successfull." |
|
6426 |
||
6427 |
^ false |
|
6428 |
! |
|
6429 |
||
293 | 6430 |
resizeWindow:aWindowId width:w height:h |
609 | 6431 |
"resize a window" |
6432 |
||
293 | 6433 |
^ self subclassResponsibility |
609 | 6434 |
|
6435 |
"Modified: 24.4.1996 / 19:40:47 / cg" |
|
12 | 6436 |
! |
6437 |
||
6438 |
restoreCursors |
|
1475 | 6439 |
"restore the cursors of all views to their current cursor. |
6440 |
This undoes the effect of #setCursors:" |
|
46 | 6441 |
|
12 | 6442 |
knownViews notNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6443 |
knownViews validElementsDo:[:aView | |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6444 |
|c vid cid| |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6445 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6446 |
(vid := aView id) notNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6447 |
c := aView cursor. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6448 |
(c notNil and:[(cid := c id) notNil]) ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6449 |
self setCursor:cid in:vid |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6450 |
] |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6451 |
] |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6452 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6453 |
self flush |
12 | 6454 |
] |
6455 |
||
1475 | 6456 |
" |
6457 |
Display setCursors:(Cursor wait). |
|
6458 |
Delay waitForSeconds:5. |
|
6459 |
Display restoreCursors |
|
6460 |
" |
|
6461 |
||
6462 |
"Modified: 20.3.1997 / 16:28:25 / cg" |
|
12 | 6463 |
! |
6464 |
||
293 | 6465 |
setBackingStore:how in:aWindowId |
2648 | 6466 |
"turn on/off backing-store for a window. |
6467 |
A view with backingStore will redraw automatically |
|
6468 |
from the backing pixmap (without sending expose events). |
|
6469 |
An implementation may ignore this request." |
|
23 | 6470 |
|
1002 | 6471 |
"/ default here is to ignore the request |
23 | 6472 |
! |
6473 |
||
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6474 |
setBitGravity:how in:aWindowId |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6475 |
"set bit gravity for a window" |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6476 |
|
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6477 |
"/ default here is to ignore the request |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6478 |
! |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6479 |
|
293 | 6480 |
setCursor:aCursorId in:aWindowId |
2648 | 6481 |
"set a windows cursor" |
6482 |
||
6483 |
"/ mhmh - could be ignored |
|
12 | 6484 |
^ self subclassResponsibility |
6485 |
! |
|
6486 |
||
293 | 6487 |
setCursors:aCursor |
1475 | 6488 |
"change the cursor of all views on the receiver device |
6489 |
to aCursorId, without affecting the views idea of what |
|
6490 |
the cursor is (so that it can be restored from the views |
|
6491 |
cursor instance variable later). |
|
6492 |
Use of this is not recommended - its better to change |
|
6493 |
the cursor of a windowGroup alone." |
|
293 | 6494 |
|
2648 | 6495 |
|id| |
293 | 6496 |
|
1499 | 6497 |
id := (aCursor onDevice:self) id. |
293 | 6498 |
id notNil ifTrue:[ |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6499 |
knownViews validElementsDo:[:aView | |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6500 |
|vid| |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6501 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6502 |
(vid := aView id) notNil ifTrue:[ |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6503 |
self setCursor:id in:vid |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6504 |
] |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6505 |
]. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
6506 |
self flush |
293 | 6507 |
] |
6508 |
||
1475 | 6509 |
" |
6510 |
Display setCursors:(Cursor wait). |
|
6511 |
Delay waitForSeconds:5. |
|
6512 |
Display restoreCursors. |
|
6513 |
" |
|
6514 |
||
1499 | 6515 |
"Modified: 28.3.1997 / 16:14:59 / cg" |
0 | 6516 |
! |
6517 |
||
293 | 6518 |
setIconName:aString in:aWindowId |
6519 |
"set a windows icon name" |
|
10 | 6520 |
|
1002 | 6521 |
"/ default here is to ignore the request |
0 | 6522 |
! |
6523 |
||
6524 |
setSaveUnder:yesOrNo in:aWindowId |
|
2648 | 6525 |
"turn on/off save-under for a window. |
6526 |
A view with saveUnder will save the pixels of the |
|
6527 |
area covered by itself and repair from those when |
|
6528 |
unmapped (therefore, no expose events are generated later). |
|
6529 |
It is especially useful for popUp menus. |
|
6530 |
An implementation may ignore this request." |
|
10 | 6531 |
|
1002 | 6532 |
"/ default here is to ignore the request |
0 | 6533 |
! |
6534 |
||
1881 | 6535 |
setTransient:aWindowId for:aMainWindowId |
2648 | 6536 |
"set aWindowId to be a transient of aMainWindow. |
6537 |
This informs the windowManager that those are to |
|
6538 |
be handled as a group w.r.t. iconification and deiconification. |
|
6539 |
An implementation may ignore this |
|
6540 |
(being somewhat inconvenient to the user, though)" |
|
6541 |
||
6542 |
"/ default here is to ignore the request |
|
1881 | 6543 |
|
6544 |
"Created: 20.8.1997 / 20:38:32 / cg" |
|
6545 |
! |
|
6546 |
||
0 | 6547 |
setWindowBackground:aColorIndex in:aWindowId |
10 | 6548 |
"set a windows background color" |
0 | 6549 |
|
6550 |
^ self subclassResponsibility |
|
6551 |
! |
|
6552 |
||
6553 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
|
2636 | 6554 |
"set a windows background pattern to be a form. |
6555 |
No need to be implemented in concrete workstation; |
|
6556 |
if not implemented, its done by (slower) smalltalk code |
|
6557 |
(must return false from #supportsViewBackgroundPixmap query)" |
|
6558 |
||
6559 |
^ self |
|
6560 |
||
6561 |
"Modified: / 4.5.1999 / 19:06:13 / cg" |
|
0 | 6562 |
! |
6563 |
||
6564 |
setWindowBorderColor:aColorIndex in:aWindowId |
|
10 | 6565 |
"set a windows border color" |
6566 |
||
1002 | 6567 |
"/ default here is to ignore the request |
6568 |
||
6569 |
^ self |
|
0 | 6570 |
! |
6571 |
||
6572 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
|
10 | 6573 |
"set a windows border pattern" |
6574 |
||
1002 | 6575 |
"/ default here is to ignore the request |
6576 |
||
6577 |
^ self |
|
0 | 6578 |
! |
6579 |
||
6580 |
setWindowBorderShape:aPixmapId in:aWindowId |
|
10 | 6581 |
"set a windows border shape" |
6582 |
||
1002 | 6583 |
"/ default here is to ignore the request |
6584 |
||
6585 |
^ self |
|
0 | 6586 |
! |
6587 |
||
293 | 6588 |
setWindowBorderWidth:aNumber in:aWindowId |
6589 |
"set a windows border width" |
|
10 | 6590 |
|
0 | 6591 |
^ self subclassResponsibility |
6592 |
! |
|
6593 |
||
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6594 |
setWindowClass:wClass name:wName in:aWindowId |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6595 |
"define class and name of a window. |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6596 |
This may be used by the window manager to |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6597 |
select client specific resources." |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6598 |
|
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6599 |
"/ default here is to ignore the request |
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6600 |
|
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6601 |
"Created: 14.6.1996 / 17:23:34 / stefan" |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6602 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
6603 |
|
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6604 |
setWindowGravity:how in:aWindowId |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6605 |
"set window gravity for a window" |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6606 |
|
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6607 |
"/ default here is to ignore the request |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6608 |
! |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
6609 |
|
0 | 6610 |
setWindowIcon:aForm in:aWindowId |
2648 | 6611 |
"define a bitmap to be used as icon" |
6612 |
||
6613 |
self |
|
6614 |
setWindowIcon:aForm |
|
6615 |
mask:nil |
|
6616 |
in:aWindowId |
|
1375 | 6617 |
! |
6618 |
||
6619 |
setWindowIcon:aForm mask:aMaskForm in:aWindowId |
|
6620 |
"set a windows icon & iconMask" |
|
10 | 6621 |
|
2648 | 6622 |
"/ default here is to ignore the request |
0 | 6623 |
! |
6624 |
||
6625 |
setWindowIconWindow:aView in:aWindowId |
|
10 | 6626 |
"set a windows icon window" |
6627 |
||
2648 | 6628 |
"/ default here is to ignore the request |
6629 |
! |
|
6630 |
||
6631 |
setWindowMinExtent:newMinExtent maxExtent:newMaxExtent in:aWindowId |
|
6632 |
"set a windows minimum & max extents. |
|
6633 |
nil arguments are ignored." |
|
6634 |
||
0 | 6635 |
^ self subclassResponsibility |
6636 |
! |
|
6637 |
||
293 | 6638 |
setWindowName:aString in:aWindowId |
2872 | 6639 |
"define a windows name (i.e. windowTitle)" |
10 | 6640 |
|
0 | 6641 |
^ self subclassResponsibility |
6642 |
! |
|
6643 |
||
293 | 6644 |
setWindowShape:aPixmapId in:aWindowId |
6645 |
"set a windows visible shape" |
|
6646 |
||
1002 | 6647 |
"/ default here is to ignore the request |
0 | 6648 |
! |
6649 |
||
6650 |
unmapWindow:aWindowId |
|
609 | 6651 |
"unmap a window" |
6652 |
||
0 | 6653 |
^ self subclassResponsibility |
609 | 6654 |
|
6655 |
"Modified: 24.4.1996 / 19:42:39 / cg" |
|
1532 | 6656 |
! |
6657 |
||
6658 |
windowIsIconified:aWindowId |
|
6659 |
"return true, if a window is iconified" |
|
6660 |
||
6661 |
^ self subclassResponsibility |
|
6662 |
||
6663 |
"Modified: 24.4.1996 / 19:42:39 / cg" |
|
6664 |
"Created: 4.4.1997 / 14:45:26 / cg" |
|
0 | 6665 |
! ! |
6666 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
6667 |
!DeviceWorkstation class methodsFor:'documentation'! |
293 | 6668 |
|
6669 |
version |
|
2934 | 6670 |
^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.338 1999-10-04 10:44:22 cg Exp $' |
0 | 6671 |
! ! |
293 | 6672 |
DeviceWorkstation initialize! |