author | Claus Gittinger <cg@exept.de> |
Fri, 25 Jul 2014 23:25:22 +0200 | |
changeset 6555 | 237b11fd1d74 |
parent 6537 | 7496d151189e |
child 6557 | 0645e51b86c1 |
permissions | -rw-r--r-- |
0 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
6296 | 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 |
" |
|
3193 | 12 |
"{ Package: 'stx:libview' }" |
13 |
||
1286
f7c2ac67388b
inserted dummy abstract classes for ST-80 compatible subclassing
Claus Gittinger <cg@exept.de>
parents:
1281
diff
changeset
|
14 |
HostGraphicsDevice subclass:#DeviceWorkstation |
6164
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
15 |
instanceVariableNames:'visualType monitorType depth ncells bitsPerRGB bitsRed bitsGreen |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
16 |
bitsBlue redMask greenMask blueMask redShift greenShift blueShift |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
17 |
hasColors hasGreyscales width height widthMM heightMM |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
18 |
resolutionHor resolutionVer idToTableIndexMapping knownViews |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
19 |
knownIds knownBitmaps knownBitmapIds dispatching dispatchProcess |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
20 |
exitOnLastClose ctrlDown shiftDown metaDown altDown superDown |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
21 |
motionEventCompression lastId lastView keyboardMap rootView |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
22 |
isSlow activeKeyboardGrab activePointerGrab buttonTranslation |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
23 |
multiClickTimeDelta altModifiers metaModifiers ctrlModifiers |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
24 |
shiftModifiers superModifiers buttonModifiers supportsDeepIcons |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
25 |
preferredIconSize ditherColors fixColors numFixRed numFixGreen |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
26 |
numFixBlue fixGrayColors copyBuffer blackColor whiteColor |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
27 |
focusMode activeView clipBoardEncoding maxClipBoardSize focusView |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
28 |
deviceErrorSignal deviceIOErrorSignal mayOpenDebugger |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
29 |
suppressDebugger eventSema buttonLongPressedHandlerProcess |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
30 |
buttonPressTimeForMenu aboutToOpenModalWindowHooks |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
31 |
aboutToOpenNonModalWindowHooks' |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
32 |
classVariableNames:'ButtonTranslation MultiClickTimeDelta DeviceErrorSignal |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
33 |
DeviceOpenErrorSignal DeviceIOErrorSignal |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
34 |
DeviceIOTimeoutErrorSignal ErrorPrinting DefaultScreen AllScreens |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
35 |
CurrentScreenQuerySignal LastActiveScreen LastActiveProcess |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
36 |
WindowsRightButtonBehavior ExitOnLastClose |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
37 |
DrawingOnClosedDeviceSignal CopyBufferHistory |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
38 |
CopyBufferHistorySize DefaultButtonPressTimeForMenu' |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
39 |
poolDictionaries:'' |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
40 |
category:'Interface-Graphics' |
0 | 41 |
! |
42 |
||
3478 | 43 |
Object subclass:#DeviceFontMetrics |
6164
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
44 |
instanceVariableNames:'encoding ascent descent maxAscent maxDescent minWidth maxWidth |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
45 |
averageWidth minCode maxCode direction' |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
46 |
classVariableNames:'' |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
47 |
poolDictionaries:'' |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
48 |
privateIn:DeviceWorkstation |
3478 | 49 |
! |
50 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
51 |
!DeviceWorkstation class methodsFor:'documentation'! |
46 | 52 |
|
53 |
copyright |
|
54 |
" |
|
0 | 55 |
COPYRIGHT (c) 1993 by Claus Gittinger |
6296 | 56 |
All Rights Reserved |
0 | 57 |
|
46 | 58 |
This software is furnished under a license and may be used |
59 |
only in accordance with the terms of that license and with the |
|
60 |
inclusion of the above copyright notice. This software may not |
|
61 |
be provided or otherwise made available to, or used by, any |
|
62 |
other person. No title to or ownership of the software is |
|
63 |
hereby transferred. |
|
64 |
" |
|
65 |
! |
|
0 | 66 |
|
67 |
documentation |
|
68 |
" |
|
38 | 69 |
this abstract class defines common protocol to all Display types. |
4350 | 70 |
For compatibility with ST-80, this class (actually a concrete subclass) |
599 | 71 |
is also bound to the global variable Screen. |
72 |
||
73 |
DeviceWorkstation (and its concrete subclasses) are the central classes |
|
74 |
around windowManagement and event processing. |
|
75 |
See the documentation in #events and #workstationDevices for more detailed |
|
76 |
info. |
|
77 |
||
78 |
[instance variables:] |
|
0 | 79 |
|
134 | 80 |
displayId <Number> the device id of the display |
81 |
visualType <Symbol> one of #StaticGray, #PseudoColor, ... #TrueColor |
|
82 |
monitorType <Symbol> one of #monochrome, #color, #unknown |
|
83 |
||
193 | 84 |
depth <SmallInteger> bits per color |
85 |
ncells <SmallInteger> number of colors (i.e. colormap size; not always == 2^depth) |
|
86 |
bitsPerRGB <SmallInteger> number of valid bits per rgb component |
|
6296 | 87 |
(actual number taken in A/D converter; not all devices report the true value) |
193 | 88 |
bitsRed <SmallInteger> number of red bits (only valid for TrueColor displays) |
89 |
bitsGreen <SmallInteger> number of green bits (only valid for TrueColor displays) |
|
90 |
bitsBlue <SmallInteger> number of blue bits (only valid for TrueColor displays) |
|
91 |
redMask <SmallInteger> shifted red mask (only useful for TrueColor displays) |
|
92 |
greenMask <SmallInteger> shifted green mask (only useful for TrueColor displays) |
|
93 |
blueMask <SmallInteger> shifted blue mask (only useful for TrueColor displays) |
|
94 |
shiftRed <SmallInteger> number of bits to shift red bits (only valid for TrueColor displays) |
|
95 |
shiftGreen <SmallInteger> number of bits to shift green bits (only valid for TrueColor displays) |
|
96 |
shiftBlue <SmallInteger> number of bits to shift blue bits (only valid for TrueColor displays) |
|
97 |
||
134 | 98 |
hasColors <Boolean> true, if display supports colors |
99 |
hasGreyscales <Boolean> true, if display supports grey-scales (i.e is not b/w display) |
|
193 | 100 |
width <SmallInteger> number of horizontal pixels |
4350 | 101 |
height <SmallInteger> number of vertical pixels |
134 | 102 |
heightMM <Number> screen height in millimeter |
103 |
widthMM <Number> screen width in millimeter |
|
104 |
resolutionHor <Number> pixels per horizontal millimeter |
|
105 |
resolutionVer <Number> pixels per vertical millimeter |
|
106 |
||
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
107 |
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
|
108 |
knownViews <WeakArray> all of my known views |
134 | 109 |
knownIds <Collection> corresponding device-view ids |
110 |
knownBitmaps <Collection> all known device bitmaps |
|
111 |
knownBitmapIds <Collection> corresponding device-bitmap ids |
|
112 |
||
113 |
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
|
114 |
exitDispatchOnLastWindowClose |
6296 | 115 |
<Boolean> if true, dispatch is finished when the last |
116 |
window closes (default:true). |
|
134 | 117 |
|
151 | 118 |
ctrlDown <Boolean> true, if control key currently pressed |
134 | 119 |
shiftDown <Boolean> true, if shift key currently pressed |
120 |
metaDown <Boolean> true, if meta key (cmd-key) is currently pressed |
|
121 |
altDown <Boolean> true, if alt key is currently pressed |
|
122 |
||
123 |
motionEventCompression |
|
6296 | 124 |
<Boolean> if true motion events are compressed |
125 |
(obsolete: now done in sensor) |
|
134 | 126 |
|
127 |
lastId <Number> the id of the last events view (internal) |
|
128 |
lastView <View> the last events view (internal, for faster id->view mapping) |
|
129 |
||
130 |
keyboardMap <KeyBdMap> mapping for keys |
|
131 |
rootView <DisplayRootView> this displays root window |
|
132 |
isSlow <Boolean> set/cleared from startup - used to turn off |
|
6296 | 133 |
things like popup-shadows etc. |
599 | 134 |
|
1717
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
135 |
focusMode <Symbol> nil, #pointer or #activeWindow |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
136 |
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
|
137 |
|
1788 | 138 |
clipBoardEncoding |
6296 | 139 |
<Symbol> encoding of pasted clipBoard text; |
140 |
nil means: iso8859. |
|
141 |
set this to #shiftJis, if pasting |
|
142 |
SJIS text (for example, from netscape) |
|
143 |
Some systems pass encoding information |
|
144 |
in the clipBoard - there, this is not |
|
145 |
needed. |
|
1787 | 146 |
|
1122 | 147 |
[class variables:] |
148 |
||
149 |
MultiClickTimeDelta in ms; controls how long of a delay is |
|
6296 | 150 |
required between two clicks, to NOT take |
151 |
it as a multi-click. |
|
1122 | 152 |
|
153 |
ErrorPrinting controls low-level (X-) error message printing |
|
154 |
||
155 |
AllScreens a collectin of known screens |
|
156 |
||
599 | 157 |
[see also:] |
6296 | 158 |
GraphicsContext DeviceDrawable |
159 |
WindowSensor WindowGroup WindowEvent |
|
160 |
ProcessorScheduler |
|
161 |
PSMedium |
|
614 | 162 |
|
163 |
[author:] |
|
6296 | 164 |
Claus Gittinger |
0 | 165 |
" |
151 | 166 |
! |
167 |
||
293 | 168 |
events |
169 |
" |
|
6099 | 170 |
All events are processed in a workstation's dispatchEvent method. |
293 | 171 |
There, incoming events are first sent to itself, for a first (view independent) |
6099 | 172 |
preprocessing. For example, the device's state of the shift-, alt-, control and |
293 | 173 |
meta keys are updated there. After that, the event is forwarded either to |
6099 | 174 |
the view's sensor or to the view directly (if it has no sensor). |
293 | 175 |
(Sensorless views are a leftover from ancient times and will sooner or |
176 |
later vanish - simplifying things a bit. Do not depend on views without |
|
177 |
sensors to work correctly in future versions.) |
|
178 |
||
179 |
This event processing is done by the event dispatcher process, which is |
|
180 |
launched in ST/X's startup sequence (see Smalltalk>>start). |
|
6099 | 181 |
Event processing is done at a high priority, to allow keyboard processing |
293 | 182 |
and CTRL-C handling to be performed even while other processes are running. |
1697 | 183 |
The code executed by the event process is found in #startDispatch. |
293 | 184 |
|
6296 | 185 |
Individual events can be enabled or disabled. |
6099 | 186 |
The ones that are enabled by default are: |
6296 | 187 |
keypress / keyRelease |
188 |
buttonPress / buttonRelease / buttonMotion (i.e. motion with button pressed) |
|
189 |
pointerEnter / pointerLeave |
|
6099 | 190 |
|
191 |
Other events have to be enabled by sending a corresponding #enableXXXEvent |
|
293 | 192 |
message to the view which shall receive those events. |
193 |
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
|
194 |
are enabled by: 'aView enableMotionEvent' |
293 | 195 |
|
6099 | 196 |
The above is only of interest, if you write your own widget classes; |
293 | 197 |
existing widgets set things as required in their #initEvents method. |
198 |
" |
|
199 |
! |
|
200 |
||
151 | 201 |
workstationDevices |
202 |
" |
|
203 |
In ST/X, all interaction with the graphics device is done through |
|
204 |
an instance of (a subclass) of DeviceWorkstation. |
|
205 |
Every view has a reference to the device it has been created on in |
|
4350 | 206 |
its 'device' instance variable. |
151 | 207 |
|
208 |
One particular device instance is bound to the global variable Display: |
|
209 |
this is the default graphics display, on which new views are created |
|
210 |
(however, provisions exist for multi-display operation) |
|
211 |
||
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
212 |
Currently, there is are twoconcrete display classes (released to the public): |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
213 |
|
6296 | 214 |
XWorkstation - a plain X window interface |
215 |
||
216 |
GLXWorkstation - an X window interface with a GL(tm) (3D graphic library) |
|
217 |
extension; either simulated (VGL) or a real GL |
|
218 |
(real GL is only available on SGI machines) |
|
1122 | 219 |
|
220 |
the following are coming soon: |
|
221 |
||
6296 | 222 |
OpenGLWorkstation |
223 |
- an X window interface with a openGL(tm) (3D graphic library) |
|
224 |
extension; either simulated (MESA) or a real openGL |
|
225 |
(real openGL is only available on SGI/NT machines) |
|
226 |
||
227 |
WinWorkstation - what will that be ? |
|
151 | 228 |
|
229 |
An experimental version for a NeXTStep interface exists, but is currently |
|
230 |
no longer maintained and not released. |
|
231 |
||
232 |
DeviceWorkstation itself is an abstract class; the methods as defined |
|
233 |
here perform things which are common to all graphic devices or block |
|
234 |
methods and raise a subclassResponsibilty error condition. |
|
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
235 |
To create a new graphic interface, at least the subclassResponsibility-methods |
151 | 236 |
have to be reimplemented in a concrete subclass. |
237 |
||
4350 | 238 |
ST/X is designed to allow the use of multiple workstation devices in parallel, |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
239 |
if the underlying window system supports this. |
4350 | 240 |
For example, in X, it is possible to create another instance of XWorkstation, |
241 |
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
|
242 |
Multiple display operation does not work with other devices (i.e. Windows). |
151 | 243 |
|
244 |
If you want to experiment with multi-display applications, |
|
245 |
you have to: |
|
246 |
||
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
247 |
- create a new instance of XWorkstation: |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
248 |
|
6296 | 249 |
Smalltalk at:#Display2 put:(XWorkstation new). |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
250 |
or: |
6296 | 251 |
Smalltalk at:#Display2 put:(GLXWorkstation new). |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
252 |
|
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 |
- have it connect to the display (i.e. the xServer): |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
255 |
(replace 'localhost' below with the name of your display) |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
256 |
|
6296 | 257 |
Display2 := Display2 initializeFor:'localhost:0.0' |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
258 |
|
4350 | 259 |
returns nil, if connection is refused |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
260 |
- leaving you with Display2==nil in this case. |
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 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
263 |
- start an event dispatcher process for it: |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
264 |
(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
|
265 |
|
6296 | 266 |
Display2 startDispatch |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
267 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
268 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
269 |
- optionally set its keyboard map |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
270 |
(since this is usually done for Display in the startup-file, |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
271 |
the new display does not have all your added key bindings) |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
272 |
|
6296 | 273 |
Display2 keyboardMap:(Display keyboardMap) |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
274 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
275 |
|
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
276 |
- create a view for it: |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
277 |
|
6296 | 278 |
(FileBrowser onDevice:Display2) open |
279 |
||
280 |
(Workspace onDevice:Display2) open |
|
281 |
||
282 |
(Launcher onDevice:Display2) open |
|
283 |
does not work with Launcher, since its an ApplicationModel (not a view) |
|
284 |
use: |
|
285 |
Launcher openOnDevice:Display2 |
|
286 |
instead. |
|
3073 | 287 |
|
288 |
For all of the above, there is now a convenient helper method in |
|
289 |
ApplicationModel, which allows to write: |
|
6296 | 290 |
Application openOnXScreenNamed:'foo:0' |
921
db3996767685
care for rootView when checking for end of dispatch
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
291 |
|
db3996767685
care for rootView when checking for end of dispatch
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
292 |
However, as mentioned above, there may be a few places, where the default |
1191 | 293 |
display 'Display' is still hard-coded - especially, in contributed and |
294 |
Public domain code, you may find those. |
|
295 |
||
4350 | 296 |
Beside this (little bug ;-), remote display operation works pretty well. |
1191 | 297 |
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
|
298 |
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
|
299 |
where up to 6 x-terminals are connected to a single linux PC). |
1191 | 300 |
|
301 |
To make your application ready for multi-display operation, replace all |
|
302 |
references to 'Display' by: 'Screen current', which evaluates to the currently |
|
303 |
active display. I.e. each view gets its actual display via this expression. |
|
304 |
Since ST/X views already use this, new views opened by remote views should |
|
305 |
come up on the remote display. |
|
151 | 306 |
|
307 |
There is no easy solution for things like Notifiers, WarnBoxes or |
|
308 |
Debuggers when opened from some background or non-view process. |
|
309 |
These will come up one the default Display, as returned by 'Screen default'. |
|
310 |
||
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
311 |
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
|
312 |
a remote display is switched off). |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
313 |
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
|
314 |
event dispatchers context. |
4350 | 315 |
For a save environment, you should add static exception handler blocks on those |
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
316 |
signals; i.e. the setup for remote displays should look somewhat like: |
6296 | 317 |
|newDpy| |
318 |
||
319 |
newDpy := GLXWorkstation new. |
|
320 |
newDpy := newDpy initializeFor:'localhost:0.0'. |
|
321 |
newDpy isNil ifTrue:[ |
|
322 |
self warn:'cannot connect ...'. |
|
323 |
] ifFalse:[ |
|
324 |
newDpy deviceIOErrorSignal handlerBlock:[:ex | |
|
325 |
Transcript beep. |
|
326 |
Transcript showCR:'Display (' , newDpy displayName , '): connection broken.'. |
|
327 |
AbortSignal raise. |
|
328 |
]. |
|
329 |
newDpy startDispatch. |
|
330 |
Launcher openOnDevice:newDpy. |
|
331 |
]. |
|
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
332 |
|
1191 | 333 |
There may still some problems to be expected, |
151 | 334 |
if the screens have different display capabilities (b&w vs. greyscale vs. |
335 |
color display). The current styleSheet approach keeps default values |
|
4350 | 336 |
only once (it should do so per display ...) |
337 |
For now, expect ugly looking views in this case - or set your styleSheet |
|
1580
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
338 |
for the smallest common capabilities (i.e. for b&w). |
9a28ea48ec73
documentation: error handling
Claus Gittinger <cg@exept.de>
parents:
1578
diff
changeset
|
339 |
This may be fixed in a future version ... |
151 | 340 |
" |
0 | 341 |
! ! |
342 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
343 |
!DeviceWorkstation class methodsFor:'initialization'! |
0 | 344 |
|
2 | 345 |
initialize |
609 | 346 |
"create local error signals; enable errorPrinting" |
347 |
||
2 | 348 |
DeviceErrorSignal isNil ifTrue:[ |
6296 | 349 |
DeviceErrorSignal := (Signal new) mayProceed:true. |
350 |
DeviceErrorSignal notifierString:'device error'. |
|
351 |
DeviceErrorSignal nameClass:self message:#deviceErrorSignal. |
|
352 |
||
353 |
DeviceOpenErrorSignal := DeviceErrorSignal newSignalMayProceed:true. |
|
354 |
DeviceOpenErrorSignal nameClass:self message:#deviceOpenErrorSignal. |
|
355 |
DeviceOpenErrorSignal notifierString:'cannot open device'. |
|
356 |
||
357 |
DeviceIOErrorSignal := (Signal new) mayProceed:false. |
|
358 |
DeviceIOErrorSignal notifierString:'device IO error'. |
|
359 |
DeviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal. |
|
360 |
||
361 |
DeviceIOTimeoutErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false. |
|
362 |
DeviceIOTimeoutErrorSignal notifierString:'device IO timeout error'. |
|
363 |
DeviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal. |
|
364 |
||
365 |
CurrentScreenQuerySignal := QuerySignal new. |
|
366 |
CurrentScreenQuerySignal nameClass:self message:#currentScreenQuerySignal. |
|
367 |
CurrentScreenQuerySignal notifierString:'asking for current screen'. |
|
368 |
||
369 |
DrawingOnClosedDeviceSignal := DeviceErrorSignal newSignalMayProceed:true. |
|
370 |
DrawingOnClosedDeviceSignal nameClass:self message:#drawingOnClosedDeviceSignal. |
|
371 |
DrawingOnClosedDeviceSignal notifierString:'drawing attempt on closed graphics device'. |
|
3299
970960ffaef5
added DrawingOnClosedDevice signal
Claus Gittinger <cg@exept.de>
parents:
3263
diff
changeset
|
372 |
]. |
970960ffaef5
added DrawingOnClosedDevice signal
Claus Gittinger <cg@exept.de>
parents:
3263
diff
changeset
|
373 |
|
218
10072d9beba5
can now turn off Xlib error messages from the errorHandler
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
374 |
ErrorPrinting := true. |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
375 |
|
134 | 376 |
self initializeConstants. |
609 | 377 |
|
3136 | 378 |
"/ for ST80 compatibility ... |
379 |
Screen := self. |
|
380 |
||
1844 | 381 |
"Modified: 3.8.1997 / 18:14:58 / cg" |
2 | 382 |
! |
383 |
||
0 | 384 |
initializeConstants |
385 |
"initialize some (soft) constants" |
|
386 |
||
3311 | 387 |
MultiClickTimeDelta := 300. "a click within 300ms is considered a double one" |
5601 | 388 |
CopyBufferHistorySize := 20. |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
389 |
ButtonTranslation isNil ifTrue:[ |
6296 | 390 |
ButtonTranslation := #(1 2 2 2 2 2 2) "all other buttons to middleButton menu" |
391 |
"/ ButtonTranslation := #(1 2 3 4 5 6 7) "identity translation" |
|
5601 | 392 |
]. |
393 |
||
394 |
"Modified: / 25-08-2010 / 21:57:43 / cg" |
|
1704 | 395 |
! |
396 |
||
397 |
nativeWindows:aBoolean |
|
398 |
"enable / disable use of native windows - dummy here." |
|
399 |
||
0 | 400 |
! ! |
401 |
||
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
402 |
!DeviceWorkstation class methodsFor:'instance creation'! |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
403 |
|
3927 | 404 |
newDispatchingFor:aScreenName |
405 |
"create a new instance of mySelf, which serves aDeviceName. |
|
406 |
Only useful for device-classes which support multiple devices - |
|
407 |
i.e. X-Workstations" |
|
408 |
||
409 |
|newDevice someScreen| |
|
410 |
||
411 |
newDevice := self newFor:aScreenName. |
|
412 |
newDevice startDispatch. |
|
413 |
(someScreen := Screen current) isNil ifTrue:[ |
|
6296 | 414 |
someScreen := Screen default. |
3927 | 415 |
]. |
416 |
someScreen notNil ifTrue:[ |
|
6296 | 417 |
newDevice keyboardMap:(someScreen keyboardMap). |
418 |
newDevice buttonTranslation:(someScreen buttonTranslation). |
|
3927 | 419 |
]. |
420 |
||
4350 | 421 |
"/ arrange for it to finish its event dispatch loop, |
3927 | 422 |
"/ when the last view on it is closed. |
423 |
newDevice exitOnLastClose:true. |
|
424 |
||
425 |
^ newDevice. |
|
426 |
! |
|
427 |
||
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
428 |
newFor:aDisplayName |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
429 |
"Create an new instance for a connection to aDisplayName. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
430 |
If aDisplayName is nil, a connection to the standard display is opened" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
431 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
432 |
^ self basicNew initializeFor:aDisplayName |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
433 |
! |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
434 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
435 |
openDefaultDisplay:aStringOrNil |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
436 |
"open the default display. aStringOrNil may be the display name, |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
437 |
if nil, the name is extracted from command-line-arguments or the environment. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
438 |
Raise a signal if open fails." |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
439 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
440 |
|display displayName| |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
441 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
442 |
displayName := aStringOrNil ? Screen defaultDisplayName. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
443 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
444 |
"find out about the concrete Workstation class" |
4350 | 445 |
Screen isAbstract ifTrue:[ |
6296 | 446 |
|wsClass wsClasses| |
447 |
||
448 |
wsClasses := OrderedCollection new. |
|
449 |
||
450 |
#(OpenGLWorkstation GLXWorkstation XWorkstation) |
|
451 |
detect:[:eachClassNameSymbol| (wsClass := Smalltalk classNamed:eachClassNameSymbol) notNil] ifNone:nil. |
|
452 |
wsClass notNil ifTrue:[wsClasses add:wsClass]. |
|
453 |
||
454 |
"preparation for WIN32/NeXTStep/OS2 and Mac interfacing; |
|
455 |
But if X11 is linked in and it is capable of setting up a connection, that will be used." |
|
456 |
#( |
|
457 |
"/ #NeXTWorkstation nil |
|
458 |
OS2Workstation isOS2like |
|
459 |
MacWorkstation isMAClike |
|
460 |
WinWorkstation isMSWINDOWSlike |
|
461 |
) pairWiseDo:[:wsClassName :checkSel| |
|
462 |
(checkSel isNil or:[OperatingSystem perform:checkSel]) ifTrue:[ |
|
463 |
(wsClass := Smalltalk classNamed:wsClassName) notNil ifTrue:[ |
|
464 |
wsClasses add:wsClass. |
|
465 |
] |
|
466 |
]. |
|
467 |
]. |
|
468 |
||
469 |
"/ try all classes until open of display works. |
|
470 |
wsClasses detect:[:cls| |
|
471 |
[ |
|
472 |
display := cls newFor:displayName. |
|
473 |
] on:Screen deviceOpenErrorSignal do:[:ex| ]. |
|
474 |
display notNil |
|
475 |
] ifNone:nil. |
|
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
476 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
477 |
] ifFalse:[ |
6296 | 478 |
display := Screen newFor:displayName. |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
479 |
]. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
480 |
display isNil ifTrue:[ |
6296 | 481 |
Screen deviceOpenErrorSignal raiseWith:displayName. |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
482 |
]. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
483 |
Screen := display class. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
484 |
Screen default:display. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
485 |
! ! |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
486 |
|
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
487 |
!DeviceWorkstation class methodsFor:'Signal constants'! |
2 | 488 |
|
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
489 |
currentScreenQuerySignal |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
490 |
"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
|
491 |
screen (if background processes ask for one)" |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
492 |
|
3398 | 493 |
CurrentScreenQuerySignal isNil ifTrue:[ |
6296 | 494 |
DeviceWorkstation initialize |
3398 | 495 |
]. |
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
496 |
^ CurrentScreenQuerySignal |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
497 |
|
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
498 |
"Created: 15.2.1997 / 15:07:20 / cg" |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
499 |
! |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
500 |
|
2 | 501 |
deviceErrorSignal |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
502 |
"return the signal used for device error reporting. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
503 |
In multi-display configurations, this is the parent of |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
504 |
all per-instance deviceErrorSignals." |
2 | 505 |
|
506 |
^ DeviceErrorSignal |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
507 |
! |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
508 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
509 |
deviceIOErrorSignal |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
510 |
"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
|
511 |
In multi-display configurations, this is the parent of |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
512 |
all per-instance deviceIOErrorSignals." |
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 |
^ DeviceIOErrorSignal |
1973 | 515 |
! |
516 |
||
517 |
deviceIOTimeoutErrorSignal |
|
518 |
"return the signal used for device I/O timeout error reporting. |
|
519 |
In multi-display configurations, this is the parent of |
|
520 |
all per-instance deviceIOTimeoutErrorSignals." |
|
521 |
||
522 |
^ DeviceIOTimeoutErrorSignal |
|
3308 | 523 |
! |
524 |
||
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
525 |
deviceOpenErrorSignal |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
526 |
"return the signal used for reporting of errors while opening a device." |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
527 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
528 |
^ DeviceOpenErrorSignal |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
529 |
! |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
530 |
|
3308 | 531 |
drawingOnClosedDeviceSignal |
532 |
^ DrawingOnClosedDeviceSignal |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
533 |
! ! |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
534 |
|
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
535 |
!DeviceWorkstation class methodsFor:'accessing'! |
0 | 536 |
|
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
537 |
default |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
538 |
"ST-80 compatibility. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
539 |
Return the default screen. This is typically the first opened |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
540 |
Display screen in a session. Use of the global variable Display |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
541 |
should vanish over time - replace it by Screen default." |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
542 |
|
3941 | 543 |
^ DefaultScreen ? Display |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
544 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
545 |
" |
4350 | 546 |
Screen default |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
547 |
" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
548 |
! |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
549 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
550 |
default:aDevice |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
551 |
"Set the default screen. This is sent very early during startup, |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
552 |
and assigns the first opened screenDevice to both Display and the default |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
553 |
screen." |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
554 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
555 |
|old| |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
556 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
557 |
old := DefaultScreen. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
558 |
DefaultScreen := aDevice. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
559 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
560 |
"as long as global variable Display exists, set it too" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
561 |
Display := aDevice. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
562 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
563 |
old ~~ aDevice ifTrue:[ |
6296 | 564 |
DisplayRootView initialize. |
75 | 565 |
]. |
0 | 566 |
! ! |
567 |
||
5937 | 568 |
!DeviceWorkstation class methodsFor:'clipboard support'! |
569 |
||
570 |
bufferAsString:aBuffer |
|
571 |
"aBuffer (my current selection) as a string" |
|
572 |
||
573 |
aBuffer isString ifTrue:[ |
|
6296 | 574 |
^ aBuffer string. |
5937 | 575 |
]. |
576 |
||
577 |
aBuffer isNil ifTrue:[ |
|
6296 | 578 |
^ '' |
5937 | 579 |
]. |
580 |
||
581 |
aBuffer isStringCollection ifTrue:[ |
|
6296 | 582 |
^ aBuffer |
583 |
from:1 |
|
584 |
to:aBuffer size |
|
585 |
asStringWith:Character cr |
|
586 |
compressTabs:false |
|
587 |
final:nil |
|
588 |
withEmphasis:false. |
|
6130 | 589 |
]. |
590 |
||
591 |
Error handle:[:ex | |
|
6296 | 592 |
Transcript showCR:'error while converting copyBuffer to store string: ', ex description. |
593 |
Error handle:[:ex | |
|
594 |
Transcript showCR:'error while converting copyBuffer to print string: ', ex description. |
|
595 |
^ '' |
|
596 |
] do:[ |
|
597 |
^ aBuffer printString |
|
598 |
] |
|
5937 | 599 |
] do:[ |
600 |
^ aBuffer storeString |
|
601 |
] |
|
602 |
||
603 |
"Created: / 13.2.1997 / 13:10:30 / cg" |
|
604 |
"Modified: / 20.1.1998 / 14:11:01 / stefan" |
|
605 |
! ! |
|
606 |
||
4350 | 607 |
!DeviceWorkstation class methodsFor:'defaults'! |
608 |
||
609 |
defaultButtonPressTimeForMenu |
|
610 |
^ DefaultButtonPressTimeForMenu ? 1 |
|
611 |
! |
|
612 |
||
613 |
defaultButtonPressTimeForMenu:seconds |
|
614 |
DefaultButtonPressTimeForMenu := seconds |
|
615 |
! ! |
|
616 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
617 |
!DeviceWorkstation class methodsFor:'error handling'! |
293 | 618 |
|
619 |
errorInterrupt:errID with:aParameter |
|
544 | 620 |
"{ Pragma: +optSpace }" |
621 |
||
609 | 622 |
"an error in the devices low level code (typically Xlib or XtLib) |
4350 | 623 |
This is invoked via |
6296 | 624 |
XError->errorInterrupt:#DisplayError->registeredErrorInterruptHandlers |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
625 |
or |
6296 | 626 |
XError->errorInterrupt:#DisplayIOError->registeredErrorInterruptHandlers |
293 | 627 |
|
628 |
looks if a signal handler for DeviceErrorSignal is present, |
|
4350 | 629 |
and - if so raises the signal. |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
630 |
If the signal not handled, simply output a message and continue. |
293 | 631 |
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
|
632 |
investigate errors as required. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
633 |
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
|
634 |
|
4166 | 635 |
|badResource msg theDevice theSignal p signalHolder| |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
636 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
637 |
errID notNil ifTrue:[ |
6296 | 638 |
"/ |
639 |
"/ timeoutError passes the device; |
|
640 |
"/ the others pass the devicesID |
|
641 |
"/ |
|
642 |
errID == #DisplayIOTimeoutError ifTrue:[ |
|
643 |
theDevice := aParameter. |
|
644 |
"/ 'device timeout error' printCR. |
|
645 |
] ifFalse:[ |
|
646 |
AllScreens do:[:aDisplayDevice | |
|
647 |
aDisplayDevice id = aParameter ifTrue:[ |
|
648 |
theDevice := aDisplayDevice. |
|
649 |
] |
|
650 |
] |
|
651 |
] |
|
3299
970960ffaef5
added DrawingOnClosedDevice signal
Claus Gittinger <cg@exept.de>
parents:
3263
diff
changeset
|
652 |
]. |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
653 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
654 |
"/ now, we have the bad guy at hand ... |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
655 |
"/ get a per-instance signal. |
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
656 |
|
2983 | 657 |
signalHolder := theDevice ? self. |
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
658 |
errID == #DisplayIOError ifTrue:[ |
6296 | 659 |
"always raises an exception" |
660 |
theSignal := signalHolder deviceIOErrorSignal. |
|
661 |
msg := 'Display I/O Error'. |
|
662 |
badResource := theDevice. |
|
4166 | 663 |
] ifFalse:[errID == #DisplayIOTimeoutError ifTrue:[ |
6296 | 664 |
"always raises an exception for the current process" |
665 |
theSignal := signalHolder deviceIOTimeoutErrorSignal. |
|
666 |
msg := 'Display I/O timeout Error'. |
|
667 |
badResource := theDevice. |
|
4166 | 668 |
] ifFalse:[ "errID == #DisplayError" |
6296 | 669 |
"only raises an exception if handled" |
670 |
theSignal := signalHolder deviceErrorSignal. |
|
671 |
theDevice notNil ifTrue:[ |
|
672 |
"/ #resourceIdOfLastError will become instance-specific information in |
|
673 |
"/ the near future ... |
|
674 |
badResource := theDevice resourceOfId:self resourceIdOfLastError. |
|
675 |
]. |
|
676 |
msg := 'Display error: ' , self lastErrorString. |
|
4166 | 677 |
]]. |
4225
ab1087185a59
Print out DeviceWorkstation name in error/info print
Stefan Vogel <sv@exept.de>
parents:
4223
diff
changeset
|
678 |
'DeviceWorkstation [info]: ' infoPrint. msg infoPrint. ' - ' infoPrint. badResource infoPrintCR. |
4166 | 679 |
|
680 |
||
681 |
"interrupt that displays dispatch process |
|
682 |
and force it to shutdown" |
|
683 |
||
684 |
"DiplayIOTimeoutError is a synchronous event, that should hit the process |
|
685 |
that caused the timeout." |
|
686 |
||
687 |
(errID ~~ #DisplayIOTimeoutError and:[theDevice notNil]) ifTrue:[ |
|
6296 | 688 |
p := theDevice dispatchProcess. |
689 |
(p notNil and:[p ~~ Processor activeProcess]) ifTrue:[ |
|
690 |
'DeviceWorkstation [info]: interrupting: ' infoPrint. p infoPrintCR. |
|
691 |
p interruptWith:[ |
|
692 |
(errID == #DisplayError and:[theSignal isHandled not]) ifTrue:[ |
|
693 |
"unhandled display errors are ignored" |
|
694 |
ErrorPrinting ifTrue:[ |
|
695 |
('DeviceWorkstation [error]: ' , msg) errorPrintCR |
|
696 |
]. |
|
697 |
] ifFalse:[ |
|
698 |
'DeviceWorkstation [info]: raising exception ...' infoPrintCR. |
|
699 |
theSignal raiseSignalWith:badResource errorString:msg. |
|
700 |
'DeviceWorkstation [warning]: exception returned - send brokenConnection' errorPrintCR. |
|
701 |
theDevice brokenConnection. |
|
702 |
'DeviceWorkstation [warning]: stopping dispatch' errorPrintCR. |
|
703 |
theDevice stopDispatch. |
|
704 |
]. |
|
705 |
]. |
|
706 |
^ self. |
|
4166 | 707 |
"/ Processor reschedule. |
4250 | 708 |
"/ AbortOperationRequest raise. |
6296 | 709 |
]. |
4166 | 710 |
]. |
711 |
||
712 |
"If we come here, this is a DiplayIOTimeoutError, we don't know |
|
713 |
the display device or we are running on top of the dispatchProcess" |
|
1973 | 714 |
|
3186
c6cbcd34adf8
Allow handling of DisplayTimeout errors.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
715 |
(theSignal isHandled or:[theSignal handlerBlock notNil]) ifTrue:[ |
6296 | 716 |
'DeviceWorkstation [info]: raising signal in current process' infoPrintCR. |
3013 | 717 |
"/ Processor activeProcess displayString infoPrintCR. |
6296 | 718 |
theSignal raiseSignalWith:badResource errorString:msg. |
4166 | 719 |
]. |
720 |
||
721 |
errID == #DisplayError ifTrue:[ |
|
6296 | 722 |
"unhandled display errors are ignored" |
723 |
^ self. |
|
2983 | 724 |
]. |
3186
c6cbcd34adf8
Allow handling of DisplayTimeout errors.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
725 |
|
c6cbcd34adf8
Allow handling of DisplayTimeout errors.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
726 |
theDevice notNil ifTrue:[ |
6296 | 727 |
'DeviceWorkstation [info]: sending #brokenConnection' infoPrintCR. |
728 |
theDevice brokenConnection. |
|
729 |
theDevice dispatchProcess == Processor activeProcess ifTrue:[ |
|
730 |
"I am running in the dispatch process |
|
731 |
and nobody handles theSignal, so abort the dispatcher" |
|
732 |
||
733 |
'DeviceWorkstation [info]: raising AbortOperationRequest' infoPrintCR. |
|
734 |
AbortOperationRequest raise. |
|
735 |
] ifFalse:[ |
|
736 |
"Some other process (probably not even guilty - like someone doing a draw after a change) ... |
|
737 |
... see if we can unwind out of the drawing operation" |
|
738 |
||
739 |
|context| |
|
4637
b1f8510639aa
Fix display timeout error handling
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
740 |
|
b1f8510639aa
Fix display timeout error handling
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
741 |
"/ thisContext fullPrintAll. |
6296 | 742 |
context := thisContext. |
743 |
[ |
|
744 |
"find the first returnable context where theDevice is the receiver" |
|
745 |
context := context sender. |
|
746 |
] doUntil:[ |
|
747 |
context isNil or:[context receiver == theDevice and:[context canReturn]]. |
|
748 |
]. |
|
749 |
context notNil ifTrue:[ |
|
750 |
'DeviceWorkstation [info]: unwind the draw operation: ' infoPrint. |
|
751 |
context methodPrintString infoPrintCR. |
|
4637
b1f8510639aa
Fix display timeout error handling
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
752 |
"/ context fullPrintAll. |
6296 | 753 |
context unwind. |
754 |
"not reached" |
|
755 |
]. |
|
756 |
] |
|
4350 | 757 |
]. |
758 |
'DeviceWorkstation [info]: proceeding after error' infoPrintCR. |
|
1578
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
759 |
|
01db7f44cbbd
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1562
diff
changeset
|
760 |
"Modified: 11.4.1997 / 11:28:27 / cg" |
293 | 761 |
! |
762 |
||
763 |
errorPrinting |
|
609 | 764 |
"return the `errorPrinting-is-on' flag" |
765 |
||
293 | 766 |
ErrorPrinting isNil ifTrue:[^ false]. |
767 |
^ ErrorPrinting |
|
609 | 768 |
|
769 |
"Modified: 24.4.1996 / 19:35:55 / cg" |
|
293 | 770 |
! |
771 |
||
772 |
errorPrinting:aBoolean |
|
609 | 773 |
"set/clear the `errorPrinting-is-on' flag" |
774 |
||
293 | 775 |
ErrorPrinting := aBoolean |
609 | 776 |
|
777 |
"Modified: 24.4.1996 / 19:36:02 / cg" |
|
293 | 778 |
! |
779 |
||
780 |
lastErrorString |
|
781 |
"return a string describing the last error" |
|
782 |
||
783 |
^ self subclassResponsibility |
|
784 |
! |
|
785 |
||
786 |
resourceIdOfLastError |
|
787 |
"return the resource id responsible for the last error" |
|
788 |
||
789 |
^ self subclassResponsibility |
|
790 |
! ! |
|
791 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
792 |
!DeviceWorkstation class methodsFor:'queries'! |
293 | 793 |
|
794 |
allScreens |
|
609 | 795 |
"Return a collection of active display devices. |
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
796 |
Typically, there is only one: Display or Screen current." |
293 | 797 |
|
1870
7f5931773d54
allScreens should always return a collection
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
798 |
^ AllScreens ? #() |
293 | 799 |
|
800 |
" |
|
4350 | 801 |
Screen allScreens |
293 | 802 |
" |
803 |
||
804 |
"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
|
805 |
"Modified: 18.8.1997 / 18:43:42 / cg" |
293 | 806 |
! |
807 |
||
808 |
current |
|
609 | 809 |
"Return the currently active screen, |
293 | 810 |
that is, the device of the currently executing windowGroup. |
811 |
It will be used in multi-display operation, to launch views on |
|
812 |
the correct device - even if not specified explicitely. |
|
609 | 813 |
This does not yet work fully satisfying if a background processes |
3100
0997eb19c9a4
removed info message (cannot figure out current screen)
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
814 |
invokes this ... the default display is returned in this case. |
0997eb19c9a4
removed info message (cannot figure out current screen)
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
815 |
In a headless (i.e. non-GUI) application, nil is returned." |
293 | 816 |
|
1310
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
817 |
|wg dev thisProcess| |
293 | 818 |
|
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
819 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
820 |
"/ if there is only one screen, |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
821 |
"/ take that ... it ought to be display |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
822 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
823 |
AllScreens size <= 1 ifTrue:[ |
6296 | 824 |
LastActiveProcess := LastActiveScreen := nil. |
825 |
Display notNil ifTrue:[ |
|
826 |
^ Display |
|
827 |
] |
|
347 | 828 |
]. |
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
829 |
|
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
830 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
831 |
"/ someone willing to tell me ? |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
832 |
"/ |
3398 | 833 |
(dev := self currentScreenQuerySignal query) notNil ifTrue:[ |
6296 | 834 |
^ dev |
293 | 835 |
]. |
836 |
||
1310
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
837 |
thisProcess := Processor activeProcess. |
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
838 |
LastActiveScreen notNil ifTrue:[ |
6296 | 839 |
LastActiveProcess == thisProcess ifTrue:[ |
840 |
^ LastActiveScreen |
|
841 |
] |
|
1310
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
842 |
]. |
6f89c1709ac3
changed (fixed?) Screen>>current
Claus Gittinger <cg@exept.de>
parents:
1305
diff
changeset
|
843 |
|
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
844 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
845 |
"/ mhmh - multiple screens are active; |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
846 |
"/ look for the active windowGroups screen. |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
847 |
"/ 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
|
848 |
"/ the current windowGroup got corrupted somehow ... |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
849 |
|
293 | 850 |
(wg := WindowGroup activeGroup) notNil ifTrue:[ |
6296 | 851 |
"/ |
852 |
"/ ok, not a background process or scheduler ... |
|
853 |
"/ |
|
854 |
(dev := wg graphicsDevice) notNil ifTrue:[ |
|
855 |
LastActiveScreen := dev. |
|
856 |
LastActiveProcess := thisProcess. |
|
857 |
^ dev |
|
858 |
]. |
|
293 | 859 |
]. |
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
860 |
|
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
861 |
"/ |
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
862 |
"/ in all other cases, return the default display |
3100
0997eb19c9a4
removed info message (cannot figure out current screen)
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
863 |
"/ (which may be nil in a headless system) |
1219
e1e8d23f16e2
added another query signal: currentScreenQuerySignal.
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
864 |
"/ |
3100
0997eb19c9a4
removed info message (cannot figure out current screen)
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
865 |
"/ '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
|
866 |
|
293 | 867 |
^ Display |
868 |
||
869 |
" |
|
4350 | 870 |
Screen current |
3308 | 871 |
|
872 |
|s| |
|
873 |
Transcript topView windowGroup process interruptWith:[s := Screen current]. |
|
874 |
Delay waitForSeconds:0.5. |
|
875 |
s inspect |
|
293 | 876 |
" |
877 |
||
2520
c5d3b01ab788
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2476
diff
changeset
|
878 |
"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
|
879 |
"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
|
880 |
"Modified: / 18.3.1999 / 18:20:39 / stefan" |
293 | 881 |
! |
882 |
||
1968
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
883 |
currentWindow |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
884 |
"Return the currently active window, |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
885 |
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
|
886 |
|
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
887 |
|wg| |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
888 |
|
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
889 |
wg := WindowGroup activeGroup. |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
890 |
wg notNil ifTrue:[^ wg topViews first]. |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
891 |
^ nil |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
892 |
|
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
893 |
" |
4350 | 894 |
Screen currentWindow |
1968
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
895 |
" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
896 |
|
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
897 |
"Modified: / 1.9.1995 / 13:40:05 / claus" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
898 |
"Modified: / 7.2.1997 / 16:16:58 / cg" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
899 |
"Created: / 14.11.1997 / 21:52:24 / cg" |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
900 |
! |
f632cb14733b
added #currentWindow query (for ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
901 |
|
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
902 |
defaultDisplayName |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
903 |
"extract the default display name from command line arguments |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
904 |
and environment. Nil is a valid name which represents the builtin default" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
905 |
|
3747 | 906 |
|displayName| |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
907 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
908 |
"look for a '-display xxx' commandline argument" |
3747 | 909 |
displayName := Smalltalk commandLineArgumentNamed:'-display'. |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
910 |
displayName isNil ifTrue:[ |
6296 | 911 |
displayName := OperatingSystem getEnvironment:'DISPLAY'. |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
912 |
]. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
913 |
^ displayName. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
914 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
915 |
" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
916 |
self defaultDisplayName |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
917 |
" |
293 | 918 |
! |
919 |
||
3308 | 920 |
flushCachedLastScreen |
921 |
LastActiveScreen := nil. |
|
922 |
LastActiveProcess := nil. |
|
923 |
||
924 |
! |
|
925 |
||
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
926 |
isAbstract |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
927 |
"answer true, if I am not a concrete Workstation class" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
928 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
929 |
^ self == DeviceWorkstation |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
930 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
931 |
" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
932 |
DeviceWorkstation isAbstract |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
933 |
XWorkstation isAbstract |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
934 |
" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
935 |
! |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
936 |
|
6374 | 937 |
isWindowsPlatform |
938 |
^ false |
|
939 |
! |
|
940 |
||
293 | 941 |
platformName |
942 |
"ST-80 compatibility. |
|
943 |
Return a string describing the display systems platform. |
|
944 |
Returns a dummy here. This must be redefined in concrete |
|
5035 | 945 |
Workstation classes, to return somthing like 'X11', 'win32', 'os2' etc." |
946 |
||
947 |
^ #unknown |
|
293 | 948 |
! ! |
949 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
950 |
!DeviceWorkstation class methodsFor:'standalone setup'! |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
951 |
|
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
952 |
exitOnLastClose:aBoolean |
599 | 953 |
"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
|
954 |
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
|
955 |
on the (main) Display connection. |
599 | 956 |
(standAlone applications will set it)" |
957 |
||
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
958 |
"/ 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
|
959 |
"/ 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
|
960 |
"/ For all other (non-main-Display) connections, an instVar is used. |
6296 | 961 |
|
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
962 |
ExitOnLastClose := aBoolean |
599 | 963 |
|
964 |
"Modified: 23.4.1996 / 22:01:28 / cg" |
|
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
965 |
! ! |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
966 |
|
3880 | 967 |
!DeviceWorkstation methodsFor:'Compatibility-ST80'! |
1281 | 968 |
|
1352 | 969 |
colorDepth |
970 |
"alias for depth - for ST-80 compatibility" |
|
971 |
||
972 |
^ self depth |
|
973 |
! |
|
974 |
||
4380 | 975 |
colorPalette |
976 |
"alias for colorMap - for ST-80 compatibility" |
|
977 |
||
978 |
^ self colorMap |
|
979 |
! |
|
980 |
||
3189 | 981 |
stackedWindows |
982 |
"supposed to return all topViews in stacking order; |
|
983 |
BUGGY: right now, the order is undefined" |
|
984 |
||
985 |
^ self allTopViews |
|
986 |
! |
|
987 |
||
1281 | 988 |
zoom:startRect to:endRect |
989 |
"animate a rubber-rectangle from startRect to endRect. |
|
990 |
Can be used by buttons, which open some dialog for nicer user feedback. |
|
991 |
Notice: since the displays window manager typically allows a topWindow |
|
6296 | 992 |
to be placed by the user, this should not be used for modeless |
993 |
topViews. |
|
3163 | 994 |
" |
995 |
||
4350 | 996 |
^ self zoom:startRect to:endRect duration:300 |
1281 | 997 |
|
998 |
" |
|
999 |
Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) |
|
1000 |
Screen current zoom:(20@20 corner:1000@1000) to:(10@10 corner:20@20) |
|
1001 |
" |
|
1002 |
||
1003 |
"Modified: 27.1.1997 / 18:20:11 / cg" |
|
1004 |
! |
|
1005 |
||
1006 |
zoom:startRect to:endRect duration:milliseconds |
|
1007 |
"animate a rubber-rectangle from startRect to endRect. |
|
1008 |
Can be used by buttons, which open some dialog for nicer user feedback. |
|
1009 |
Notice: since the displays window manager typically allows a topWindow |
|
6296 | 1010 |
to be placed by the user, this should not be used for modeless |
1011 |
topViews. |
|
1281 | 1012 |
" |
1013 |
||
1014 |
|steps dExt dOrg org ext root| |
|
1015 |
||
1016 |
root := self rootView. |
|
1017 |
||
1018 |
steps := 10. |
|
1019 |
dExt := (endRect extent - startRect extent) / steps. |
|
1020 |
dOrg := (endRect origin - startRect origin) / steps. |
|
1021 |
0 to:steps do:[:step | |
|
6296 | 1022 |
org := (startRect origin + (dOrg * step)) rounded. |
1023 |
ext := (startRect extent + (dExt * step)) rounded. |
|
1024 |
root clippedByChildren:false. |
|
1025 |
root xoring:[ |
|
1026 |
root displayRectangleX:org x y:org y width:ext x height:ext y |
|
1027 |
]. |
|
1028 |
Delay waitForMilliseconds:(milliseconds // steps). |
|
1029 |
root xoring:[ |
|
1030 |
root displayRectangleX:org x y:org y width:ext x height:ext y |
|
1031 |
]. |
|
1281 | 1032 |
]. |
3896
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1033 |
root clippedByChildren:true. |
1281 | 1034 |
|
1035 |
" |
|
1036 |
Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) duration:1000 |
|
1037 |
Screen current zoom:(20@20 corner:1000@1000) to:(10@10 corner:20@20) duration:1000 |
|
1038 |
" |
|
1039 |
||
1040 |
"Created: 27.1.1997 / 18:19:35 / cg" |
|
1041 |
! |
|
1042 |
||
1043 |
zoom:startRect to:endRect speed:pixelsPerSecond |
|
1044 |
"animate a rubber-rectangle from startRect to endRect. |
|
1045 |
Can be used by buttons, which open some dialog for nicer user feedback. |
|
1046 |
The speed is computed for the longest edge to run at the given speed. |
|
1047 |
Notice: since the displays window manager typically allows a topWindow |
|
6296 | 1048 |
to be placed by the user, this should not be used for modeless |
1049 |
topViews. |
|
1281 | 1050 |
" |
1051 |
||
1052 |
|maxDistance| |
|
1053 |
||
1054 |
maxDistance := (endRect origin - startRect origin). |
|
1055 |
maxDistance := maxDistance max:(endRect topRight - startRect topRight). |
|
1056 |
maxDistance := maxDistance max:(endRect bottomLeft - startRect bottomLeft). |
|
1057 |
maxDistance := maxDistance max:(endRect corner - startRect corner). |
|
1058 |
maxDistance := maxDistance x max:(maxDistance y). |
|
1059 |
^ self |
|
6296 | 1060 |
zoom:startRect to:endRect duration:(maxDistance abs / pixelsPerSecond * 1000) |
1281 | 1061 |
|
1062 |
" |
|
1063 |
Screen current zoom:(10@10 corner:20@20) to:(20@20 corner:1000@1000) speed:1000 |
|
3163 | 1064 |
Screen current zoom:(20@20 corner:1000@1000) to:(10@10 corner:20@20) speed:10 |
1281 | 1065 |
" |
1066 |
||
1067 |
"Created: 27.1.1997 / 18:19:35 / cg" |
|
1068 |
"Modified: 27.1.1997 / 18:24:58 / cg" |
|
1069 |
! ! |
|
1070 |
||
3880 | 1071 |
!DeviceWorkstation methodsFor:'Compatibility-Squeak'! |
1926 | 1072 |
|
1073 |
border:aRectangle width:bw |
|
1074 |
"draw a rectangular border on the display with black. |
|
1075 |
Added to allow for some squeak examples to be evaluated ..." |
|
1076 |
||
3896
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1077 |
|r root| |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1078 |
|
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1079 |
root := self rootView. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1080 |
|
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1081 |
root clippedByChildren:false. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1082 |
root paint:Color black. |
1926 | 1083 |
r := aRectangle. |
1084 |
0 to:bw-1 do:[:i | |
|
6296 | 1085 |
root displayRectangle:r. |
1086 |
r := r insetBy:1. |
|
1926 | 1087 |
]. |
3896
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1088 |
root clippedByChildren:true. |
1926 | 1089 |
|
1090 |
" |
|
1091 |
Display restoreAfter:[ |
|
6296 | 1092 |
Display border:(10@10 corner:100@100) width:2. |
1926 | 1093 |
] |
1094 |
" |
|
1095 |
||
1096 |
"Modified: 15.10.1997 / 19:23:28 / cg" |
|
1097 |
! |
|
1098 |
||
2789 | 1099 |
cursorPoint |
1100 |
^ self pointerPosition |
|
1101 |
! |
|
1102 |
||
1926 | 1103 |
displayOpaqueString:s x:x y:y |
1104 |
"draw a string on the display with black. |
|
1105 |
Added to allow for some squeak examples to be evaluated ..." |
|
1106 |
||
3896
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1107 |
|root| |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1108 |
|
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1109 |
root := self rootView. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1110 |
|
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1111 |
root clippedByChildren:false. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1112 |
root paint:Color black. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1113 |
root displayOpaqueString:s x:x y:y. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1114 |
root clippedByChildren:true. |
1926 | 1115 |
|
1116 |
" |
|
1117 |
Display restoreAfter:[ |
|
6296 | 1118 |
Display displayOpaqueString:'hello' x:10 y:10. |
1926 | 1119 |
] |
1120 |
" |
|
1121 |
||
1122 |
"Created: 15.10.1997 / 19:25:09 / cg" |
|
1123 |
"Modified: 15.10.1997 / 19:29:05 / cg" |
|
1124 |
! |
|
1125 |
||
1126 |
displayString:s x:x y:y |
|
1127 |
"draw a string on the display with black. |
|
1128 |
Added to allow for some squeak examples to be evaluated ..." |
|
1129 |
||
3896
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1130 |
|root| |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1131 |
|
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1132 |
root := self rootView. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1133 |
|
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1134 |
root clippedByChildren:false. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1135 |
root paint:Color black. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1136 |
root displayString:s x:x y:y. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1137 |
root clippedByChildren:true. |
1926 | 1138 |
|
1139 |
" |
|
1140 |
Display restoreAfter:[ |
|
6296 | 1141 |
Display displayString:'hello' x:10 y:10. |
1926 | 1142 |
] |
1143 |
" |
|
1144 |
||
1145 |
"Modified: 15.10.1997 / 19:29:10 / cg" |
|
1146 |
! |
|
1147 |
||
3396 | 1148 |
fill:aRectangle fillColor:aColor |
1149 |
"fill a rectangular area on the display with aColor. |
|
1150 |
Added to allow for some squeak examples to be evaluated ..." |
|
1151 |
||
3896
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1152 |
|oldPaint root| |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1153 |
|
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1154 |
root := self rootView. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1155 |
|
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1156 |
oldPaint := root paint. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1157 |
root clippedByChildren:false. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1158 |
root paint:aColor. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1159 |
root fillRectangle:aRectangle. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1160 |
root clippedByChildren:true. |
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
1161 |
root paint:oldPaint. |
3396 | 1162 |
|
1163 |
" |
|
1164 |
Display restoreAfter:[ |
|
6296 | 1165 |
Display fill:(10@10 corner:100@100) fillColor:Color yellow |
3396 | 1166 |
] |
1167 |
" |
|
1168 |
||
1169 |
"Modified: 15.10.1997 / 19:28:17 / cg" |
|
1170 |
! |
|
1171 |
||
3388 | 1172 |
fillWhite |
1173 |
"fill all of the display with white. |
|
1174 |
Added to allow for some squeak examples to be evaluated ..." |
|
1175 |
||
1176 |
self fillWhite:(self bounds) |
|
1177 |
||
1178 |
" |
|
1179 |
Display restoreAfter:[ |
|
6296 | 1180 |
Display fillWhite |
3388 | 1181 |
] |
1182 |
" |
|
1183 |
" |
|
1184 |
Display restoreAfter:[ |
|
6296 | 1185 |
Display fillWhite:(10@10 corner:100@100) |
3388 | 1186 |
] |
1187 |
" |
|
1188 |
||
1189 |
"Modified: 15.10.1997 / 19:28:17 / cg" |
|
1190 |
! |
|
1191 |
||
1926 | 1192 |
fillWhite:aRectangle |
1193 |
"fill a rectangular area on the display with white. |
|
1194 |
Added to allow for some squeak examples to be evaluated ..." |
|
1195 |
||
3396 | 1196 |
self fill:aRectangle fillColor:Color white |
1926 | 1197 |
|
1198 |
" |
|
1199 |
Display restoreAfter:[ |
|
6296 | 1200 |
Display fillWhite:(10@10 corner:100@100) |
1926 | 1201 |
] |
1202 |
" |
|
1203 |
||
1204 |
"Modified: 15.10.1997 / 19:28:17 / cg" |
|
1205 |
! |
|
1206 |
||
3029 | 1207 |
primMouseButtons |
1208 |
"return the current button state" |
|
1209 |
||
1210 |
|mask| |
|
1211 |
||
1212 |
mask := 0. |
|
3038 | 1213 |
self leftButtonPressed ifTrue:[ mask := mask bitOr:4 ]. |
3029 | 1214 |
self middleButtonPressed ifTrue:[ mask := mask bitOr:2 ]. |
3038 | 1215 |
self rightButtonPressed ifTrue:[ mask := mask bitOr:1 ]. |
3029 | 1216 |
^ mask |
1217 |
||
1218 |
" |
|
1219 |
Display primMouseButtons |
|
1220 |
" |
|
1221 |
||
1222 |
"Modified: 15.10.1997 / 19:23:28 / cg" |
|
1223 |
! |
|
1224 |
||
1926 | 1225 |
restoreAfter:aBlock |
1226 |
"evaluate aBlock, wait for a buttonPress, then restore the display. |
|
1227 |
Added to allow for some squeak examples to be evaluated ..." |
|
1228 |
||
1229 |
aBlock value. |
|
3385
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
1230 |
self sync. |
1926 | 1231 |
[self anyButtonPressed] whileFalse:[]. |
1232 |
self restoreWindows. |
|
1233 |
||
1234 |
" |
|
1235 |
Display restoreAfter:[Display fillWhite:(10@10 corner:100@100)] |
|
1236 |
" |
|
1237 |
||
1238 |
"Modified: 15.10.1997 / 19:43:08 / cg" |
|
2790 | 1239 |
! |
1240 |
||
1241 |
supportsDisplayDepth:givenDepth |
|
1242 |
"return true, if the given depth is supported by the display. |
|
1243 |
(Actually, some displays support multiple depths (i.e. visuals), |
|
1244 |
but for now, we want the displays native depth here." |
|
1245 |
||
1246 |
^ depth == givenDepth |
|
2963 | 1247 |
! |
1248 |
||
1249 |
waitButton |
|
1250 |
"wait for any button to be pressed" |
|
1251 |
||
1252 |
[self anyButtonPressed] whileFalse:[Delay waitForSeconds:0.05]. |
|
1253 |
||
1254 |
" |
|
1255 |
Sensor waitButton. |
|
1256 |
Sensor waitNoButton |
|
1257 |
" |
|
1258 |
! |
|
1259 |
||
1260 |
waitClickButton |
|
1261 |
"wait for any button to be pressed and released again. |
|
1262 |
Return the screen coordinate of the click." |
|
1263 |
||
1264 |
|pos| |
|
1265 |
||
4350 | 1266 |
self waitButton. |
2963 | 1267 |
pos := self cursorPoint. |
1268 |
self waitNoButton. |
|
1269 |
^ pos |
|
1270 |
||
1271 |
" |
|
1272 |
Sensor waitClickButton. |
|
1273 |
" |
|
1274 |
! |
|
1275 |
||
1276 |
waitNoButton |
|
1277 |
"wait for no button to be pressed" |
|
1278 |
||
1279 |
[self anyButtonPressed] whileTrue:[Delay waitForSeconds:0.05]. |
|
1280 |
||
1281 |
" |
|
1282 |
Sensor waitButton. |
|
1283 |
Sensor waitNoButton |
|
1284 |
" |
|
1926 | 1285 |
! ! |
1286 |
||
2934 | 1287 |
!DeviceWorkstation methodsFor:'Signal constants'! |
1288 |
||
1289 |
deviceErrorSignal |
|
1290 |
"return the per-device signal, which is used for error reporting. |
|
4350 | 1291 |
The default here is the global DeviceErrorSignal |
2934 | 1292 |
(which is the parent of any per-instance error signals)." |
1293 |
||
1294 |
deviceErrorSignal notNil ifTrue:[^ deviceErrorSignal]. |
|
1295 |
^ self class deviceErrorSignal |
|
1296 |
! |
|
1297 |
||
1298 |
deviceIOErrorSignal |
|
1299 |
"return the signal used for device I/O error reporting. |
|
4350 | 1300 |
The default here is the global DeviceIOErrorSignal |
2934 | 1301 |
(which is the parent of any per-instance I/O error signals)." |
1302 |
||
1303 |
deviceIOErrorSignal notNil ifTrue:[^ deviceIOErrorSignal]. |
|
1304 |
^ self class deviceIOErrorSignal |
|
1305 |
! |
|
1306 |
||
1307 |
deviceIOTimeoutErrorSignal |
|
1308 |
"return the signal used for device I/O timeout error reporting. |
|
4350 | 1309 |
The default here is the global DeviceIOTimeoutErrorSignal |
2934 | 1310 |
(which is the parent of any per-instance I/O timeout signals)." |
1311 |
||
1312 |
^ self class deviceIOTimeoutErrorSignal |
|
1313 |
! ! |
|
1314 |
||
293 | 1315 |
!DeviceWorkstation methodsFor:'accessing & queries'! |
1316 |
||
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1317 |
activateOnClick:aBoolean |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1318 |
"enable/disable raise&activate on click; |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1319 |
return the previous setting. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1320 |
This may be left unimplemented by a device." |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1321 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1322 |
^ false |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1323 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1324 |
"Created: / 2.10.1998 / 01:07:51 / cg" |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1325 |
! |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2677
diff
changeset
|
1326 |
|
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1327 |
activeView |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1328 |
^ activeView |
5947
9b29e25d9ff4
comment/format in: #activeView
Claus Gittinger <cg@exept.de>
parents:
5937
diff
changeset
|
1329 |
|
9b29e25d9ff4
comment/format in: #activeView
Claus Gittinger <cg@exept.de>
parents:
5937
diff
changeset
|
1330 |
" |
9b29e25d9ff4
comment/format in: #activeView
Claus Gittinger <cg@exept.de>
parents:
5937
diff
changeset
|
1331 |
Display activeView |
9b29e25d9ff4
comment/format in: #activeView
Claus Gittinger <cg@exept.de>
parents:
5937
diff
changeset
|
1332 |
" |
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1333 |
! |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1334 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1335 |
buttonMotionMask:aMask includesButton:aButton |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1336 |
"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
|
1337 |
(1 .. 3 for left .. right) is included." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1338 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1339 |
|buttonNr| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1340 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1341 |
"reverse buttonTranslation" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1342 |
buttonTranslation notNil ifTrue:[ |
6296 | 1343 |
buttonNr := buttonTranslation indexOf:aButton ifAbsent:[1]. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1344 |
] ifFalse:[ |
6296 | 1345 |
buttonNr := aButton. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1346 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1347 |
^ (aMask bitTest:(self buttonMotionMask:buttonNr)) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1348 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1349 |
|
4895 | 1350 |
colorAt:aPoint |
1351 |
|img| |
|
1352 |
||
1353 |
img := Image fromScreen:(aPoint corner:aPoint+1) on:self grab:false. |
|
1354 |
^ img colorAt:0@0 |
|
1355 |
||
1356 |
" |
|
1357 |
Screen current colorAt:0@0 |
|
1358 |
" |
|
1359 |
! |
|
1360 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1361 |
dispatchProcess |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1362 |
^ dispatchProcess |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1363 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1364 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1365 |
displayFileDescriptor |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1366 |
"return the file descriptor associated with the display |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1367 |
if any. If there is no underlying filedescriptor, return nil. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1368 |
(used for event select/polling)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1369 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1370 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1371 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1372 |
|
4336 | 1373 |
getSystemColor:aKey |
1374 |
"retrieve a windows system color. |
|
1375 |
The styleSheet/View classes may use this to setup default colors." |
|
1376 |
||
1377 |
^ nil |
|
1378 |
||
1379 |
" |
|
1380 |
Display getSystemColor:#COLOR_WINDOW |
|
1381 |
Display getSystemColor:#COLOR_HIGHLIGHT |
|
1382 |
" |
|
1383 |
! |
|
1384 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1385 |
id |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1386 |
"return the displayId" |
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 |
^ displayId |
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 |
|
1281 | 1391 |
isOpen |
1392 |
"return true, if there is a valid connection to the display. |
|
1393 |
Added for ST-80 compatibility." |
|
1394 |
||
1395 |
^ displayId notNil |
|
1396 |
||
1397 |
"Created: 27.1.1997 / 18:28:30 / cg" |
|
1398 |
! |
|
1399 |
||
5219
779129113def
care for dead display (non dispatching)
Claus Gittinger <cg@exept.de>
parents:
5218
diff
changeset
|
1400 |
isOpenAndDispatching |
779129113def
care for dead display (non dispatching)
Claus Gittinger <cg@exept.de>
parents:
5218
diff
changeset
|
1401 |
"return true, if there is a valid connection to the display and events are dispatched." |
779129113def
care for dead display (non dispatching)
Claus Gittinger <cg@exept.de>
parents:
5218
diff
changeset
|
1402 |
|
779129113def
care for dead display (non dispatching)
Claus Gittinger <cg@exept.de>
parents:
5218
diff
changeset
|
1403 |
^ self isOpen and:[dispatching] |
779129113def
care for dead display (non dispatching)
Claus Gittinger <cg@exept.de>
parents:
5218
diff
changeset
|
1404 |
! |
779129113def
care for dead display (non dispatching)
Claus Gittinger <cg@exept.de>
parents:
5218
diff
changeset
|
1405 |
|
2932 | 1406 |
isPersistentInSnapshot |
1407 |
"return true, if resources on this device are to be made |
|
1408 |
persistent in a snapshot image." |
|
1409 |
||
1410 |
^ true |
|
1411 |
! |
|
1412 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1413 |
knownViews |
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
1414 |
"return a (non-weak) collection of all known views" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1415 |
|
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1416 |
|views| |
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1417 |
|
2475 | 1418 |
knownViews size == 0 ifTrue:[^ #()]. |
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1419 |
views := IdentitySet new. |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
1420 |
knownViews validElementsDo:[:v | views add:v]. |
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1421 |
^ views |
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
1422 |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
1423 |
"Modified: 23.1.1997 / 21:25:51 / cg" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1424 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1425 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1426 |
knownViews:aCollection |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1427 |
"set the collection of all known views - take care, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1428 |
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
|
1429 |
|
2403 | 1430 |
idToTableIndexMapping := nil. |
2181
7b07c4a6cad4
flush idToSlotIndex cache, when changing knownViews
Claus Gittinger <cg@exept.de>
parents:
2169
diff
changeset
|
1431 |
knownViews := aCollection. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1432 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1433 |
|
2859 | 1434 |
mayOpenDebugger |
1435 |
"return true, if a debugger may open on this workstation; |
|
1436 |
if false, the debugger opens on the main display. |
|
1437 |
This should be made a variable ..." |
|
1438 |
||
3424 | 1439 |
^ mayOpenDebugger ? true |
1440 |
! |
|
1441 |
||
1442 |
mayOpenDebugger:aBoolean |
|
1443 |
"set/clear the flag, which controls if a debugger may open on this workstation; |
|
1444 |
if false, the debugger opens on the main display." |
|
1445 |
||
1446 |
mayOpenDebugger := aBoolean |
|
2859 | 1447 |
! |
1448 |
||
4350 | 1449 |
multiClickTimeDelta |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1450 |
^ multiClickTimeDelta |
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 |
multiClickTimeDelta:milliseconds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1454 |
multiClickTimeDelta := milliseconds |
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 |
|
3572 | 1457 |
nativeDialogs |
1458 |
^ false |
|
1459 |
! |
|
1460 |
||
5597 | 1461 |
nativeFileDialogs |
1462 |
^ false |
|
1463 |
||
1464 |
"Created: / 24-08-2010 / 17:22:27 / sr" |
|
1465 |
! |
|
1466 |
||
4260 | 1467 |
nativeWidgets |
1468 |
^ false |
|
1469 |
! |
|
1470 |
||
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1471 |
rootView |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1472 |
"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
|
1473 |
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
|
1474 |
|
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1475 |
rootView isNil ifTrue:[ |
6296 | 1476 |
rootView := DisplayRootView onDevice:self |
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1477 |
]. |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1478 |
^ rootView |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1479 |
|
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1480 |
" |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1481 |
|v| |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1482 |
v := Display rootView. |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1483 |
v paint:Color red. |
1722 | 1484 |
v clippedByChildren:false. |
4350 | 1485 |
v fillRectangleX:10 y:10 width:100 height:100. |
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1486 |
" |
2963 | 1487 |
|
1488 |
" |
|
1489 |
|v| |
|
1490 |
v := Display rootView. |
|
1491 |
v paint:Color red. |
|
1492 |
v clippedByChildren:true. |
|
4350 | 1493 |
v fillRectangleX:10 y:10 width:100 height:100. |
2963 | 1494 |
" |
1495 |
||
729
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1496 |
! |
d2fdca1c2895
eliminated references to RootView
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1497 |
|
2885 | 1498 |
suppressDebugger |
1499 |
"return true, if no debugger should be opened for applications running |
|
1500 |
on this device (i.e. neither a debugger on the device nor on the |
|
3441 | 1501 |
main screen). |
2885 | 1502 |
If true, the debugger is either opened on the device or on the |
1503 |
main display, depending on the mayOpenDebugger setting." |
|
1504 |
||
3424 | 1505 |
^ suppressDebugger ? false |
1506 |
! |
|
1507 |
||
1508 |
suppressDebugger:aBoolean |
|
1509 |
"set/clear the flag, which controls if no debugger should be opened for applications running |
|
1510 |
on this device (i.e. neither a debugger on the device nor on the |
|
3441 | 1511 |
main screen). |
3424 | 1512 |
If true, the debugger is either opened on the device or on the |
1513 |
main display, depending on the mayOpenDebugger setting." |
|
1514 |
||
1515 |
suppressDebugger := aBoolean |
|
2885 | 1516 |
! |
1517 |
||
2876
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1518 |
suppressShadowViews |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1519 |
"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
|
1520 |
(i.e. shadows under popups and modalBoxes). |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1521 |
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
|
1522 |
|
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1523 |
^ false |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1524 |
! |
dbe1454f8539
allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents:
2875
diff
changeset
|
1525 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1526 |
translatePoint:aPoint from:windowId1 to:windowId2 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1527 |
"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
|
1528 |
aPoint in window2 (defined by its id). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1529 |
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
|
1530 |
drawing on the displays root window." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1531 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1532 |
"This method has to be reimplemented in concrete display classes." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1533 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1534 |
^ self subclassResponsibility |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1535 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1536 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1537 |
|v p root| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1538 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1539 |
v := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1540 |
v openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1541 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1542 |
root := v device rootView. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1543 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1544 |
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
|
1545 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1546 |
root clippedByChildren:false. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1547 |
root displayLineFrom:0@0 to:p. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1548 |
root clippedByChildren:true. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1549 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1550 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1551 |
|v1 v2 p1 p2 root| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1552 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1553 |
v1 := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1554 |
v1 openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1555 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1556 |
v2 := View new. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1557 |
v2 openAndWait. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1558 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1559 |
root := v1 device rootView. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1560 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1561 |
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
|
1562 |
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
|
1563 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1564 |
root clippedByChildren:false. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1565 |
root displayLineFrom:p1 to:p2. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1566 |
root clippedByChildren:true. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1567 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1568 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1569 |
|
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1570 |
translatePoint:aPoint fromView:window1 toView:window2 |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1571 |
"given a point in window1, return the coordinate of aPoint in window2. |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1572 |
Either window argument may be nil to specify the root window (screen) |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1573 |
Use to xlate points from a window to another window (or from a window |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1574 |
to the rootwindow), mainly for rubber-line drawing on the displays root window." |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1575 |
|
5243
7bbb86b0015e
handle non-views as components in translatePointFrom:...
Claus Gittinger <cg@exept.de>
parents:
5219
diff
changeset
|
1576 |
|w1 w2 devicePoint offset1 offset2| |
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1577 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1578 |
w1 := window1 ? self rootView. |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1579 |
w2 := window2 ? self rootView. |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1580 |
|
6348 | 1581 |
(w1 device ~~ self or:[w2 device ~~ self]) ifTrue:[ |
1582 |
self error:'Huh - Cross device translation' mayProceed:true. |
|
1583 |
^ aPoint |
|
5243
7bbb86b0015e
handle non-views as components in translatePointFrom:...
Claus Gittinger <cg@exept.de>
parents:
5219
diff
changeset
|
1584 |
]. |
7bbb86b0015e
handle non-views as components in translatePointFrom:...
Claus Gittinger <cg@exept.de>
parents:
5219
diff
changeset
|
1585 |
w1 isView ifTrue:[ |
6348 | 1586 |
offset1 := 0 |
5243
7bbb86b0015e
handle non-views as components in translatePointFrom:...
Claus Gittinger <cg@exept.de>
parents:
5219
diff
changeset
|
1587 |
] ifFalse:[ |
6348 | 1588 |
offset1 := w1 origin. |
1589 |
w1 := w1 container. |
|
5243
7bbb86b0015e
handle non-views as components in translatePointFrom:...
Claus Gittinger <cg@exept.de>
parents:
5219
diff
changeset
|
1590 |
]. |
7bbb86b0015e
handle non-views as components in translatePointFrom:...
Claus Gittinger <cg@exept.de>
parents:
5219
diff
changeset
|
1591 |
w2 isView ifTrue:[ |
6348 | 1592 |
offset2 := 0 |
5243
7bbb86b0015e
handle non-views as components in translatePointFrom:...
Claus Gittinger <cg@exept.de>
parents:
5219
diff
changeset
|
1593 |
] ifFalse:[ |
6348 | 1594 |
offset2 := w2 origin. |
1595 |
w2 := w2 container. |
|
5243
7bbb86b0015e
handle non-views as components in translatePointFrom:...
Claus Gittinger <cg@exept.de>
parents:
5219
diff
changeset
|
1596 |
]. |
4806 | 1597 |
devicePoint := self translatePoint:aPoint from:(w1 id) to:(w2 id). |
5259 | 1598 |
devicePoint isNil ifTrue:[ ^ aPoint]. |
5244 | 1599 |
^ devicePoint + offset1 - offset2 |
4806 | 1600 |
|
1601 |
"Modified: / 27-10-2007 / 13:04:09 / cg" |
|
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1602 |
! |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1603 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1604 |
translatePointFromRoot:aPoint toView:window |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1605 |
"given a point as absolute root-window coordinate, return the coordinate within the window. |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1606 |
Use to xlate points from the rootWindow to a window." |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1607 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1608 |
^ self translatePoint:aPoint fromView:nil toView:window |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1609 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1610 |
"Modified: / 10.10.2001 / 14:09:05 / cg" |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1611 |
! |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1612 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1613 |
translatePointToRoot:aPoint fromView:window1 |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1614 |
"given a point in window1, return the absolute root-window coordinate. |
4350 | 1615 |
Use to xlate points from a window to the rootwindow, |
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1616 |
mainly for rubber-line drawing on the displays root window." |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1617 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1618 |
^ self translatePoint:aPoint fromView:window1 toView:nil |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1619 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1620 |
"Modified: / 10.10.2001 / 14:09:22 / cg" |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1621 |
! |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1622 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1623 |
viewFromPoint:aScreenPoint |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1624 |
"given a point on the screen, return the ST/X view in which that |
4350 | 1625 |
point is (this may be a subview). |
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1626 |
Return nil, if its not an ST/X view or if the point is on the background" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1627 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1628 |
|view id| |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1629 |
|
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1630 |
id := self viewIdFromPoint:aScreenPoint. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1631 |
view := self viewFromId:id. |
2978
81de1019a14c
fixes for picking a view from another device
Claus Gittinger <cg@exept.de>
parents:
2969
diff
changeset
|
1632 |
view isNil ifTrue:[ |
6296 | 1633 |
"/ search on other devices (if present). |
1634 |
"/ This may find the view, in case another device |
|
1635 |
"/ has its views on the same display screen |
|
1636 |
"/ (i.e. under X, if its another display connection to the same |
|
1637 |
"/ X-server) |
|
1638 |
Screen allScreens do:[:aScreen | |
|
1639 |
|v| |
|
1640 |
||
1641 |
aScreen ~~ self ifTrue:[ |
|
1642 |
(v := aScreen viewFromId:id) notNil ifTrue:[ |
|
1643 |
^ v |
|
1644 |
] |
|
1645 |
] |
|
1646 |
] |
|
2978
81de1019a14c
fixes for picking a view from another device
Claus Gittinger <cg@exept.de>
parents:
2969
diff
changeset
|
1647 |
]. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1648 |
^ view |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1649 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1650 |
|
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1651 |
viewIdFromPoint:aScreenPoint |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1652 |
"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
|
1653 |
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
|
1654 |
or if the point is on the background" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1655 |
|
3513 | 1656 |
|searchId foundId n| |
3413
95e8a55dff8c
Use #realRootView to get the owning view of a point
Stefan Vogel <sv@exept.de>
parents:
3401
diff
changeset
|
1657 |
|
95e8a55dff8c
Use #realRootView to get the owning view of a point
Stefan Vogel <sv@exept.de>
parents:
3401
diff
changeset
|
1658 |
searchId := self realRootWindowId. |
2978
81de1019a14c
fixes for picking a view from another device
Claus Gittinger <cg@exept.de>
parents:
2969
diff
changeset
|
1659 |
|
4166 | 1660 |
"/ this is required, since X raises an error, when we come |
2978
81de1019a14c
fixes for picking a view from another device
Claus Gittinger <cg@exept.de>
parents:
2969
diff
changeset
|
1661 |
"/ along with an illegal id (which happens, if a view from another |
81de1019a14c
fixes for picking a view from another device
Claus Gittinger <cg@exept.de>
parents:
2969
diff
changeset
|
1662 |
"/ screen-device is picked ...) |
81de1019a14c
fixes for picking a view from another device
Claus Gittinger <cg@exept.de>
parents:
2969
diff
changeset
|
1663 |
self class deviceErrorSignal handle:[:ex | |
6296 | 1664 |
^ nil |
2978
81de1019a14c
fixes for picking a view from another device
Claus Gittinger <cg@exept.de>
parents:
2969
diff
changeset
|
1665 |
] do:[ |
6296 | 1666 |
n := 0. |
1667 |
[searchId notNil] whileTrue:[ |
|
1668 |
n := n + 1. |
|
1669 |
n > 1000 ifTrue:[ |
|
1670 |
self error:'endless view hierarchy'. |
|
1671 |
^ nil |
|
1672 |
]. |
|
1673 |
foundId := searchId. |
|
1674 |
searchId := self viewIdFromPoint:aScreenPoint in:searchId. |
|
1675 |
] |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1676 |
]. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1677 |
^ foundId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1678 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1679 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1680 |
viewIdFromPoint:aPoint in:windowId |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1681 |
"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
|
1682 |
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
|
1683 |
- 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
|
1684 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1685 |
"returning nil here actually makes drag&drop impossible |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1686 |
- 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
|
1687 |
This method has to be reimplemented in concrete display classes." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1688 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1689 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1690 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1691 |
|
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1692 |
windowAt:aScreenPoint |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1693 |
"given a point on the screen, return the ST/X topview in which that |
4350 | 1694 |
point is. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1695 |
Return nil, if its not an ST/X view or if the point is on the background. |
3517
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1696 |
Alias for viewFromPoint: for ST-80 compatibility" |
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1697 |
|
f0e11daf1d3a
added translatePoint methods with view argument (instead of id-arg)
Claus Gittinger <cg@exept.de>
parents:
3513
diff
changeset
|
1698 |
^ self viewFromPoint:aScreenPoint |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1699 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1700 |
|
3263 | 1701 |
!DeviceWorkstation methodsFor:'accessing-display attributes'! |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1702 |
|
293 | 1703 |
bitsBlue |
1602 | 1704 |
"return the number of valid bits in the blue component." |
293 | 1705 |
|
1706 |
bitsBlue isNil ifTrue:[ |
|
6296 | 1707 |
"/ not a truecolor display |
1708 |
^ bitsPerRGB |
|
293 | 1709 |
]. |
1710 |
^ bitsBlue |
|
1711 |
||
1712 |
" |
|
4350 | 1713 |
Display bitsBlue |
293 | 1714 |
" |
1715 |
||
1716 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
1602 | 1717 |
"Modified: 16.4.1997 / 15:00:53 / cg" |
293 | 1718 |
! |
1719 |
||
1720 |
bitsGreen |
|
1602 | 1721 |
"return the number of valid bits in the green component." |
293 | 1722 |
|
1723 |
bitsGreen isNil ifTrue:[ |
|
6296 | 1724 |
"/ not a truecolor display |
1725 |
^ bitsPerRGB |
|
293 | 1726 |
]. |
1727 |
^ bitsGreen |
|
1728 |
||
1729 |
" |
|
4350 | 1730 |
Display bitsGreen |
293 | 1731 |
" |
1732 |
||
1733 |
"Created: 21.10.1995 / 00:45:11 / cg" |
|
1602 | 1734 |
"Modified: 16.4.1997 / 15:01:02 / cg" |
293 | 1735 |
! |
1736 |
||
1737 |
bitsPerRGB |
|
1738 |
"return the number of valid bits per rgb component; |
|
1739 |
Currently, assume that r/g/b all have the same precision, |
|
1740 |
which is a stupid assumption (there may be some, where less |
|
1741 |
resolution is available in the blue component). |
|
1742 |
Therefore, this may be changed to return a 3-element vector. |
|
1743 |
In the meantime, use bitsRed/bitsGreen/bitsBlue to get this information." |
|
1744 |
||
1745 |
^ bitsPerRGB |
|
1746 |
||
1747 |
" |
|
4350 | 1748 |
Display bitsPerRGB |
293 | 1749 |
" |
1750 |
||
1751 |
"Modified: 21.10.1995 / 00:46:27 / cg" |
|
1752 |
! |
|
1753 |
||
1754 |
bitsRed |
|
1755 |
"return the number of valid bits in the red component." |
|
1756 |
||
1757 |
bitsRed isNil ifTrue:[ |
|
6296 | 1758 |
"/ not a truecolor display |
1759 |
^ bitsPerRGB |
|
293 | 1760 |
]. |
1761 |
^ bitsRed |
|
1762 |
||
1763 |
" |
|
1764 |
Display bitsRed |
|
1765 |
" |
|
1766 |
||
1767 |
"Created: 21.10.1995 / 00:44:55 / cg" |
|
1768 |
! |
|
1769 |
||
1197 | 1770 |
blackColor |
1771 |
"return the black color on this device. |
|
1772 |
This is the same as 'Color black on:device', but much faster." |
|
1773 |
||
1774 |
^ blackColor |
|
1775 |
||
6537 | 1776 |
" |
1777 |
Display blackColor |
|
1778 |
" |
|
1779 |
||
1197 | 1780 |
"Created: 13.1.1997 / 22:37:05 / cg" |
1781 |
"Modified: 13.1.1997 / 22:43:19 / cg" |
|
1782 |
! |
|
1783 |
||
293 | 1784 |
blackpixel |
1785 |
"return the colorId of black" |
|
1786 |
||
2853 | 1787 |
visualType == #TrueColor ifTrue:[^ 0]. |
1788 |
||
293 | 1789 |
^ self subclassResponsibility |
1790 |
! |
|
1791 |
||
996 | 1792 |
blueMask |
1793 |
"return a mask, which extracts the blueBits from a color id. |
|
4350 | 1794 |
This only makes sense with trueColor displays; |
996 | 1795 |
therefore, 0 is returned on all others." |
1796 |
||
1797 |
^ blueMask |
|
1798 |
||
1799 |
" |
|
4350 | 1800 |
Display blueMask |
996 | 1801 |
" |
1802 |
||
1803 |
"Modified: 21.10.1995 / 00:47:58 / cg" |
|
1804 |
"Created: 24.7.1996 / 13:25:21 / cg" |
|
1805 |
! |
|
1806 |
||
293 | 1807 |
depth |
1808 |
"return the depth in pixels of the display" |
|
1809 |
||
1810 |
^ depth |
|
1811 |
||
1812 |
" |
|
1813 |
Display depth |
|
1814 |
" |
|
1815 |
! |
|
1816 |
||
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1817 |
focusMode |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1818 |
^ focusMode |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1819 |
! |
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
1820 |
|
996 | 1821 |
greenMask |
1822 |
"return a mask, which extracts the greenBits from a color id. |
|
4350 | 1823 |
This only makes sense with trueColor displays; |
996 | 1824 |
therefore, 0 is returned on all others." |
1825 |
||
1826 |
^ greenMask |
|
1827 |
||
1828 |
" |
|
4350 | 1829 |
Display greenMask |
996 | 1830 |
" |
1831 |
||
1832 |
"Modified: 21.10.1995 / 00:47:58 / cg" |
|
1833 |
"Created: 24.7.1996 / 13:25:15 / cg" |
|
1834 |
! |
|
1835 |
||
293 | 1836 |
hasColors |
1837 |
"return true, if its a color display" |
|
1838 |
||
1839 |
^ hasColors |
|
1840 |
||
1841 |
" |
|
4350 | 1842 |
Display hasColors |
293 | 1843 |
" |
1844 |
! |
|
1845 |
||
631 | 1846 |
hasGrayscales |
1847 |
"return true, if this workstation supports grayscales |
|
1848 |
(also true for color displays)" |
|
1849 |
||
1850 |
^ hasGreyscales |
|
1851 |
||
1852 |
" |
|
4350 | 1853 |
Display hasGrayscales |
631 | 1854 |
" |
1855 |
||
1856 |
"Created: 2.5.1996 / 11:49:07 / cg" |
|
1857 |
! |
|
1858 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1859 |
hasGreyscales |
631 | 1860 |
"OBSOLETE english version; please use #hasGrayScales. |
1861 |
Return true, if this workstation supports greyscales |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1862 |
(also true for color displays)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1863 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1864 |
^ hasGreyscales |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1865 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1866 |
" |
4350 | 1867 |
Display hasGreyscales |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1868 |
" |
631 | 1869 |
|
1870 |
"Modified: 2.5.1996 / 11:51:03 / cg" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1871 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1872 |
|
996 | 1873 |
redMask |
1874 |
"return a mask, which extracts the redBits from a color id. |
|
4350 | 1875 |
This only makes sense with trueColor displays; |
996 | 1876 |
therefore, 0 is returned on all others." |
1877 |
||
1878 |
^ redMask |
|
1879 |
||
1880 |
" |
|
4350 | 1881 |
Display redMask |
996 | 1882 |
" |
1883 |
||
1884 |
"Created: 21.10.1995 / 00:45:27 / cg" |
|
1885 |
"Modified: 24.7.1996 / 13:25:08 / cg" |
|
1886 |
! |
|
1887 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1888 |
shiftBlue |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1889 |
"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
|
1890 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1891 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1892 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1893 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1894 |
^ blueShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1895 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1896 |
" |
4350 | 1897 |
Display shiftBlue |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1898 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1899 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1900 |
"Created: 21.10.1995 / 00:45:27 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1901 |
"Modified: 21.10.1995 / 00:47:58 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1902 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1903 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1904 |
shiftGreen |
1602 | 1905 |
"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
|
1906 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1907 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1908 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1909 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1910 |
^ greenShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1911 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1912 |
" |
4350 | 1913 |
Display shiftGreen |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1914 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1915 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1916 |
"Created: 21.10.1995 / 00:45:27 / cg" |
1602 | 1917 |
"Modified: 16.4.1997 / 15:02:37 / cg" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1918 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1919 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1920 |
shiftRed |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1921 |
"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
|
1922 |
when forming a color index. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1923 |
This only makes sense with trueColor displays; therefore, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1924 |
nil is returned on all others." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1925 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1926 |
^ redShift |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1927 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1928 |
" |
4350 | 1929 |
Display shiftRed |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1930 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1931 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1932 |
"Created: 21.10.1995 / 00:45:27 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1933 |
"Modified: 21.10.1995 / 00:48:10 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1934 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1935 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1936 |
visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1937 |
"return a symbol representing the visual type of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1938 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1939 |
^ visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1940 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1941 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1942 |
Display visualType |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1943 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1944 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1945 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1946 |
visualType:aSymbol |
4350 | 1947 |
"set the visual type. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1948 |
The only situation, where setting the visual makes sense, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1949 |
is with my plasma-display, which ignores the palette and spits out |
4350 | 1950 |
grey scales, independent of color LUT definitions. |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1951 |
(of which the server knows nothing). |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1952 |
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
|
1953 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1954 |
visualType := aSymbol. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1955 |
(visualType == #StaticGray or:[visualType == #GrayScale]) ifTrue:[ |
6296 | 1956 |
hasColors := false |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1957 |
] ifFalse:[ |
6296 | 1958 |
hasColors := true |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1959 |
] |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1960 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1961 |
|
1197 | 1962 |
whiteColor |
1963 |
"return the white color on this device. |
|
1964 |
This is the same as 'Color white on:device', but much faster." |
|
1965 |
||
1966 |
^ whiteColor |
|
1967 |
||
1968 |
"Created: 13.1.1997 / 22:37:10 / cg" |
|
1969 |
"Modified: 13.1.1997 / 22:43:04 / cg" |
|
1970 |
! |
|
1971 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1972 |
whitepixel |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1973 |
"return the colorId of white" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1974 |
|
2853 | 1975 |
visualType == #TrueColor ifTrue:[^ (1 bitShift:depth)-1]. |
1976 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1977 |
^ self subclassResponsibility |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1978 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1979 |
|
3263 | 1980 |
!DeviceWorkstation methodsFor:'accessing-display capabilities'! |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1981 |
|
5969 | 1982 |
centerOfMonitorHavingPointer |
6006 | 1983 |
^ (self monitorBoundsAt:self pointerPosition) center rounded. |
5969 | 1984 |
|
1985 |
" |
|
1986 |
Screen current centerOfMonitorHavingPointer |
|
1987 |
" |
|
1988 |
! |
|
1989 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1990 |
hasColors:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1991 |
"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
|
1992 |
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
|
1993 |
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
|
1994 |
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
|
1995 |
distinguish on a greyscale monitor)." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1996 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1997 |
hasColors := aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1998 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
1999 |
|
293 | 2000 |
hasDPS |
2001 |
"return true, if this workstation supports postscript output into views. |
|
2002 |
Should be reimplemented in concrete classes which do support this." |
|
2003 |
||
2004 |
^ false |
|
2005 |
||
2006 |
" |
|
4350 | 2007 |
Display hasDPS |
293 | 2008 |
" |
2009 |
! |
|
2010 |
||
2011 |
hasExtension:extensionString |
|
2012 |
"query for an X extension. The method here is provide for XWorkstation |
|
2013 |
protocol compatibility only." |
|
2014 |
||
2015 |
^ false |
|
2016 |
||
2017 |
" |
|
4350 | 2018 |
Display hasExtension:'XVideo' |
2019 |
Display hasExtension:'Input' |
|
2020 |
Display hasExtension:'GLX' |
|
2021 |
Display hasExtension:'X3D-PEX' |
|
2022 |
Display hasExtension:'XInputExtension' |
|
2023 |
Display hasExtension:'SHAPE' |
|
2024 |
Display hasExtension:'MIT-SHM' |
|
2025 |
Display hasExtension:'SGIFullScreenStereo' |
|
293 | 2026 |
" |
2027 |
! |
|
2028 |
||
631 | 2029 |
hasGrayscales:aBoolean |
2030 |
"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
|
2031 |
on greyScale and color monitors. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2032 |
(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
|
2033 |
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
|
2034 |
the hasGreyscales flag from your .rc file)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2035 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2036 |
hasGreyscales := aBoolean |
631 | 2037 |
|
2038 |
"Created: 2.5.1996 / 11:50:04 / cg" |
|
2039 |
! |
|
2040 |
||
2041 |
hasGreyscales:aBoolean |
|
2042 |
"OBSOLETE english version - please use #hasGrayscales: |
|
2043 |
Set the hasGreyscales flag - can be used to simulate b&w behavior |
|
2044 |
on greyScale and color monitors. |
|
2045 |
(You may want to check if your application looks ok if displayed on |
|
2046 |
a b&w monitor - even if you have a color display. To do so, clear |
|
2047 |
the hasGreyscales flag from your .rc file)" |
|
2048 |
||
2049 |
hasGreyscales := aBoolean |
|
2050 |
||
2051 |
"Modified: 2.5.1996 / 11:50:48 / cg" |
|
293 | 2052 |
! |
2053 |
||
2054 |
hasImageExtension |
|
2055 |
"return true, if this workstation supports the X Image extension" |
|
2056 |
||
2057 |
^ false |
|
2058 |
||
2059 |
" |
|
4350 | 2060 |
Display hasImageExtension |
293 | 2061 |
" |
2062 |
! |
|
2063 |
||
2064 |
hasInputExtension |
|
2065 |
"return true, if this workstation supports the X Input extension" |
|
2066 |
||
2067 |
^ false |
|
2068 |
||
2069 |
" |
|
4350 | 2070 |
Display hasInputExtension |
293 | 2071 |
" |
2072 |
! |
|
2073 |
||
2074 |
hasMultibuffer |
|
2075 |
"return true, if this workstation supports the X multibuffer extension" |
|
2076 |
||
2077 |
^ false |
|
2078 |
||
2079 |
" |
|
4350 | 2080 |
Display hasMultibuffer |
293 | 2081 |
" |
2082 |
! |
|
2083 |
||
2084 |
hasPEX |
|
2085 |
"return true, if this workstation supports PEX graphics. |
|
2086 |
Should be reimplemented in concrete classes which do support this." |
|
2087 |
||
2088 |
^ false |
|
2089 |
||
2090 |
" |
|
4350 | 2091 |
Display hasPEX |
293 | 2092 |
" |
2093 |
! |
|
2094 |
||
2095 |
hasShape |
|
2744
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2096 |
"return true, if this workstation supports arbitrary shaped windows. |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2097 |
This is obsolete - use #supportsArbitraryShapedViews." |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2098 |
|
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2099 |
^ self supportsArbitraryShapedViews |
293 | 2100 |
|
2101 |
" |
|
4350 | 2102 |
Display hasShape |
293 | 2103 |
" |
2104 |
! |
|
2105 |
||
2106 |
hasShm |
|
2107 |
"return true, if this workstation supports shared memory pixmaps. |
|
2108 |
Should be reimplemented in concrete classes which do support this." |
|
2109 |
||
2110 |
^ false |
|
2111 |
||
2112 |
" |
|
4350 | 2113 |
Display hasShm |
293 | 2114 |
" |
2115 |
! |
|
2116 |
||
2117 |
hasStereoExtension |
|
2118 |
"return true, if this workstation supports stereo GL drawing. |
|
2119 |
Both the server must support it, and the feature must have been |
|
2120 |
enabled in the smalltalk system, for true to be returned." |
|
2121 |
||
2122 |
^ false |
|
2123 |
||
2124 |
" |
|
4350 | 2125 |
Display hasStereoExtension |
293 | 2126 |
" |
2127 |
! |
|
2128 |
||
2129 |
hasXVideo |
|
2130 |
"return true, if this workstation supports the XVideo extension" |
|
2131 |
||
2132 |
^ false |
|
2133 |
||
2134 |
" |
|
4350 | 2135 |
Display hasXVideo |
293 | 2136 |
" |
2137 |
! |
|
2138 |
||
340 | 2139 |
iconSizes |
690 | 2140 |
"Get the supported icon sizes. These are typically set by the window manager. |
340 | 2141 |
We return nil here (as if there are no special size preferences)." |
2142 |
||
2143 |
^ nil |
|
2144 |
||
2145 |
"Created: 2.1.1996 / 15:08:16 / cg" |
|
690 | 2146 |
"Modified: 7.5.1996 / 10:43:38 / cg" |
340 | 2147 |
! |
2148 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2149 |
ignoreBackingStore:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2150 |
"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
|
2151 |
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
|
2152 |
very slow (from rc-file)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2153 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2154 |
^ self |
293 | 2155 |
! |
2156 |
||
2157 |
isSlow |
|
2158 |
"return true, if this is a relatively slow device - |
|
2159 |
used to turn off things like popup-shadows" |
|
2160 |
||
2161 |
^ isSlow |
|
2162 |
! |
|
2163 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2164 |
isSlow:aBoolean |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2165 |
"set/clear the slow flag. |
4350 | 2166 |
The slow-flag has no semantic meaning by itself; |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2167 |
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
|
2168 |
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
|
2169 |
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
|
2170 |
is set." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2171 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2172 |
isSlow := aBoolean |
293 | 2173 |
! |
2174 |
||
5610 | 2175 |
monitorBoundsAt:aPoint |
5622
1d15d632c9c6
comment/format in: #monitorBoundsAt:
Claus Gittinger <cg@exept.de>
parents:
5610
diff
changeset
|
2176 |
"to be redefined for display systems which support MULTI SCREEN" |
1d15d632c9c6
comment/format in: #monitorBoundsAt:
Claus Gittinger <cg@exept.de>
parents:
5610
diff
changeset
|
2177 |
|
5610 | 2178 |
^ self bounds |
5622
1d15d632c9c6
comment/format in: #monitorBoundsAt:
Claus Gittinger <cg@exept.de>
parents:
5610
diff
changeset
|
2179 |
|
1d15d632c9c6
comment/format in: #monitorBoundsAt:
Claus Gittinger <cg@exept.de>
parents:
5610
diff
changeset
|
2180 |
"Modified: / 22-10-2010 / 10:57:17 / cg" |
5606 | 2181 |
! |
2182 |
||
293 | 2183 |
monitorType |
2184 |
"return a symbol representing the monitor type of the display. |
|
2185 |
It is usually set to #unknown, #color or #monochrome. |
|
2186 |
But it can be set to any value from the startup file, for later |
|
4350 | 2187 |
testing from anywhere. For example the startup for plasma-displays |
293 | 2188 |
can set it to #plasma to later influence the colors used in widgets |
2189 |
(indirectly through the resource file)." |
|
2190 |
||
2191 |
^ monitorType |
|
2192 |
||
2193 |
" |
|
4350 | 2194 |
Display monitorType |
293 | 2195 |
" |
2196 |
! |
|
2197 |
||
2198 |
monitorType:aSymbol |
|
2199 |
"set the monitorType - see comment in DeviceWorkstation>>montorType" |
|
2200 |
||
2201 |
monitorType := aSymbol |
|
2202 |
! |
|
2203 |
||
2204 |
ncells |
|
4350 | 2205 |
"return the number of usable color cells, the display has |
293 | 2206 |
- this is not always 2 to the power of depth |
2207 |
(for example, on 6bit displays, ncells is 64 while depth is 8)" |
|
2208 |
||
2209 |
^ ncells |
|
2210 |
||
2211 |
" |
|
2212 |
Display ncells |
|
2213 |
" |
|
2214 |
! |
|
2215 |
||
5638 | 2216 |
pointIsVisible:aPoint |
2217 |
"is the point visible? |
|
2218 |
To be redefined for display systems which support MULTI SCREEN" |
|
2219 |
||
2220 |
^ self bounds containsPoint:aPoint |
|
2221 |
! |
|
2222 |
||
5636
850d83c40ad3
added: #pointsAreOnSameMonitor:and:
Stefan Vogel <sv@exept.de>
parents:
5634
diff
changeset
|
2223 |
pointsAreOnSameMonitor:point1 and:point2 |
850d83c40ad3
added: #pointsAreOnSameMonitor:and:
Stefan Vogel <sv@exept.de>
parents:
5634
diff
changeset
|
2224 |
"are the two points on the same (multi-screen) monitors? |
850d83c40ad3
added: #pointsAreOnSameMonitor:and:
Stefan Vogel <sv@exept.de>
parents:
5634
diff
changeset
|
2225 |
To be redefined for display systems which support MULTI SCREEN" |
850d83c40ad3
added: #pointsAreOnSameMonitor:and:
Stefan Vogel <sv@exept.de>
parents:
5634
diff
changeset
|
2226 |
|
850d83c40ad3
added: #pointsAreOnSameMonitor:and:
Stefan Vogel <sv@exept.de>
parents:
5634
diff
changeset
|
2227 |
^ true |
850d83c40ad3
added: #pointsAreOnSameMonitor:and:
Stefan Vogel <sv@exept.de>
parents:
5634
diff
changeset
|
2228 |
! |
850d83c40ad3
added: #pointsAreOnSameMonitor:and:
Stefan Vogel <sv@exept.de>
parents:
5634
diff
changeset
|
2229 |
|
689 | 2230 |
preferredIconSize |
2231 |
"Get the preferrered icon size. These are typically set by the window manager. |
|
2232 |
We return nil here (as if there are no special size preferences)." |
|
2233 |
||
827 | 2234 |
|sizes spec sz sz2| |
820 | 2235 |
|
821 | 2236 |
preferredIconSize isNil ifTrue:[ |
6296 | 2237 |
sizes := self iconSizes. |
2238 |
sizes notNil ifTrue:[ |
|
2239 |
spec := sizes first. |
|
2240 |
||
2241 |
"/ we prefer square icons ... |
|
2242 |
||
2243 |
sz := (spec at:#maxWidth) min: (spec at:#maxHeight). |
|
2244 |
sz > 64 ifTrue:[ |
|
2245 |
sz2 := (spec at:#minWidth) max: (spec at:#minHeight). |
|
2246 |
sz2 <= 48 ifTrue:[ |
|
2247 |
sz := 48 |
|
2248 |
] |
|
2249 |
]. |
|
2250 |
preferredIconSize := sz @ sz |
|
2251 |
]. |
|
2252 |
preferredIconSize isNil ifTrue:[ |
|
2253 |
preferredIconSize := 48@48 |
|
2254 |
]. |
|
820 | 2255 |
]. |
821 | 2256 |
|
2257 |
^ preferredIconSize |
|
689 | 2258 |
|
820 | 2259 |
" |
2260 |
Display preferredIconSize |
|
821 | 2261 |
Display preferredIconSize:32@32 |
827 | 2262 |
Display preferredIconSize:nil |
820 | 2263 |
" |
2264 |
||
827 | 2265 |
"Modified: 10.6.1996 / 22:10:58 / cg" |
821 | 2266 |
! |
2267 |
||
2268 |
preferredIconSize:anExtentPoint |
|
4350 | 2269 |
"set the preferrered icon size. |
821 | 2270 |
By default, the preferredIconSize is queried from the display, |
2271 |
however, some windowManagers return stupid values. |
|
2272 |
This methods allows overriding thngs from a startup file" |
|
2273 |
||
2274 |
preferredIconSize := anExtentPoint |
|
2275 |
||
2276 |
" |
|
4350 | 2277 |
Display preferredIconSize |
821 | 2278 |
Display preferredIconSize:32@32 |
2279 |
Display preferredIconSize:48@48 |
|
2280 |
" |
|
2281 |
||
2282 |
"Modified: 10.6.1996 / 21:01:50 / cg" |
|
689 | 2283 |
! |
2284 |
||
1024 | 2285 |
scrollsAsynchronous |
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
2286 |
"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
|
2287 |
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
|
2288 |
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
|
2289 |
|
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
2290 |
^ false |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
2291 |
! |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
2292 |
|
2536 | 2293 |
supportedImageFormatForDepth:aDepth |
2294 |
"given a depth, return the devices image format info, |
|
2295 |
which provides padding info. If the given depth is not |
|
2296 |
supported, return nil." |
|
2297 |
||
4507 | 2298 |
^ self supportedImageFormats detect:[:fmt | (fmt at:#depth) == aDepth] ifNone:nil. |
2299 |
||
2300 |
"/ self supportedImageFormats do:[:fmt | |
|
2301 |
"/ (fmt at:#depth) == aDepth ifTrue:[ |
|
2302 |
"/ ^fmt |
|
2303 |
"/ ] |
|
2304 |
"/ ]. |
|
2305 |
"/ ^ nil |
|
2536 | 2306 |
! |
2307 |
||
293 | 2308 |
supportedImageFormats |
2309 |
"return an array with supported image formats; each array entry |
|
2310 |
is another array, consisting of depth and bitsPerPixel values. |
|
2311 |
Here, we return a single format only; every graphics device must |
|
2312 |
support b&w single bit images." |
|
2313 |
||
2314 |
|info| |
|
2315 |
||
2316 |
info := IdentityDictionary new. |
|
2317 |
info at:#depth put:1. |
|
2318 |
info at:#bitsPerPixel put:1. |
|
2319 |
info at:#padding put:32. |
|
2320 |
^ Array with:info |
|
2321 |
! |
|
2322 |
||
2634 | 2323 |
supportsAnyViewBackgroundPixmaps |
2324 |
"return true, if the device allows any pixmap as |
|
2325 |
viewBackground. False returned here - redefined in some |
|
2326 |
device classes." |
|
2327 |
||
2328 |
^ false |
|
2329 |
||
2330 |
"Created: / 4.5.1999 / 18:41:01 / cg" |
|
2331 |
! |
|
2332 |
||
2744
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2333 |
supportsArbitraryShapedViews |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2334 |
"return true, if this workstation supports arbitrary shaped |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2335 |
windows. |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2336 |
Should be reimplemented in concrete classes which do support this." |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2337 |
|
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2338 |
^ false |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2339 |
|
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2340 |
" |
4350 | 2341 |
Display supportsArbitraryShapedViews |
2744
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2342 |
" |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2343 |
! |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2344 |
|
293 | 2345 |
supportsDeepIcons |
2346 |
"return true, if this device supports non b&w (i.e. greyScale |
|
817 | 2347 |
or colored icons). Many Xservers (and/or windowManagers) crash, |
2348 |
if you pass them a deep form as icon; therefore, the default is false. |
|
2349 |
It may be a good idea to check for the server vendor/release and |
|
2350 |
return true sometimes. |
|
2351 |
This flag can be set with #supportsDeepIcons:" |
|
2352 |
||
2353 |
^ supportsDeepIcons |
|
2354 |
||
2355 |
" |
|
4350 | 2356 |
Display supportsDeepIcons:true |
817 | 2357 |
|
2358 |
|v| |
|
2359 |
||
2360 |
v := StandardSystemView new. |
|
2361 |
v icon:((Image fromFile:'bitmaps/claus.gif') magnifiedTo:68@68). |
|
2362 |
v open. |
|
2363 |
" |
|
2364 |
||
2365 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
2366 |
! |
|
2367 |
||
2368 |
supportsDeepIcons:yesOrNo |
|
2369 |
"set/clear the supportsDeepIcons flag. |
|
2370 |
Many Xservers (and/or windowManagers) crash, |
|
2371 |
if you pass them a deep form as icon; therefore, the default is false." |
|
2372 |
||
2373 |
supportsDeepIcons := yesOrNo |
|
293 | 2374 |
|
2375 |
" |
|
4350 | 2376 |
Display supportsDeepIcons |
293 | 2377 |
" |
817 | 2378 |
|
2379 |
"Created: 10.6.1996 / 19:36:19 / cg" |
|
293 | 2380 |
! |
2381 |
||
2382 |
supportsGLDrawing |
|
2383 |
"return true, if this device supports 3D GL drawing. |
|
2384 |
We do not depend on that being implemented." |
|
2385 |
||
1957 | 2386 |
"This method should be reimplemented in concrete display classes." |
293 | 2387 |
^ false |
2388 |
||
2389 |
" |
|
4350 | 2390 |
Display supportsGLDrawing |
293 | 2391 |
" |
2392 |
! |
|
2393 |
||
2603 | 2394 |
supportsIconMasks |
2395 |
"return true, if this device supports masked icons. |
|
2396 |
Assume true here - to be redefined in concrete classes." |
|
2397 |
||
2398 |
^ true |
|
2399 |
||
2400 |
" |
|
4350 | 2401 |
Display supportsIconMasks |
2603 | 2402 |
" |
2403 |
||
2404 |
"Modified: / 28.4.1999 / 19:58:12 / cg" |
|
2405 |
! |
|
2406 |
||
824 | 2407 |
supportsIconViews |
2408 |
"return true, if this device supports views as icons. |
|
2409 |
Only Xservers (currently) support this." |
|
2410 |
||
2411 |
^ false |
|
2412 |
||
2413 |
" |
|
4350 | 2414 |
Display supportsIconViews |
824 | 2415 |
" |
2416 |
||
2417 |
"Modified: 10.6.1996 / 21:08:04 / cg" |
|
2418 |
! |
|
2419 |
||
2631
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
2420 |
supportsMaskedDrawingWith:aForm |
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
2421 |
"return true, if the device allows the given form pixmap |
4350 | 2422 |
to be used as paint color. |
2631
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
2423 |
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
|
2424 |
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
|
2425 |
- redefined in most device classes." |
2332
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
2426 |
|
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
2427 |
^ false |
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
2428 |
|
2631
c42013ed57a8
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2622
diff
changeset
|
2429 |
"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
|
2430 |
"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
|
2431 |
! |
c025bb452cd9
added #supportsPatternDrawing query (for win-95)
Claus Gittinger <cg@exept.de>
parents:
2324
diff
changeset
|
2432 |
|
2749
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2433 |
supportsRoundShapedViews |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2434 |
"return true, if this workstation supports round shaped |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2435 |
(elliptical & circular) windows. |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2436 |
Should be reimplemented in concrete classes which do support this." |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2437 |
|
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2438 |
^ false |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2439 |
|
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2440 |
" |
4350 | 2441 |
Display supportsRoundShapedViews |
2749
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2442 |
" |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2443 |
! |
9052311a0bc1
added #supportsRoundShapedViews
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
2444 |
|
2634 | 2445 |
supportsViewBackgroundPixmap:aForm |
2446 |
"return true, if the device allows the given pixmap as |
|
2447 |
viewBackground. If false is returned, |
|
2448 |
drawing is done by (possibly) slower smalltalk code. |
|
2449 |
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
|
2450 |
|
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
2451 |
^ false |
2634 | 2452 |
|
2453 |
"Created: / 4.5.1999 / 18:40:25 / cg" |
|
2454 |
"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
|
2455 |
! |
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
2456 |
|
293 | 2457 |
supportsViewGravity |
2458 |
"return true, if this device supports gravity attributes. |
|
2459 |
We do not depend on the being implemented, but some resizing operations |
|
2460 |
are faster, it is is." |
|
2461 |
||
2462 |
"This method should to be reimplemented in concrete display classes." |
|
2463 |
^ false |
|
2464 |
||
2465 |
" |
|
4350 | 2466 |
Display supportsViewGravity |
293 | 2467 |
" |
2906
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2468 |
! |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2469 |
|
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2470 |
supportsWindowBorder:aNumber |
3108 | 2471 |
"return true, if this device supports bordered windows with the given borderWidth. |
2472 |
Right now, some drawing stuff depends on (at least) a border of 1 pixel |
|
2906
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2473 |
to be supported by the device. |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2474 |
ST/X's views are being rewritten to draw the border manually in the |
3108 | 2475 |
future, since some systems do not support arbitrary borders (i.e. Windows)." |
2906
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2476 |
|
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2477 |
^ true |
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2478 |
|
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2479 |
" |
4350 | 2480 |
Display supportsWindowBorder:1 |
2906
f94aca472883
added query if device supports bordered windows.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
2481 |
" |
6537 | 2482 |
! |
2483 |
||
2484 |
supportsXFTFonts |
|
2485 |
"return true, if this device supports xft font rendering. |
|
2486 |
Xft support is being cleaned up, as it is currently a big hack, |
|
2487 |
of which too many others need to know about currently." |
|
2488 |
||
2489 |
^ false |
|
2490 |
||
2491 |
" |
|
2492 |
Display supportsXFTFonts |
|
2493 |
" |
|
2494 |
! |
|
2495 |
||
2496 |
supportsXftFonts |
|
2497 |
"return true, if this device supports xft font rendering. |
|
2498 |
Xft support is being cleaned up, as it is currently a big hack, |
|
2499 |
of which too many others need to know about currently." |
|
2500 |
||
2501 |
^ false |
|
2502 |
||
2503 |
" |
|
2504 |
Display supportsXftFonts |
|
2505 |
" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2506 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2507 |
|
3263 | 2508 |
!DeviceWorkstation methodsFor:'accessing-display geometry'! |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2509 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2510 |
boundingBox |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2511 |
"return a rectangle representing the displays bounding box. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2512 |
For Smalltalk-80 2.x compatibility" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2513 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2514 |
^ self bounds |
293 | 2515 |
! |
2516 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2517 |
bounds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2518 |
"return a rectangle representing the displays bounding box. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2519 |
For Smalltalk-80 4.x compatibility" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2520 |
|
656 | 2521 |
^ 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
|
2522 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2523 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2524 |
Screen default bounds |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2525 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2526 |
"/ thats the same as: |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2527 |
" |
4350 | 2528 |
Display bounds |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2529 |
" |
656 | 2530 |
|
2531 |
"Modified: 8.5.1996 / 20:58:26 / cg" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2532 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2533 |
|
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2534 |
captionHeight |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2535 |
"return the height in pixels of the caption |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2536 |
(i.e. title bar) of topWindows. |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2537 |
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
|
2538 |
Applications should not depend on that returned value |
4350 | 2539 |
to be exact - on some systems (windowManagers), |
2308
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2540 |
its value cannot be retrieved" |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2541 |
|
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2542 |
^ 0 |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2543 |
! |
3f4c19d81b4b
dummy methods for #supportBackgroundPixmaps and #captionHeight
Claus Gittinger <cg@exept.de>
parents:
2275
diff
changeset
|
2544 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2545 |
center |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2546 |
"return the centerpoint in pixels of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2547 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2548 |
^ (width // 2) @ (height // 2) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2549 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2550 |
|
783
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2551 |
drawingResolution |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2552 |
"return a point consisting of the actual drawing resolution |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2553 |
in pixel-per-inch horizontally and vertically. |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2554 |
On screen devices, this is the same as resolution; on postscript |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2555 |
devices, this is usually higher than the coordinate systems unit. |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2556 |
This method is provided for compatibility with postscript media, |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2557 |
to query the device if sub-pixel-coordinate drawing is possible. |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2558 |
(there are a few situations, in which resolution-independ drawing |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2559 |
leads to ugly looking output ... knowing about subPixel resolution |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2560 |
may help there.)" |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2561 |
|
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2562 |
^ self resolution |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2563 |
|
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2564 |
"Created: 4.6.1996 / 15:20:43 / cg" |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2565 |
"Modified: 4.6.1996 / 17:56:26 / cg" |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2566 |
! |
6492ac9c2494
added resolution & drawingResolution
Claus Gittinger <cg@exept.de>
parents:
762
diff
changeset
|
2567 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2568 |
extent |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2569 |
"return the extent of the display (in pixels)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2570 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2571 |
^ width @ height |
293 | 2572 |
|
2573 |
" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2574 |
Display extent |
293 | 2575 |
" |
2576 |
! |
|
2577 |
||
5994 | 2578 |
extentOfResizeHandle |
2579 |
"if the window system needs any area for a window resize handle (such as on MACOS-X), |
|
6011
5f2245003b40
semaphore bug workaround - temporary
Claus Gittinger <cg@exept.de>
parents:
6006
diff
changeset
|
2580 |
this area's extent is returned here. It is assumed, that this handle is located at the lower-right |
5994 | 2581 |
of the window. |
2582 |
0@0 is returned for systems which locate the resize handles outside the client area. |
|
2583 |
This may be used by the UI painter or programmatically to reserve some client area. |
|
2584 |
This method must be redefined for displays which need it (i.e. X11 on osx)" |
|
2585 |
||
2586 |
^ 0@0 |
|
2587 |
! |
|
2588 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2589 |
height |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2590 |
"return the height of the display (in pixels)" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2591 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2592 |
^ height |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2593 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2594 |
"Display height" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2595 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2596 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2597 |
heightInMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2598 |
"return the height in millimeter of the display" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2599 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2600 |
^ heightMM |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2601 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2602 |
"Display heightInMillimeter" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2603 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2604 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2605 |
heightInMillimeter:aNumber |
4350 | 2606 |
"set the height in millimeter of the display |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2607 |
- 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
|
2608 |
|
1044 | 2609 |
aNumber > 0 ifTrue:[ |
6296 | 2610 |
heightMM := aNumber. |
2611 |
resolutionVer := nil. |
|
1044 | 2612 |
] |
2613 |
||
2614 |
"Modified: 10.9.1996 / 14:25:39 / cg" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2615 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2616 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2617 |
horizontalPixelPerInch |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2618 |
"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
|
2619 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2620 |
^ (width / widthMM) * 25.4 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2621 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2622 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2623 |
horizontalPixelPerMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2624 |
"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
|
2625 |
|
999 | 2626 |
resolutionHor notNil ifTrue:[ |
6296 | 2627 |
^ resolutionHor |
999 | 2628 |
]. |
1000 | 2629 |
resolutionHor := (width / widthMM) asFloat. |
999 | 2630 |
^ resolutionHor |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2631 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2632 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2633 |
pixelPerInch |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2634 |
"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
|
2635 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2636 |
^ ((width / widthMM) @ (height / heightMM)) * 25.4 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2637 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2638 |
"Display pixelPerInch" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2639 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2640 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2641 |
pixelPerMillimeter |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2642 |
"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
|
2643 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2644 |
^ (width / widthMM) @ (height / heightMM) |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2645 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2646 |
"Display pixelPerMillimeter" |
293 | 2647 |
! |
2648 |
||
390
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2649 |
resolution |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2650 |
"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
|
2651 |
This is an ST-80 compatibility method" |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2652 |
|
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2653 |
^ self pixelPerInch |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2654 |
! |
19a90edd0dc4
added #resolution for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
354
diff
changeset
|
2655 |
|
6149 | 2656 |
setUsableHeight:h |
2657 |
height := h |
|
2658 |
! |
|
2659 |
||
2660 |
setUsableWidth:w |
|
2661 |
width := w |
|
2662 |
! |
|
2663 |
||
5868 | 2664 |
smallestMonitorHeight |
2665 |
"returns the usable height of the smallest monitor in a mult-monitor setup. |
|
2666 |
Subclasses supporting multi-monitors redefine this." |
|
2667 |
||
2668 |
^ self usableHeight. |
|
2669 |
! |
|
2670 |
||
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2671 |
usableExtent |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2672 |
"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
|
2673 |
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
|
2674 |
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
|
2675 |
|
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2676 |
^ width @ height |
1844 | 2677 |
|
2678 |
" |
|
4350 | 2679 |
Display extent |
2680 |
Display usableExtent |
|
1844 | 2681 |
" |
2682 |
||
2683 |
"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
|
2684 |
! |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2685 |
|
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2686 |
usableHeight |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2687 |
"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
|
2688 |
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
|
2689 |
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
|
2690 |
|
1708 | 2691 |
^ self usableExtent y |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2692 |
! |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2693 |
|
5550 | 2694 |
usableHeightAt:aPoint |
2695 |
"returns the usable height of the display (in pixels) at a given point |
|
2696 |
Normally, the same as height, but may be smaller, in |
|
2697 |
case some menu space is taken up by the window manager (windows). |
|
5610 | 2698 |
On multi-display systems with different sized screens, this should care for |
5550 | 2699 |
which display is at the given x-position" |
2700 |
||
2701 |
^ self usableHeight |
|
2702 |
! |
|
2703 |
||
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2704 |
usableWidth |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2705 |
"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
|
2706 |
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
|
2707 |
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
|
2708 |
|
1708 | 2709 |
^ self usableExtent x |
1692
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2710 |
! |
c301f69d322b
added #usableExtent (subtracts the toolBar height from the displays height)
Claus Gittinger <cg@exept.de>
parents:
1684
diff
changeset
|
2711 |
|
293 | 2712 |
verticalPixelPerInch |
2713 |
"return the number of vertical pixels per inch of the display" |
|
2714 |
||
2715 |
^ (height / heightMM) * 25.4 |
|
2716 |
! |
|
2717 |
||
2718 |
verticalPixelPerMillimeter |
|
2719 |
"return the number of vertical pixels per millimeter of the display" |
|
2720 |
||
999 | 2721 |
resolutionVer notNil ifTrue:[ |
6296 | 2722 |
^ resolutionVer |
999 | 2723 |
]. |
1000 | 2724 |
resolutionVer := (height / heightMM) asFloat. |
999 | 2725 |
^ resolutionVer |
293 | 2726 |
! |
2727 |
||
2728 |
virtualExtent |
|
2729 |
"return the virtual extent of the display (in pixels). |
|
2730 |
On most systems, this is the same as the physical width; |
|
2731 |
except, if a window manager with a virtual desktop like olvwm |
|
2732 |
(simulating a bigger screen) is running." |
|
2733 |
||
2734 |
^ width @ height |
|
2735 |
! |
|
2736 |
||
2737 |
virtualHeight |
|
2738 |
"return the virtual height of the display (in pixels). |
|
2739 |
On most systems, this is the same as the physical height; |
|
2740 |
except, if a window manager with a virtual desktop like olvwm |
|
2741 |
(simulating a bigger screen) is running." |
|
2742 |
||
2743 |
^ self virtualExtent y |
|
2744 |
||
2745 |
"Display virtualHeight" |
|
2746 |
! |
|
2747 |
||
2748 |
virtualWidth |
|
2749 |
"return the virtual width of the display (in pixels). |
|
2750 |
On most systems, this is the same as the physical width; |
|
2751 |
except, if a window manager with a virtual desktop like olvwm |
|
2752 |
(simulating a bigger screen) is running." |
|
2753 |
||
2754 |
^ self virtualExtent x |
|
2755 |
||
2756 |
"Display virtualWidth" |
|
2757 |
! |
|
2758 |
||
2759 |
width |
|
2760 |
"return the width of the display (in pixels)" |
|
2761 |
||
2762 |
^ width |
|
2763 |
||
2764 |
"Display width" |
|
2765 |
! |
|
2766 |
||
2767 |
widthInMillimeter |
|
2768 |
"return the width in millimeter of the display" |
|
2769 |
||
2770 |
^ widthMM |
|
2771 |
||
2772 |
"Display widthInMillimeter" |
|
2773 |
! |
|
2774 |
||
2775 |
widthInMillimeter:aNumber |
|
4350 | 2776 |
"set the width in millimeter of the display |
293 | 2777 |
- needed since some displays do not tell the truth or do not know it" |
2778 |
||
1044 | 2779 |
aNumber > 0 ifTrue:[ |
6296 | 2780 |
widthMM := aNumber. |
2781 |
resolutionHor := nil. |
|
1044 | 2782 |
]. |
2783 |
||
2784 |
"Modified: 10.9.1996 / 14:25:27 / cg" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2785 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2786 |
|
3263 | 2787 |
!DeviceWorkstation methodsFor:'accessing-keyboard mappings'! |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2788 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2789 |
buttonTranslation |
4485 | 2790 |
"return the buttonTranslation (for lefthanders)" |
2791 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2792 |
^ buttonTranslation |
293 | 2793 |
! |
2794 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2795 |
buttonTranslation:anArray |
4485 | 2796 |
"set the buttonTranslation (for lefthanders)" |
2797 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2798 |
buttonTranslation := anArray |
4849 | 2799 |
|
2800 |
" |
|
2801 |
Screen current buttonTranslation |
|
2802 |
Screen current buttonTranslation:#(1 2 1) |
|
2803 |
" |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2804 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2805 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2806 |
keyboardMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2807 |
"return the keyboard map" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2808 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2809 |
^ keyboardMap |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2810 |
|
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2811 |
" |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2812 |
Screen current keyboardMap |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2813 |
" |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2814 |
|
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2815 |
"Modified: / 08-08-2006 / 15:00:35 / cg" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2816 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2817 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2818 |
keyboardMap:aMap |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2819 |
"set the keyboard map" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2820 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2821 |
keyboardMap := aMap |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2822 |
! |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2823 |
|
5778
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2824 |
shortKeyPrefixSeparator |
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2825 |
"the saparator shown between the shortcut modified (CTRL, CMD etc.) |
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2826 |
and the actual character. I.e. makes a Ctrl+A" |
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2827 |
|
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2828 |
"/ used to be '-' |
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2829 |
^ '+' |
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2830 |
|
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2831 |
"Created: / 21-07-2011 / 16:04:22 / cg" |
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2832 |
! |
9416217f347a
added: #shortKeyPrefixSeparator
Claus Gittinger <cg@exept.de>
parents:
5734
diff
changeset
|
2833 |
|
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2834 |
shortKeyStringFor:symbolicOrRawKey |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2835 |
"For given symbolic or raw key, return a user-friendly shortcut description string. |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2836 |
Examples: |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2837 |
#Find -> Ctrl+f (depending on your settings) |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2838 |
#CtrlX -> Ctrl+X |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2839 |
|
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2840 |
This method is used in menu panel (#shortcutKeyAsString) to display shortcuts in menus. |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2841 |
" |
5848 | 2842 |
|
5111 | 2843 |
|untranslatedKeys untranslatedKey prefix| |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2844 |
|
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2845 |
"/ this is somewhat complicated: we have the symbolic key at hand, |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2846 |
"/ but want to know the untranslated (inverse keyBoardMapped) key & modifier |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2847 |
"/ this is used in the menu, to show the shortCut key beside the items. |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2848 |
|
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2849 |
untranslatedKeys := OrderedCollection new. |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2850 |
self keyboardMap keysAndValuesDo:[:k :v | v == symbolicOrRawKey ifTrue:[untranslatedKeys add:k]]. |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2851 |
untranslatedKeys size == 0 ifTrue:[ |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2852 |
"/ if its not an explicit command key (Ctrl-*, Alt-* or Cmd-*), |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2853 |
"/ but a symbolic key, return nil. |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2854 |
(#('Cmd' 'Ctrl' 'Alt' 'Meta' 'Shift') |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2855 |
contains:[:k | (symbolicOrRawKey startsWith:k) ]) |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2856 |
ifFalse:[^ nil]. |
5848 | 2857 |
|
2858 |
"/ (aSymbolicKey startsWith:'Cmd') ifFalse:[ |
|
2859 |
"/ (aSymbolicKey startsWith:'Ctrl') ifFalse:[ |
|
2860 |
"/ (aSymbolicKey startsWith:'Alt') ifFalse:[ |
|
2861 |
"/ (aSymbolicKey startsWith:'Meta') ifFalse:[ |
|
2862 |
"/ (aSymbolicKey startsWith:'Shift') ifFalse:[ |
|
2863 |
"/ ^ nil |
|
2864 |
"/ ]. |
|
2865 |
"/ ]. |
|
2866 |
"/ ]. |
|
2867 |
"/ ]. |
|
2868 |
"/ ]. |
|
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2869 |
untranslatedKey := symbolicOrRawKey. |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2870 |
] ifFalse:[ |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2871 |
untranslatedKeys size == 1 ifTrue:[ |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2872 |
untranslatedKey := untranslatedKeys first. |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2873 |
] ifFalse:[ |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2874 |
"if there are multiple mappings, show the Ctrl or the F-key mapping" |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2875 |
untranslatedKey := untranslatedKeys |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2876 |
detect:[:k |k startsWith:'Ctrl'] |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2877 |
ifNone:[ |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2878 |
untranslatedKeys |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2879 |
detect:[:k |k startsWith:'F'] |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2880 |
ifNone:[untranslatedKeys first]]. |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2881 |
]. |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2882 |
]. |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2883 |
|
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2884 |
"/ |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2885 |
"/ some modifier-key combination ? |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2886 |
"/ |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2887 |
(untranslatedKey startsWith:#Cmd) ifTrue:[ |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2888 |
prefix := #Cmd. |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2889 |
] ifFalse:[(untranslatedKey startsWith:#Alt) ifTrue:[ |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2890 |
prefix := #Alt. |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2891 |
] ifFalse:[(untranslatedKey startsWith:#Meta) ifTrue:[ |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2892 |
prefix := #Meta. |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2893 |
] ifFalse:[(untranslatedKey startsWith:#Ctrl) ifTrue:[ |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2894 |
prefix := #Ctrl. |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2895 |
]]]]. |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2896 |
|
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2897 |
prefix notNil ifTrue:[ |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2898 |
|modifier rest| |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2899 |
|
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2900 |
modifier := self modifierKeyTopFor:prefix. |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2901 |
modifier := (modifier ? prefix). |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2902 |
rest := (untranslatedKey copyFrom:(prefix size + 1)). |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2903 |
rest isEmpty ifTrue:[^ modifier ]. |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2904 |
modifier := modifier , (self shortKeyPrefixSeparator). |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2905 |
^ modifier , rest |
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2906 |
]. |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2907 |
^ untranslatedKey |
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2908 |
|
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2909 |
" |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2910 |
Screen current shortKeyStringFor: #Find |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2911 |
Screen current shortKeyStringFor: #CtrlX |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2912 |
Screen current shortKeyStringFor: #CursorLeft |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2913 |
" |
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2914 |
|
4552
ff6d09e621c7
shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents:
4507
diff
changeset
|
2915 |
"Created: / 08-08-2006 / 15:45:38 / cg" |
6395
4cf299c9c247
Comment in DeviceWorkstation>>#shortKeyStringFor:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6383
diff
changeset
|
2916 |
"Modified (comment): / 28-04-2014 / 10:04:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2917 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2918 |
|
3263 | 2919 |
!DeviceWorkstation methodsFor:'accessing-misc'! |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2920 |
|
3012 | 2921 |
defaultEventMask |
2922 |
"return a mask to enable some events by default." |
|
2923 |
||
2924 |
self subclassResponsibility |
|
2925 |
! |
|
2926 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2927 |
displayName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2928 |
"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
|
2929 |
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
|
2930 |
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
|
2931 |
connection. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2932 |
- nothing known here, but maybe redefined in subclasses." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2933 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2934 |
^ nil |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2935 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2936 |
" |
4350 | 2937 |
Display displayName |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2938 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2939 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2940 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2941 |
glVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2942 |
"return a string describing the GL version. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2943 |
Since the generic display does not support 3D GL graphics, |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2944 |
a dummy is returned here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2945 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2946 |
^ 'noGL' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2947 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2948 |
" |
4350 | 2949 |
Display glVersion |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2950 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2951 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2952 |
|
5550 | 2953 |
numberOfMonitors |
2954 |
^ 1 "a fallback value only" |
|
2955 |
||
2956 |
" |
|
5610 | 2957 |
Display numberOfMonitors |
5550 | 2958 |
" |
2959 |
! |
|
2960 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2961 |
platformName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2962 |
"return a string describing the display systems platform. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2963 |
Returns a dummy here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2964 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2965 |
^ self class platformName |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2966 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2967 |
" |
4350 | 2968 |
Display platformName |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2969 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2970 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2971 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2972 |
protocolVersion |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2973 |
"return the display systems protocol version number. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2974 |
Returns a dummy here" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2975 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2976 |
^ 0 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2977 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2978 |
" |
4350 | 2979 |
Display protocolVersion |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2980 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2981 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2982 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2983 |
serverVendor |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2984 |
"return a string describing the display systems server vendor. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2985 |
Returns a dummy here" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2986 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2987 |
^ 'generic' |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2988 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2989 |
" |
4350 | 2990 |
Display serverVendor |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2991 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2992 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2993 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2994 |
vendorRelease |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2995 |
"return the display systems release number. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2996 |
Returns a dummy here." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2997 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2998 |
^ 0 |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
2999 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3000 |
" |
4350 | 3001 |
Display vendorRelease |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
3002 |
" |
293 | 3003 |
! ! |
3004 |
||
3005 |
!DeviceWorkstation methodsFor:'bitmap/window creation'! |
|
3006 |
||
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3007 |
convertedIcon:iconArg |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3008 |
"make certain, that the image argument is compatible with myself; |
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
3009 |
this means converting it to a format (typically: monochrome) which I support. |
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3010 |
Return a compatible version of the icon." |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3011 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3012 |
|deviceIcon d toMono toDeep icon| |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3013 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3014 |
icon := iconArg value. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3015 |
icon isNil ifTrue:[^ nil]. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3016 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3017 |
toMono := toDeep := false. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3018 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3019 |
d := icon depth. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3020 |
self supportsDeepIcons ifFalse:[ |
6296 | 3021 |
(d ~~ 1 or:[icon isImage]) ifTrue:[ |
3022 |
" |
|
3023 |
dither to monochrome |
|
3024 |
" |
|
3025 |
toMono := true. |
|
3026 |
] |
|
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3027 |
] ifTrue:[ |
6296 | 3028 |
d == 1 ifTrue:[ |
3029 |
icon colorMap notNil ifTrue:[ |
|
3030 |
icon isImage ifFalse:[ |
|
3031 |
toMono := true. |
|
3032 |
] ifTrue:[ |
|
3033 |
toDeep := true. |
|
3034 |
] |
|
3035 |
] |
|
3036 |
] ifFalse:[ |
|
3037 |
d ~~ self depth ifTrue:[ |
|
3038 |
icon isImage ifFalse:[ |
|
3039 |
toMono := true. |
|
3040 |
] ifTrue:[ |
|
3041 |
toDeep := true. |
|
3042 |
] |
|
3043 |
] |
|
3044 |
] |
|
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3045 |
]. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3046 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3047 |
deviceIcon := icon. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3048 |
toMono ifTrue:[ |
6296 | 3049 |
deviceIcon := icon asMonochromeFormOn:self. |
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3050 |
]. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3051 |
toDeep ifTrue:[ |
6296 | 3052 |
deviceIcon := (Image implementorForDepth:self depth) fromImage:icon. |
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3053 |
]. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3054 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3055 |
deviceIcon notNil ifTrue:[ |
6296 | 3056 |
" |
3057 |
get device pixmap (i.e. allocate colors & resource) |
|
3058 |
" |
|
3059 |
deviceIcon := deviceIcon onDevice:self |
|
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3060 |
]. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3061 |
^ deviceIcon |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3062 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3063 |
"Created: / 30-10-2007 / 16:37:10 / cg" |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3064 |
! |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3065 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3066 |
convertedIconMask:aMask |
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
3067 |
"return a version of the argument which can be used as an iconMask on myself. |
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
3068 |
Typically, this means conversion to a monochrome mask - |
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3069 |
future versions may add alpha channel masks, if I support them ..." |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3070 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3071 |
self supportsIconMasks ifFalse:[^ nil]. |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3072 |
|
5734 | 3073 |
aMask depth == 1 ifTrue:[ |
6296 | 3074 |
^ aMask onDevice:self. |
5734 | 3075 |
]. |
3076 |
^ aMask asMonochromeFormOn:self |
|
4808
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3077 |
|
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3078 |
"Created: / 30-10-2007 / 16:38:37 / cg" |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3079 |
! |
ba94c76b6684
icon conversion code moved to device
Claus Gittinger <cg@exept.de>
parents:
4806
diff
changeset
|
3080 |
|
293 | 3081 |
createBitmapFromArray:anArray width:w height:h |
2896 | 3082 |
"create a monochrome, depth1 bitmap from a given (byte-)array. |
3083 |
The rows are aligned to a multiple of 8" |
|
3084 |
||
293 | 3085 |
^ self subclassResponsibility |
3086 |
! |
|
3087 |
||
3088 |
createBitmapFromFile:aString for:aForm |
|
974 | 3089 |
^ nil |
293 | 3090 |
! |
3091 |
||
3092 |
createBitmapWidth:w height:h |
|
3093 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
3094 |
(i.e. random). Return a bitmap id or nil" |
|
3095 |
||
3096 |
^ self subclassResponsibility |
|
3097 |
! |
|
3098 |
||
3099 |
createPixmapWidth:w height:h depth:d |
|
3100 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
3101 |
(i.e. random). Return a bitmap id or nil" |
|
3102 |
||
3103 |
^ self subclassResponsibility |
|
3104 |
! |
|
3105 |
||
1696
ba6085a629e0
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1692
diff
changeset
|
3106 |
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
|
3107 |
"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
|
3108 |
|
293 | 3109 |
^ self subclassResponsibility |
3110 |
! |
|
3111 |
||
4350 | 3112 |
createWindowFor:aView type:typeSymbol origin:org extent:ext |
6296 | 3113 |
minExtent:minE maxExtent:maxE borderWidth:bw subViewOf:sv |
3114 |
style:styleSymbol inputOnly:inp |
|
3115 |
label:label owner:owner |
|
3116 |
icon:icn iconMask:icnM iconView:icnV |
|
1961 | 3117 |
"must be implemented by a concrete class" |
3118 |
||
3119 |
^ self subclassResponsibility |
|
3120 |
! |
|
3121 |
||
293 | 3122 |
destroyGC:aGCId |
3123 |
"destroy a GC" |
|
3124 |
||
3125 |
^ self subclassResponsibility |
|
3126 |
! |
|
3127 |
||
3128 |
destroyPixmap:aDrawableId |
|
3129 |
^ self subclassResponsibility |
|
3130 |
! |
|
3131 |
||
3132 |
destroyView:aView withId:aWindowId |
|
3133 |
^ self subclassResponsibility |
|
3134 |
! |
|
3135 |
||
3136 |
gcFor:aDrawableId |
|
3137 |
"create a GC for drawing into aDrawable" |
|
3138 |
||
3139 |
^ self subclassResponsibility |
|
3140 |
! |
|
3141 |
||
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
3142 |
gcForBitmap:aDrawableId |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
3143 |
"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
|
3144 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
3145 |
^ self subclassResponsibility |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
3146 |
! |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1131
diff
changeset
|
3147 |
|
2963 | 3148 |
realRootWindowFor:aView |
3149 |
"the name of this method is historic; |
|
3150 |
- it will vanish" |
|
3151 |
||
3152 |
|id| |
|
3153 |
||
3154 |
id := self realRootWindowId. |
|
3155 |
self addKnownView:aView withId:id. |
|
3156 |
^ id |
|
3157 |
! |
|
3158 |
||
974 | 3159 |
realRootWindowId |
3160 |
"return the id of the real root window. |
|
4350 | 3161 |
This may or may not be the view you see as background, |
974 | 3162 |
since some window managers install a virtual root window on top |
3163 |
of the real one. In this case, this method returns the id of the |
|
4350 | 3164 |
covered real-root |
974 | 3165 |
(in contrast, rootWindowId returns the id of the visible one). |
3166 |
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
|
3167 |
The real root is only seldom of any interest." |
974 | 3168 |
|
3169 |
^ self rootWindowId |
|
1074
da107006d4f6
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1059
diff
changeset
|
3170 |
|
da107006d4f6
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1059
diff
changeset
|
3171 |
"Modified: 14.10.1996 / 22:25:03 / stefan" |
974 | 3172 |
! |
3173 |
||
293 | 3174 |
rootWindowFor:aView |
974 | 3175 |
|id| |
3176 |
||
3177 |
id := self rootWindowId. |
|
3178 |
self addKnownView:aView withId:id. |
|
3179 |
^ id |
|
3180 |
! |
|
3181 |
||
3182 |
rootWindowId |
|
3183 |
"return the id of the root window. |
|
4350 | 3184 |
This is the window you see as background, |
974 | 3185 |
however, it may or may not be the real physical root window, |
3186 |
since some window managers install a virtual root window on top |
|
3187 |
of the real one. If this is the case, that views id is returned here." |
|
3188 |
||
293 | 3189 |
^ self subclassResponsibility |
3190 |
! ! |
|
3191 |
||
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3192 |
!DeviceWorkstation methodsFor:'clipboard'! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3193 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3194 |
clipboardEncoding |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3195 |
"return the assumed default clibBoards encoding |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3196 |
if a raw string (i.e. without encoding information) is pasted. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3197 |
Useful on X11, if a sjis or euc string is pasted from a netscape |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3198 |
or other program." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3199 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3200 |
^ clipBoardEncoding |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3201 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3202 |
" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3203 |
Screen current clipBoardEncoding |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3204 |
" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3205 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3206 |
"Created: 28.6.1997 / 13:46:02 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3207 |
"Modified: 28.6.1997 / 17:28:08 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3208 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3209 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3210 |
clipboardEncoding:aSymbol |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3211 |
"set the assumed default clipBoard's encoding |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3212 |
if a raw string (i.e. without encoding information) is pasted. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3213 |
Useful on X11, if a sjis or euc string is pasted from a netscape |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3214 |
or other program." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3215 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3216 |
clipBoardEncoding := aSymbol |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3217 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3218 |
" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3219 |
Screen current clipBoardEncoding:#sjis |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3220 |
Screen current clipBoardEncoding:#euc |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3221 |
Screen current clipBoardEncoding:nil |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3222 |
" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3223 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3224 |
"Created: 28.6.1997 / 13:46:12 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3225 |
"Modified: 28.6.1997 / 17:28:02 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3226 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3227 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3228 |
copyBufferAsString |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3229 |
"return my current selection as a string" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3230 |
|
6130 | 3231 |
^ self class bufferAsString:self getCopyBuffer. |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3232 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3233 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3234 |
getClipboardObjectFor:drawableId |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3235 |
"Retrieve the common per-display selection object. |
4350 | 3236 |
For clipBoard mechanisms to work (into ST/X), |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3237 |
this must be redefined in a concrete subclass" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3238 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3239 |
^ nil |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3240 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3241 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3242 |
getClipboardText:selectionBufferSymbol for:drawableId |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3243 |
"Retrieve the common per-display selection text. |
4350 | 3244 |
For clipBoard mechanisms to work (into ST/X), |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3245 |
this must be redefined in a concrete subclass" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3246 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3247 |
^ nil |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3248 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3249 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3250 |
getCopyBuffer |
4350 | 3251 |
"return the copyBuffers contents. |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3252 |
This is an ST/X internal buffer (i.e. its not visible to alien views)." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3253 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3254 |
^ copyBuffer |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3255 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3256 |
"Modified: 11.12.1996 / 12:55:42 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3257 |
"Created: 11.12.1996 / 13:34:34 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3258 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3259 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3260 |
getCopyBufferHistory |
4350 | 3261 |
"return the copyBufferHistory. |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3262 |
This is an ST/X internal buffer (i.e. its not visible to alien views)." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3263 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3264 |
^ CopyBufferHistory ? #() |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3265 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3266 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3267 |
rememberCopyBuffer |
5994 | 3268 |
"remember the current copyBuffer value in the copyBuffer-history (for paste previous); |
3269 |
but only do so, if it is a string" |
|
3270 |
||
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3271 |
copyBuffer size == 0 ifTrue:[ |
6296 | 3272 |
^ self |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3273 |
]. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3274 |
copyBuffer isString ifFalse:[ |
6296 | 3275 |
copyBuffer isStringCollection ifFalse:[ |
3276 |
^ self |
|
3277 |
] |
|
5601 | 3278 |
]. |
3279 |
self rememberInCopyBufferHistory:copyBuffer. |
|
3280 |
||
3281 |
"Modified: / 25-08-2010 / 21:58:26 / cg" |
|
3282 |
! |
|
3283 |
||
3284 |
rememberInCopyBufferHistory:aString |
|
3285 |
"add aString to the copyBuffer LRU-cache. |
|
3286 |
Allows for the last 20 (or so) copy/cut strings to be recovered |
|
3287 |
(via Shift-Paste)" |
|
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3288 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3289 |
CopyBufferHistory isNil ifTrue:[ |
6296 | 3290 |
CopyBufferHistory := OrderedCollection new. |
5601 | 3291 |
]. |
3292 |
CopyBufferHistory remove:aString ifAbsent:nil. |
|
3293 |
CopyBufferHistory addFirst:aString. |
|
3294 |
||
3295 |
CopyBufferHistory size > (CopyBufferHistorySize ? 20) ifTrue:[ |
|
6296 | 3296 |
CopyBufferHistory removeLast |
5601 | 3297 |
]. |
3298 |
||
3299 |
"Created: / 25-08-2010 / 21:57:08 / cg" |
|
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3300 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3301 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3302 |
setClipboardObject:anObject owner:aWindowId |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3303 |
"set the common per-display object selection. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3304 |
This can be used by other Smalltalk(X) applications only. |
4350 | 3305 |
For clipBoard mechanisms to work (out of ST/X), |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3306 |
this must be redefined in a concrete subclass to copy |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3307 |
anObject to the devices clipBoard." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3308 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3309 |
^ nil |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3310 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3311 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3312 |
setClipboardObject:something ownerView:aView |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3313 |
"set the object selection - both the local one, and tell the display |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3314 |
that we have changed it (i.e. place it into the clipBoard)." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3315 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3316 |
|viewID| |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3317 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3318 |
self rememberCopyBuffer. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3319 |
self setCopyBuffer:something. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3320 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3321 |
viewID := aView id. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3322 |
viewID notNil ifTrue:[ "/ if the view is not already closed |
6296 | 3323 |
self setClipboardObject:something owner:viewID. |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3324 |
] |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3325 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3326 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3327 |
setClipboardText:aString owner:aView |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3328 |
"Set the common per-display selection text. |
4350 | 3329 |
For clipBoard mechanisms to work (out of ST/X), |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3330 |
this must be redefined in a concrete subclass to copy |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3331 |
aString to the devices clipBoard." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3332 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3333 |
^ nil |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3334 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3335 |
"Modified: 11.12.1996 / 12:56:36 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3336 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3337 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3338 |
setClipboardText:aString ownerView:aView |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3339 |
"set the text selection - both the local one, and tell the display |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3340 |
that we have changed it (i.e. place it into the clipBoard)." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3341 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3342 |
|s viewID| |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3343 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3344 |
self rememberCopyBuffer. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3345 |
self setCopyBuffer:aString. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3346 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3347 |
s := aString ? ''. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3348 |
s isString ifFalse:[ |
6296 | 3349 |
s := s asStringWithCRsFrom:1 to:(s size) compressTabs:false withCR:false |
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3350 |
]. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3351 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3352 |
viewID := aView id. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3353 |
viewID notNil ifTrue:[ "/ if the view is not already closed |
6296 | 3354 |
"/ for now - should add support to pass emphasis information too |
3355 |
s := s string. |
|
3356 |
self setClipboardText:s owner:viewID. |
|
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3357 |
] |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3358 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3359 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3360 |
setCopyBuffer:something |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3361 |
"set the copyBuffers contents. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3362 |
This is an ST/X internal buffer (i.e. its not visible to alien views)." |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3363 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3364 |
copyBuffer := something. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3365 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3366 |
"Created: 11.12.1996 / 12:54:23 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3367 |
"Modified: 11.12.1996 / 12:55:53 / cg" |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3368 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3369 |
|
5897
11d09aa349cb
added: #setPrimaryText:ownerView: (so support X11's PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5868
diff
changeset
|
3370 |
setPrimaryText: text ownerView: view |
11d09aa349cb
added: #setPrimaryText:ownerView: (so support X11's PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5868
diff
changeset
|
3371 |
"Overridden in XWorkstation to support X's PRIMARY selection, intentionally void here" |
11d09aa349cb
added: #setPrimaryText:ownerView: (so support X11's PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5868
diff
changeset
|
3372 |
|
11d09aa349cb
added: #setPrimaryText:ownerView: (so support X11's PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5868
diff
changeset
|
3373 |
"Created: / 27-03-2012 / 15:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11d09aa349cb
added: #setPrimaryText:ownerView: (so support X11's PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5868
diff
changeset
|
3374 |
! |
11d09aa349cb
added: #setPrimaryText:ownerView: (so support X11's PRIMARY selection)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5868
diff
changeset
|
3375 |
|
4282
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3376 |
setSelection:anObject owner:aWindowId |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3377 |
<resource: #obsolete> |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3378 |
self obsoleteMethodWarning:'use #setClipboardObject:owner:'. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3379 |
self setClipboardObject:anObject owner:aWindowId |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3380 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3381 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3382 |
setSelection:something ownerView:aView |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3383 |
<resource: #obsolete> |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3384 |
self obsoleteMethodWarning:'use #setClipboardObject:ownerView:'. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3385 |
self setClipboardObject:something ownerView:aView |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3386 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3387 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3388 |
setTextSelection:aString owner:aWindowId |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3389 |
<resource: #obsolete> |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3390 |
self obsoleteMethodWarning:'use #setClipboardText:owner'. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3391 |
self setClipboardText:aString owner:aWindowId |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3392 |
! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3393 |
|
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3394 |
setTextSelection:aString ownerView:aView |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3395 |
<resource: #obsolete> |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3396 |
self obsoleteMethodWarning:'use #setClipboardText:ownerView'. |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3397 |
self setClipboardText:aString ownerView:aView |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3398 |
! ! |
b487fe05c51d
Unify naming: clipBoard->clipboard
Stefan Vogel <sv@exept.de>
parents:
4280
diff
changeset
|
3399 |
|
293 | 3400 |
!DeviceWorkstation methodsFor:'color stuff'! |
3401 |
||
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3402 |
availableDitherColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3403 |
"return the table of preallocated emergency ditherColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3404 |
plus possibly available fixColors." |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3405 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3406 |
|s| |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3407 |
|
1768 | 3408 |
s := IdentitySet new. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3409 |
fixColors notNil ifTrue:[ |
6296 | 3410 |
s addAll:fixColors. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3411 |
]. |
1768 | 3412 |
fixGrayColors notNil ifTrue:[ |
6296 | 3413 |
s addAll:fixGrayColors. |
1768 | 3414 |
]. |
1776 | 3415 |
ditherColors notNil ifTrue:[ |
6296 | 3416 |
s addAll:ditherColors. |
1776 | 3417 |
]. |
1768 | 3418 |
^ s asArray |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3419 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3420 |
"Created: 11.7.1996 / 18:13:30 / cg" |
1776 | 3421 |
"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
|
3422 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3423 |
|
293 | 3424 |
blueComponentOfColor:colorId |
3425 |
"get blue component (0..100) of color in map at:index" |
|
3426 |
||
3220 | 3427 |
^ (self getRGBFrom:colorId) at:3 |
3428 |
||
293 | 3429 |
! |
3430 |
||
3431 |
colorCell |
|
974 | 3432 |
"allocate a color - return index or nil, if no color cell |
3433 |
can be allocated (out of colors or trueColor device)" |
|
3434 |
||
3435 |
^ nil |
|
293 | 3436 |
! |
3437 |
||
934 | 3438 |
colorMap |
3439 |
"return my displays colormap, or nil, if the display is not colorMap based |
|
3440 |
(i.e. not PseudoColor)" |
|
3441 |
||
3442 |
|mapSize "{ Class: SmallInteger }" |
|
3443 |
depthUsed mapArray| |
|
3444 |
||
3445 |
visualType == #DirectColor ifTrue:[ |
|
6296 | 3446 |
'DeviceWorkstation [info]: directColor displays not fully supported.' infoPrintCR. |
3447 |
^ nil |
|
934 | 3448 |
]. |
4350 | 3449 |
|
934 | 3450 |
(visualType == #StaticGray or:[visualType == #TrueColor]) ifTrue:[ |
6296 | 3451 |
" |
3452 |
those have no colorMap - we're done |
|
3453 |
" |
|
3454 |
^ nil |
|
934 | 3455 |
]. |
3456 |
||
3457 |
" |
|
3458 |
get some attributes of the display device |
|
3459 |
" |
|
3460 |
depthUsed := depth. |
|
3461 |
||
3462 |
"/ kludge for 15bit XFree server |
|
3463 |
"/ (but: I have never encountered a PseudoColor display with more |
|
3464 |
"/ than 8 bits ...) |
|
3465 |
||
3466 |
depthUsed == 15 ifTrue:[ |
|
6296 | 3467 |
depthUsed := 16 |
934 | 3468 |
]. |
3469 |
depthUsed > 16 ifTrue:[ |
|
6296 | 3470 |
"/ do not allocate zillions of colors ... |
3471 |
self error:'unreasonably large colorMap ...'. |
|
3472 |
^ nil |
|
934 | 3473 |
]. |
3474 |
||
3475 |
mapSize := (1 bitShift:depthUsed). |
|
3476 |
||
3477 |
"/ get the palette |
|
3478 |
mapArray := Array new:mapSize. |
|
3479 |
1 to:mapSize do:[:i | |
|
6296 | 3480 |
self getRGBFrom:(i-1) into:[:r :g :b | |
3481 |
mapArray at:i put:(Color red:r green:g blue:b) |
|
3482 |
] |
|
934 | 3483 |
]. |
3484 |
^ mapArray. |
|
3485 |
||
3486 |
" |
|
3487 |
Display colorMap |
|
3488 |
" |
|
3489 |
||
3490 |
"Created: 11.7.1996 / 10:53:38 / cg" |
|
1168 | 3491 |
"Modified: 10.1.1997 / 15:40:10 / cg" |
934 | 3492 |
! |
3493 |
||
3220 | 3494 |
colorNamed:aString |
3495 |
"allocate a color with color name - return the color index (i.e. colorID). |
|
5339
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3496 |
Only a subset of the colorNames are available on all displays; |
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3497 |
therefore, dont use this method; at least only for the common names such as red, green, blue etc." |
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3498 |
|
5610 | 3499 |
^ self |
6296 | 3500 |
getScaledRGBFromName:aString |
3501 |
into:[:r :g :b | |
|
3502 |
self colorScaledRed:r scaledGreen:g scaledBlue:b |
|
3503 |
] |
|
5339
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3504 |
|
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3505 |
" |
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3506 |
Screen current colorNamed:'red' |
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3507 |
" |
3220 | 3508 |
! |
3509 |
||
293 | 3510 |
colorRed:redVal green:greenVal blue:blueVal |
3220 | 3511 |
"allocate a color with rgb values (0..100) - return the color index (i.e. colorID). |
3512 |
This method is obsoleted by #colorScaledRed:scaledGreen:scaledBlue:" |
|
3513 |
||
3514 |
|r g b| |
|
3515 |
||
3516 |
r := self percentToDeviceColorValue:redVal. |
|
3517 |
g := self percentToDeviceColorValue:greenVal. |
|
3518 |
b := self percentToDeviceColorValue:blueVal. |
|
3519 |
^ self colorScaledRed:r scaledGreen:g scaledBlue:b |
|
293 | 3520 |
! |
3521 |
||
2854 | 3522 |
colorScaledRed:red scaledGreen:green scaledBlue:blue |
3523 |
visualType == #TrueColor ifTrue:[ |
|
6555 | 3524 |
^ (((red asInteger bitShift:-8) bitShift:redShift) |
3525 |
bitOr:((green asInteger bitShift:-8) bitShift:greenShift)) |
|
3526 |
bitOr:((blue asInteger bitShift:-8) bitShift:blueShift) |
|
2854 | 3527 |
]. |
6213 | 3528 |
self subclassResponsibility:'only supported for trueColor displays' |
3529 |
||
3530 |
"Modified: / 03-02-2014 / 11:30:23 / cg" |
|
2854 | 3531 |
! |
3532 |
||
3220 | 3533 |
deviceColorValueToPercent:deviceColorValue |
3534 |
^ self subclassResponsibility |
|
3535 |
! |
|
3536 |
||
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3537 |
ditherColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3538 |
"return the table of preallocated emergency ditherColors" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3539 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3540 |
^ ditherColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3541 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3542 |
"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
|
3543 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3544 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3545 |
fixColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3546 |
"return the table of preallocated fix colors (a colorCube), |
1768 | 3547 |
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
|
3548 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3549 |
^ fixColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3550 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3551 |
"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
|
3552 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3553 |
|
1768 | 3554 |
fixGrayColors |
3555 |
"return the table of preallocated fix grayScale colors, |
|
3556 |
or nil if no fix gray colors were preallocated." |
|
3557 |
||
3558 |
^ fixGrayColors |
|
3559 |
||
3560 |
"Created: 11.7.1996 / 17:49:24 / cg" |
|
3561 |
! |
|
3562 |
||
293 | 3563 |
freeColor:colorIndex |
3564 |
"free a color on the display, when its no longer needed" |
|
3565 |
||
3566 |
^ self subclassResponsibility |
|
3567 |
! |
|
3568 |
||
3220 | 3569 |
getRGBFrom:index |
3570 |
"get rgb components (0..100) of color in map at:index, |
|
3571 |
and evaluate the 3-arg block, aBlock with them" |
|
3572 |
||
3573 |
|triple| |
|
3574 |
||
3575 |
triple := self getScaledRGBFrom:index. |
|
3576 |
triple notNil ifTrue:[ |
|
6296 | 3577 |
^ triple collect:[:val | self deviceColorValueToPercent:val] |
3220 | 3578 |
]. |
3579 |
^ nil |
|
3580 |
! |
|
3581 |
||
293 | 3582 |
getRGBFrom:index into:aBlock |
3583 |
"get rgb components (0..100) of color in map at:index, |
|
3584 |
and evaluate the 3-arg block, aBlock with them" |
|
3585 |
||
3220 | 3586 |
|triple| |
3587 |
||
3588 |
triple := self getRGBFrom:index. |
|
3589 |
triple notNil ifTrue:[ |
|
6296 | 3590 |
^ aBlock valueWithArguments:triple. |
3220 | 3591 |
]. |
3592 |
^ nil |
|
3593 |
||
3594 |
! |
|
3595 |
||
3596 |
getRGBFromName:colorName |
|
293 | 3597 |
"get rgb components (0..100) of color named colorName, |
3220 | 3598 |
and return a 3-element array, containing them. |
293 | 3599 |
The method here only handles some often used colors; |
3600 |
getRGBFromName should not be used, since colorNames other |
|
3601 |
than those below are X specific." |
|
3602 |
||
1674
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
3603 |
|idx names triple r g b| |
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
3604 |
|
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
3605 |
(colorName startsWith:$#) ifTrue:[ |
6296 | 3606 |
"/ color in r/g/b hex notation |
3607 |
r := Integer readFrom:(colorName copyFrom:2 to:3) radix:16. |
|
3608 |
g := Integer readFrom:(colorName copyFrom:4 to:5) radix:16. |
|
3609 |
b := Integer readFrom:(colorName copyFrom:6 to:7) radix:16. |
|
3610 |
r := (r * 100 / 255). |
|
3611 |
g := (g * 100 / 255). |
|
3612 |
b := (b * 100 / 255). |
|
3613 |
^ Array with:r with:g with:b |
|
1674
787399517305
handle hex-r/g/b color names
Claus Gittinger <cg@exept.de>
parents:
1623
diff
changeset
|
3614 |
]. |
293 | 3615 |
|
1059
c040194dcab8
added internet explorers color-names
Claus Gittinger <cg@exept.de>
parents:
1045
diff
changeset
|
3616 |
names := #( |
6296 | 3617 |
'red' |
3618 |
'green' |
|
3619 |
'blue' |
|
3620 |
'yellow' |
|
3621 |
'magenta' |
|
3622 |
'cyan' |
|
3623 |
'white' |
|
3624 |
'black' |
|
3625 |
||
3626 |
'olive' |
|
3627 |
'teal' |
|
3628 |
'silver' |
|
3629 |
'lime' |
|
3630 |
'fuchsia' |
|
3631 |
'aqua' |
|
3632 |
). |
|
293 | 3633 |
idx := names indexOf:colorName. |
3634 |
idx == 0 ifTrue:[ |
|
6296 | 3635 |
idx := names indexOf:colorName asLowercase. |
293 | 3636 |
]. |
3220 | 3637 |
idx ~~ 0 ifTrue:[ |
6296 | 3638 |
triple := #( |
3639 |
(100 0 0) "red" |
|
3640 |
( 0 100 0) "green" |
|
3641 |
( 0 0 100) "blue" |
|
3642 |
(100 100 0) "yellow" |
|
3643 |
(100 0 100) "magenta" |
|
3644 |
( 0 100 100) "cyan" |
|
3645 |
(100 100 100) "white" |
|
3646 |
( 0 0 0) "black" |
|
3647 |
||
3648 |
( 50 50 0) "olive" |
|
3649 |
( 0 50 50) "teal" |
|
3650 |
( 40 40 40) "silver" |
|
3651 |
( 20 100 0) "lime" |
|
3652 |
( 60 3 100) "fuchsia" |
|
3653 |
( 10 100 100) "aqua" |
|
3654 |
) at:idx. |
|
3655 |
||
3656 |
^ triple |
|
3220 | 3657 |
]. |
3658 |
^ nil |
|
3659 |
||
3660 |
! |
|
3661 |
||
3662 |
getRGBFromName:colorName into:aBlock |
|
3663 |
"get rgb components (0..100) of color named colorName, |
|
3664 |
and evaluate the 3-arg block, aBlock with them" |
|
3665 |
||
3666 |
|triple| |
|
3667 |
||
3668 |
triple := self getScaledRGBFromName:colorName. |
|
3669 |
triple notNil ifTrue:[ |
|
6296 | 3670 |
^ aBlock value:(self deviceColorValueToPercent:(triple at:1)) |
3671 |
value:(self deviceColorValueToPercent:(triple at:2)) |
|
3672 |
value:(self deviceColorValueToPercent:(triple at:3)) |
|
293 | 3673 |
]. |
3674 |
^ nil |
|
1059
c040194dcab8
added internet explorers color-names
Claus Gittinger <cg@exept.de>
parents:
1045
diff
changeset
|
3675 |
|
3220 | 3676 |
" |
3677 |
Display getRGBFromName:'red' into:[:r :g :b | r printCR. g printCR. b printCR.] |
|
3678 |
" |
|
3679 |
! |
|
3680 |
||
3681 |
getScaledRGBFrom:index |
|
3682 |
"get rgb components (0..devicesMaxColorVal) of color in map at:index, |
|
3683 |
and return a 3-element array containing them" |
|
3684 |
||
3685 |
^ self subclassResponsibility |
|
3686 |
! |
|
3687 |
||
3688 |
getScaledRGBFrom:index into:aBlock |
|
3689 |
"get rgb components (0..devicesMaxColorVal) of color in map at:index, |
|
3690 |
and evaluate the 3-arg block, aBlock with them" |
|
3691 |
||
3692 |
|triple| |
|
3693 |
||
3694 |
triple := self getScaledRGBFrom:index. |
|
3695 |
triple notNil ifTrue:[ |
|
6296 | 3696 |
^ aBlock valueWithArguments:triple. |
3220 | 3697 |
]. |
3698 |
^ nil |
|
3699 |
||
3700 |
! |
|
3701 |
||
3702 |
getScaledRGBFromName:colorName |
|
3703 |
"get rgb components (0..devicesMaxColorVal) of color named colorName, |
|
3704 |
and return a 3-element array containing them" |
|
3705 |
||
3706 |
|triple| |
|
3707 |
||
3708 |
triple := self getRGBFromName:colorName. |
|
3709 |
triple notNil ifTrue:[ |
|
6296 | 3710 |
^ triple collect:[:val | self percentToDeviceColorValue:val]. |
3220 | 3711 |
]. |
3712 |
^ nil. |
|
3713 |
||
293 | 3714 |
! |
3715 |
||
996 | 3716 |
getScaledRGBFromName:colorName into:aBlock |
3220 | 3717 |
"get rgb components (0..devicesMaxColorVal) of color named colorName, |
5339
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3718 |
and evaluate the 3-arg block, aBlock with them. |
2bcee9cc577a
colorName:ifIllegal: - did return black for illegal color,
Claus Gittinger <cg@exept.de>
parents:
5336
diff
changeset
|
3719 |
Return nil for unknown color names." |
996 | 3720 |
|
3220 | 3721 |
|triple| |
3722 |
||
3723 |
triple := self getScaledRGBFromName:colorName. |
|
3724 |
triple notNil ifTrue:[ |
|
6296 | 3725 |
^ aBlock valueWithArguments:triple. |
3220 | 3726 |
]. |
3727 |
^ nil |
|
996 | 3728 |
! |
3729 |
||
293 | 3730 |
greenComponentOfColor:colorId |
3731 |
"get green component (0..100) of color in map at:index" |
|
3732 |
||
3220 | 3733 |
^ (self getRGBFrom:colorId) at:2 |
293 | 3734 |
! |
3735 |
||
3736 |
listOfAvailableColors |
|
3737 |
"return a list of all available colornames; |
|
3738 |
This method should not be used, since colornames are |
|
3739 |
very X specific. However, the names defined here are pretty common" |
|
3740 |
||
3741 |
^ #('red' 'green' 'blue' 'yellow' 'magenta' 'cyan' 'white' 'black') |
|
3742 |
! |
|
3743 |
||
4779
5fea61ea9782
Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents:
4641
diff
changeset
|
3744 |
numFixBlue |
5fea61ea9782
Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents:
4641
diff
changeset
|
3745 |
"return the number of blue shades in the |
5fea61ea9782
Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents:
4641
diff
changeset
|
3746 |
preallocated fix color cube (or 0 if there is none)" |
5fea61ea9782
Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents:
4641
diff
changeset
|
3747 |
|
5fea61ea9782
Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents:
4641
diff
changeset
|
3748 |
^ numFixBlue |
5fea61ea9782
Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents:
4641
diff
changeset
|
3749 |
! |
5fea61ea9782
Change senders of obsolete messages Form>>...on: to ...onDevice:
Stefan Vogel <sv@exept.de>
parents:
4641
diff
changeset
|
3750 |
|
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3751 |
numFixGreen |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3752 |
"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
|
3753 |
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
|
3754 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3755 |
^ numFixGreen |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3756 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3757 |
"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
|
3758 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3759 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3760 |
numFixRed |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3761 |
"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
|
3762 |
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
|
3763 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3764 |
^ numFixRed |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3765 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3766 |
"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
|
3767 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3768 |
|
974 | 3769 |
percentToDeviceColorValue:percent |
3770 |
^ self subclassResponsibility |
|
3771 |
! |
|
3772 |
||
293 | 3773 |
redComponentOfColor:colorId |
3774 |
"get red component (0..100) of color in map at:index" |
|
3775 |
||
3220 | 3776 |
^ (self getRGBFrom:colorId) at:1 |
3777 |
||
3778 |
" |
|
3779 |
Display redComponentOfColor:1 |
|
3780 |
" |
|
293 | 3781 |
! |
3782 |
||
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3783 |
releaseFixColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3784 |
"release the fix colorMap" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3785 |
|
1769 | 3786 |
fixColors := nil. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3787 |
numFixRed := numFixGreen := numFixBlue := 0. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3788 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3789 |
" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3790 |
Display releaseFixColors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3791 |
" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3792 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3793 |
"Created: 11.7.1996 / 18:00:42 / cg" |
1769 | 3794 |
"Modified: 23.6.1997 / 15:32:04 / cg" |
3795 |
! |
|
3796 |
||
3797 |
releaseFixGrayColors |
|
3798 |
"release the fix colorMap" |
|
3799 |
||
3800 |
fixGrayColors := nil. |
|
3801 |
||
3802 |
" |
|
3803 |
Display releaseFixGrayColors |
|
3804 |
" |
|
3805 |
||
3806 |
"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
|
3807 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3808 |
|
293 | 3809 |
setColor:index red:redVal green:greenVal blue:blueVal |
974 | 3810 |
"change color in map at:index to rgb (0..100). |
3811 |
This is a no-op on TrueColor systems." |
|
3812 |
||
3813 |
^ self |
|
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3814 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3815 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3816 |
setDitherColors:colors |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3817 |
"set the table of preallocated emergency dither fix colors |
4350 | 3818 |
These preallocated colors |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3819 |
(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
|
3820 |
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
|
3821 |
pen colors must be approximated. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3822 |
((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
|
3823 |
definitely look poor))" |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3824 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3825 |
ditherColors := colors. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3826 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3827 |
"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
|
3828 |
! |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3829 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3830 |
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
|
3831 |
"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
|
3832 |
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
|
3833 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3834 |
fixColors := colors. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3835 |
numFixRed := nR. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3836 |
numFixGreen := nG. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3837 |
numFixBlue := nB. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3838 |
|
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
3839 |
"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
|
3840 |
"Modified: 11.7.1996 / 17:57:10 / cg" |
1768 | 3841 |
! |
3842 |
||
3843 |
setFixGrayColors:colors |
|
3844 |
"set the table of preallocated fix gray colors" |
|
3845 |
||
3846 |
fixGrayColors := colors. |
|
293 | 3847 |
! ! |
3848 |
||
3028 | 3849 |
!DeviceWorkstation methodsFor:'copying'! |
3850 |
||
4933 | 3851 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
3028 | 3852 |
^ nil |
3853 |
! ! |
|
3854 |
||
293 | 3855 |
!DeviceWorkstation methodsFor:'cursor stuff'! |
3856 |
||
1562
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3857 |
builtInCursorShapes |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3858 |
"return a collection of standard cursor names. |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3859 |
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
|
3860 |
(see Cursor>>initializeNewCursors)" |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3861 |
|
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3862 |
"/ 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
|
3863 |
|
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3864 |
^ #() |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3865 |
|
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3866 |
"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
|
3867 |
! |
9a061e6942b9
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1547
diff
changeset
|
3868 |
|
293 | 3869 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
4350 | 3870 |
"change a cursors colors. |
974 | 3871 |
Ignored on systems which do not support colored cursors." |
3872 |
||
3873 |
^ self |
|
293 | 3874 |
! |
3875 |
||
2875 | 3876 |
createCursorShape:aShapeSymbol |
3877 |
"create a cursor given a shape-symbol; return a cursorID or nil. |
|
3878 |
This only works for a few standard cursors, and returns nil |
|
3879 |
if no such cursor exists. |
|
974 | 3880 |
Always care for a fallBack, in case of a nil return." |
3881 |
||
3882 |
^ nil |
|
3883 |
! |
|
3884 |
||
3885 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
|
3886 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot. |
|
3887 |
Returns nil, if no cursor can be created (for any reason)" |
|
3888 |
||
293 | 3889 |
^ self subclassResponsibility |
3890 |
! |
|
3891 |
||
3892 |
destroyCursor:aCursorId |
|
3893 |
"free a cursor" |
|
3894 |
||
3895 |
^ self subclassResponsibility |
|
974 | 3896 |
! |
3897 |
||
3898 |
needDeviceFormsForCursor |
|
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2838
diff
changeset
|
3899 |
"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
|
3900 |
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
|
3901 |
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
|
3902 |
|
974 | 3903 |
^ self subclassResponsibility |
3904 |
! |
|
3905 |
||
3906 |
shapeNumberFromSymbol:shape |
|
3907 |
"given a shape-symbol, return the corresponding cursor-number, |
|
3908 |
or nil if no such standard cursor exists." |
|
3909 |
||
3910 |
^ nil |
|
293 | 3911 |
! ! |
3912 |
||
1542 | 3913 |
!DeviceWorkstation methodsFor:'drag & drop'! |
3914 |
||
4461 | 3915 |
dragFinish:dropHandle |
3916 |
! |
|
3917 |
||
1582
ec428aba3f9c
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1580
diff
changeset
|
3918 |
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
1542 | 3919 |
"device specific drop here" |
3920 |
||
3921 |
"/ self subclassResponsibility |
|
3922 |
||
3923 |
"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
|
3924 |
"Modified: 11.4.1997 / 12:43:23 / cg" |
1542 | 3925 |
! ! |
3926 |
||
293 | 3927 |
!DeviceWorkstation methodsFor:'drawing'! |
3928 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1024
diff
changeset
|
3929 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
293 | 3930 |
"do a bit-blt" |
3931 |
||
3932 |
^ self subclassResponsibility |
|
3933 |
! |
|
3934 |
||
1247
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3935 |
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
|
3936 |
"do a bit-blt from a pix- or bitmap. |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3937 |
Here, fall back into copyFromId:, which should also work. |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3938 |
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
|
3939 |
|
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3940 |
^ 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
|
3941 |
! |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3942 |
|
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1024
diff
changeset
|
3943 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
293 | 3944 |
"do a bit-blt, using the low-bit plane of the source only" |
3945 |
||
3946 |
^ self subclassResponsibility |
|
3947 |
! |
|
3948 |
||
1247
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3949 |
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
|
3950 |
"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
|
3951 |
Here, fall back into copyPlaneFromId:, which should also work. |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3952 |
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
|
3953 |
|
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3954 |
^ 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
|
3955 |
! |
c04af1fc542c
added fallbacks for copy*FromPixmapId:*
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
3956 |
|
653
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
3957 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle |
6296 | 3958 |
in:aDrawableId with:aGCId |
293 | 3959 |
"draw an arc" |
3960 |
||
3961 |
^ self subclassResponsibility |
|
653
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
3962 |
|
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
3963 |
"Created: 8.5.1996 / 08:44:43 / cg" |
293 | 3964 |
! |
3965 |
||
3966 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
|
3967 |
"draw a line" |
|
3968 |
||
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
3969 |
" |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
3970 |
could add a bresenham line drawer here ... |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
3971 |
" |
293 | 3972 |
^ self subclassResponsibility |
3973 |
! |
|
3974 |
||
2909 | 3975 |
displayLinesFromX:xStart step:xStep yValues:ydata scaleY:yScale transY:yTrans in:drawableId with:gcId |
3976 |
"draw a polygon starting at x; the y values derives from the collection yValues. |
|
3977 |
The associated x is a multiple of step. Each y value will be scaled and translated. |
|
3978 |
The implementation here is a fallback, using the line-draw primitive; |
|
3979 |
devices which support fast drawing of a polygon may redefine this for more performance." |
|
3980 |
||
3981 |
|x xLast yLast| |
|
3982 |
||
3983 |
ydata size == 0 ifTrue:[^ self]. |
|
3984 |
||
3985 |
xLast := xStart. |
|
3986 |
yLast := (ydata at:1) * yScale + yTrans. |
|
3987 |
ydata from:2 do:[:y | |yT| |
|
6296 | 3988 |
x := xLast + xStep. |
3989 |
yT := y * yScale + yTrans. |
|
3990 |
self displayLineFromX:xLast rounded y:yLast rounded toX:x rounded y:yT rounded in:drawableId with:gcId. |
|
3991 |
xLast := x. |
|
3992 |
yLast := y. |
|
2909 | 3993 |
] |
3994 |
! |
|
3995 |
||
293 | 3996 |
displayOpaqueString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
3997 |
"draw a sub-string - draw foreground on background. |
|
4350 | 3998 |
If the coordinates are not integers, retry with rounded." |
3999 |
||
4000 |
self displayString:aString |
|
6296 | 4001 |
from:index1 |
4002 |
to:index2 |
|
4003 |
x:x |
|
4004 |
y:y |
|
4005 |
in:aDrawableId |
|
4006 |
with:aGCId |
|
4007 |
opaque:true |
|
293 | 4008 |
! |
4009 |
||
4010 |
displayOpaqueString:aString x:x y:y in:aDrawableId with:aGCId |
|
4011 |
"draw a string - draw foreground on background. |
|
4350 | 4012 |
If the coordinates are not integers, retry with rounded." |
4013 |
||
4014 |
self displayString:aString |
|
6296 | 4015 |
x:x |
4016 |
y:y |
|
4017 |
in:aDrawableId |
|
4018 |
with:aGCId |
|
4019 |
opaque:true |
|
293 | 4020 |
! |
4021 |
||
4022 |
displayPointX:x y:y in:aDrawableId with:aGCId |
|
4023 |
"draw a point" |
|
4024 |
||
2622 | 4025 |
"/ could use |
4026 |
"/ self displayLineFromX:x y:y toX:x y:y in:aDrawableId with:aGCId. |
|
4027 |
"/ but then, we had to care for lineWidth & style ... |
|
4028 |
||
4029 |
^ self subclassResponsibility |
|
4030 |
||
4031 |
"Modified: / 3.5.1999 / 14:26:32 / cg" |
|
293 | 4032 |
! |
4033 |
||
4034 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
4035 |
"draw a polygon" |
|
4036 |
||
4037 |
" |
|
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4038 |
could draw the lines here |
293 | 4039 |
but then, we have to reimplement all line and join styles here |
4040 |
" |
|
4041 |
^ self subclassResponsibility |
|
4042 |
! |
|
4043 |
||
2442 | 4044 |
displayPolylines:arrayOfPoints in:aDrawableId with:aGCId |
4045 |
"draw a bunch of lines" |
|
4046 |
||
2523 | 4047 |
|startPoint p| |
2442 | 4048 |
|
4049 |
1 to:arrayOfPoints size by:2 do:[:idx | |
|
6296 | 4050 |
p := arrayOfPoints at:idx. |
4051 |
idx odd ifTrue:[ |
|
4052 |
startPoint := p |
|
4053 |
] ifFalse:[ |
|
4054 |
self |
|
4055 |
displayLineFromX:startPoint x |
|
4056 |
y:startPoint y |
|
4057 |
toX:p x |
|
4058 |
y:p y |
|
4059 |
in:aDrawableId |
|
4060 |
with:aGCId |
|
4061 |
] |
|
2442 | 4062 |
] |
4063 |
! |
|
4064 |
||
293 | 4065 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
4066 |
"draw a rectangle" |
|
4067 |
||
4068 |
" |
|
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4069 |
could draw four lines here |
293 | 4070 |
but then, we have to reimplement all line and join styles here |
4071 |
" |
|
4072 |
^ self subclassResponsibility |
|
4073 |
! |
|
4074 |
||
4075 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId |
|
4076 |
"draw a sub-string - draw foreground only. |
|
4350 | 4077 |
If the coordinates are not integers, retry with rounded." |
4078 |
||
4079 |
self |
|
6296 | 4080 |
displayString:aString |
4081 |
from:index1 |
|
4082 |
to:index2 |
|
4083 |
x:x |
|
4084 |
y:y |
|
4085 |
in:aDrawableId |
|
4086 |
with:aGCId |
|
4087 |
opaque:false |
|
293 | 4088 |
! |
4089 |
||
4090 |
displayString:aString from:i1 to:i2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
4091 |
"draw part of a string" |
|
4092 |
||
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4093 |
^ self subclassResponsibility |
293 | 4094 |
! |
4095 |
||
4096 |
displayString:aString x:x y:y in:aDrawableId with:aGCId |
|
4097 |
"draw a string - draw foreground only. |
|
4350 | 4098 |
If the coordinates are not integers, retry with rounded." |
4099 |
||
4100 |
self |
|
6296 | 4101 |
displayString:aString |
4102 |
x:x |
|
4103 |
y:y |
|
4104 |
in:aDrawableId |
|
4105 |
with:aGCId |
|
4106 |
opaque:false |
|
293 | 4107 |
! |
4108 |
||
4109 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
4110 |
"draw a string" |
|
4111 |
||
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
4112 |
self displayString:aString |
6296 | 4113 |
from:1 |
4114 |
to:aString size |
|
4115 |
x:x |
|
4116 |
y:y |
|
4117 |
in:aDrawableId |
|
4118 |
with:aGCId |
|
4119 |
opaque:opaque |
|
293 | 4120 |
! |
4121 |
||
2002 | 4122 |
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:pad |
6296 | 4123 |
width:imageWidth height:imageHeight |
4124 |
x:srcx y:srcy |
|
4125 |
into:aDrawableId |
|
4126 |
x:dstx y:dsty |
|
4127 |
width:w height:h |
|
4128 |
with:aGCId |
|
2002 | 4129 |
"draw a bitimage which has depth id, width iw and height ih into |
4130 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
4131 |
It has to be checked elsewhere, that server can do it with the given |
|
4132 |
depth; also it is assumed, that the colormap is setup correctly. |
|
4133 |
The actual bits per pixel may be different from the depth (for example, |
|
4134 |
on a depth-15 device, 16 bits/pixel may be used; also, many depth-24 |
|
4135 |
systems actually use 32 bits/pixel)" |
|
4136 |
||
4137 |
^ self subclassResponsibility |
|
4138 |
! |
|
4139 |
||
4350 | 4140 |
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
6296 | 4141 |
width:imageWidth height:imageHeight |
4142 |
x:srcx y:srcy |
|
4143 |
into:aDrawableId |
|
4144 |
x:dstx y:dsty |
|
4145 |
width:w height:h |
|
4146 |
with:aGCId |
|
1602 | 4147 |
|
4148 |
"draw a bitimage which has depth id, width iw and height ih into |
|
4149 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
4150 |
It has to be checked elsewhere, that server can do it with the given |
|
4151 |
depth; also it is assumed, that the colormap is setup correctly. |
|
4152 |
The actual bits per pixel may be different from the depth (for example, |
|
4153 |
on a depth-15 device, 16 bits/pixel may be used; also, many depth-24 |
|
2004 | 4154 |
systems actually use 32 bits/pixel). |
4350 | 4155 |
This assumes a padding of 8-bits (i.e. byte-boundary), |
2004 | 4156 |
which is the natural padding within ST/X." |
1602 | 4157 |
|
2002 | 4158 |
^ self |
6296 | 4159 |
drawBits:imageBits |
4160 |
bitsPerPixel:bitsPerPixel |
|
4161 |
depth:imageDepth |
|
4162 |
padding:8 |
|
4163 |
width:imageWidth height:imageHeight |
|
4164 |
x:srcx y:srcy |
|
4165 |
into:aDrawableId |
|
4166 |
x:dstx y:dsty |
|
4167 |
width:w height:h |
|
4168 |
with:aGCId |
|
2004 | 4169 |
|
4170 |
"Created: / 16.4.1997 / 14:55:57 / cg" |
|
4171 |
"Modified: / 21.1.1998 / 13:27:58 / cg" |
|
2002 | 4172 |
! |
4173 |
||
4174 |
drawBits:imageBits depth:imageDepth padding:pad width:imageWidth height:imageHeight |
|
6296 | 4175 |
x:srcx y:srcy into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
2002 | 4176 |
|
4177 |
"draw a bitimage which has depth id, width iw and height ih into |
|
4178 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
4179 |
It has to be checked elsewhere, that server can do it with the given |
|
4180 |
depth; also it is assumed, that the colormap is setup correctly" |
|
4181 |
||
4350 | 4182 |
^ self |
6296 | 4183 |
drawBits:imageBits |
4184 |
bitsPerPixel:imageDepth |
|
4185 |
depth:imageDepth |
|
4186 |
padding:pad |
|
4187 |
width:imageWidth height:imageHeight |
|
4188 |
x:srcx y:srcy |
|
4189 |
into:aDrawableId |
|
4190 |
x:dstx y:dsty |
|
4191 |
width:w height:h |
|
4192 |
with:aGCId |
|
293 | 4193 |
! |
4194 |
||
2004 | 4195 |
drawBits:imageBits depth:imageDepth width:imageWidth height:imageHeight |
6296 | 4196 |
x:srcx y:srcy |
4197 |
into:aDrawableId x:dstx y:dsty width:w height:h with:aGCId |
|
2004 | 4198 |
|
4199 |
"draw a bitimage which has depth id, width iw and height ih into |
|
4200 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
4201 |
It has to be checked elsewhere, that server can do it with the given |
|
4202 |
depth; also it is assumed, that the colormap is setup correctly. |
|
4350 | 4203 |
This assumes a padding of 8-bits (i.e. byte-boundary), |
2004 | 4204 |
which is the natural padding within ST/X." |
4205 |
||
4350 | 4206 |
^ self |
6296 | 4207 |
drawBits:imageBits |
4208 |
bitsPerPixel:imageDepth |
|
4209 |
depth:imageDepth |
|
4210 |
width:imageWidth height:imageHeight |
|
4211 |
x:srcx y:srcy |
|
4212 |
into:aDrawableId |
|
4213 |
x:dstx y:dsty |
|
4214 |
width:w height:h |
|
4215 |
with:aGCId |
|
2004 | 4216 |
|
4217 |
"Modified: / 21.1.1998 / 13:28:34 / cg" |
|
4218 |
! |
|
4219 |
||
653
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
4220 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
6296 | 4221 |
in:aDrawableId with:aGCId |
293 | 4222 |
"fill an arc" |
4223 |
||
4224 |
^ self subclassResponsibility |
|
653
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
4225 |
|
0ad3de022f8b
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
631
diff
changeset
|
4226 |
"Created: 8.5.1996 / 08:45:11 / cg" |
293 | 4227 |
! |
4228 |
||
4229 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
4230 |
"fill a polygon" |
|
4231 |
||
4232 |
^ self subclassResponsibility |
|
4233 |
! |
|
4234 |
||
4235 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
4236 |
"fill a rectangle" |
|
4237 |
||
4238 |
^ self subclassResponsibility |
|
4239 |
! ! |
|
4240 |
||
4241 |
!DeviceWorkstation methodsFor:'enumerating'! |
|
4242 |
||
3189 | 4243 |
allTopViews |
4244 |
"return a collection of all my known top views" |
|
4245 |
||
4246 |
^self allViews select:[:eachView | eachView isTopView]. |
|
4247 |
||
4248 |
! |
|
4249 |
||
1215 | 4250 |
allViews |
4251 |
"return a collection of all my known views" |
|
4252 |
||
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
4253 |
|setOfViews| |
1215 | 4254 |
|
3147
33419a1a34a0
brokenConnection: do not remove element from an enumerated collection
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
4255 |
setOfViews := IdentitySet new. |
33419a1a34a0
brokenConnection: do not remove element from an enumerated collection
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
4256 |
|
1215 | 4257 |
knownViews notNil ifTrue:[ |
6296 | 4258 |
knownViews validElementsDo:[:v | setOfViews add:v]. |
1215 | 4259 |
]. |
4260 |
^ setOfViews |
|
4261 |
||
3147
33419a1a34a0
brokenConnection: do not remove element from an enumerated collection
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
4262 |
"Created: / 14.2.1997 / 14:29:43 / cg" |
33419a1a34a0
brokenConnection: do not remove element from an enumerated collection
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
4263 |
"Modified: / 19.1.2000 / 10:07:05 / cg" |
1215 | 4264 |
! |
4265 |
||
293 | 4266 |
allViewsDo:aBlock |
3147
33419a1a34a0
brokenConnection: do not remove element from an enumerated collection
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
4267 |
"evaluate the argument, aBlock for all of my known views. |
4350 | 4268 |
Warning do not use this to remove view |
3147
33419a1a34a0
brokenConnection: do not remove element from an enumerated collection
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
4269 |
(never remove elements from an enumerated collection)" |
293 | 4270 |
|
4271 |
"/ idToViewMapping notNil ifTrue:[ |
|
4272 |
"/ idToViewMapping keysAndValuesDo:[:id :aView | |
|
4273 |
"/ aView notNil ifTrue:[ |
|
4274 |
"/ aBlock value:aView |
|
4275 |
"/ ] |
|
4276 |
"/ ] |
|
4350 | 4277 |
|
293 | 4278 |
knownViews notNil ifTrue:[ |
6296 | 4279 |
knownViews validElementsDo:aBlock |
293 | 4280 |
] |
4281 |
||
4282 |
" |
|
4283 |
View defaultStyle:#iris. |
|
4284 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
4285 |
" |
|
4286 |
" |
|
4287 |
View defaultStyle:#next. |
|
4288 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
4289 |
" |
|
4290 |
" |
|
4291 |
View defaultStyle:#normal. |
|
4292 |
Display allViewsDo:[:v | v initStyle. v redraw] |
|
4293 |
" |
|
1215 | 4294 |
|
3147
33419a1a34a0
brokenConnection: do not remove element from an enumerated collection
Claus Gittinger <cg@exept.de>
parents:
3145
diff
changeset
|
4295 |
"Modified: / 19.1.2000 / 10:13:32 / cg" |
293 | 4296 |
! ! |
4297 |
||
3299
970960ffaef5
added DrawingOnClosedDevice signal
Claus Gittinger <cg@exept.de>
parents:
3263
diff
changeset
|
4298 |
!DeviceWorkstation methodsFor:'error handling'! |
970960ffaef5
added DrawingOnClosedDevice signal
Claus Gittinger <cg@exept.de>
parents:
3263
diff
changeset
|
4299 |
|
6511 | 4300 |
primitiveFailedOrClosedConnection |
4301 |
"sent by all primitives here, when something is wrong. |
|
4302 |
Check what was wrong and raise a corresponding error here." |
|
4303 |
||
3299
970960ffaef5
added DrawingOnClosedDevice signal
Claus Gittinger <cg@exept.de>
parents:
3263
diff
changeset
|
4304 |
self isOpen ifFalse:[ |
6511 | 4305 |
"/ ignore in end-user apps |
4306 |
(Smalltalk isSmalltalkDevelopmentSystem) ifTrue:[ |
|
4307 |
DrawingOnClosedDeviceSignal raiseRequestWith:self. |
|
4308 |
]. |
|
4309 |
^ nil |
|
4310 |
]. |
|
4311 |
^ self primitiveFailed |
|
4166 | 4312 |
! |
4313 |
||
4314 |
resourceOfId:id |
|
6345 | 4315 |
"search through all device stuff for a resource. |
4166 | 4316 |
Needed for error handling. |
4317 |
||
4318 |
Since id may be an ExternalAddress, do not compare with ==" |
|
4319 |
||
6481 | 4320 |
|addr| |
6345 | 4321 |
|
4169
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4167
diff
changeset
|
4322 |
id isNil ifTrue:[ |
6345 | 4323 |
"nil id is no resource" |
4324 |
^ nil |
|
4169
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4167
diff
changeset
|
4325 |
]. |
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4167
diff
changeset
|
4326 |
|
4166 | 4327 |
self allViewsDo:[:aView | |
6345 | 4328 |
(aView drawableId = id or:[aView gcId = id]) ifTrue:[^ aView]. |
4166 | 4329 |
]. |
4330 |
||
4173
100ca435fb0e
New class Form::ImageForm for Forms that are created from Images.
Stefan Vogel <sv@exept.de>
parents:
4169
diff
changeset
|
4331 |
Form allSubInstancesDo:[:f | |
6345 | 4332 |
(f drawableId = id and:[f graphicsDevice == self]) ifTrue:[^ f] |
4166 | 4333 |
]. |
4334 |
||
4335 |
Font allInstancesDo:[:f | |
|
6345 | 4336 |
(f fontId = id and:[f graphicsDevice == self]) ifTrue:[^ f] |
4166 | 4337 |
]. |
4338 |
||
4350 | 4339 |
"KLUDGE: XWorkstation stores all IDs in ExternalAddresses, |
6345 | 4340 |
only colorId is stored as SmallInteger, |
4341 |
But resourceOfLastError returns an ExternalAddress even for colors." |
|
4166 | 4342 |
|
4343 |
(id respondsTo:#address) ifTrue:[ |
|
6481 | 4344 |
addr := id address. |
4345 |
]. |
|
4346 |
Color allInstancesDo:[:c | |
|
4347 |
(c graphicsDevice == self |
|
4348 |
and:[ c colorId = id or:[ c colorId = addr ]]) ifTrue:[^ c]. |
|
4349 |
]. |
|
4166 | 4350 |
^ nil |
3299
970960ffaef5
added DrawingOnClosedDevice signal
Claus Gittinger <cg@exept.de>
parents:
3263
diff
changeset
|
4351 |
! ! |
970960ffaef5
added DrawingOnClosedDevice signal
Claus Gittinger <cg@exept.de>
parents:
3263
diff
changeset
|
4352 |
|
293 | 4353 |
!DeviceWorkstation methodsFor:'event forwarding'! |
4354 |
||
4959 | 4355 |
buttonMotion:buttonAndModifierState x:x y:y view:aView |
293 | 4356 |
"forward a button-motion for some view" |
4357 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4358 |
aView isNil ifTrue:[ |
6296 | 4359 |
"/ event arrived, after I destroyed it myself |
4360 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4361 |
]. |
4959 | 4362 |
aView sensor buttonMotion:buttonAndModifierState x:x y:y view:aView |
293 | 4363 |
! |
4364 |
||
4365 |
buttonMultiPress:button x:x y:y view:aView |
|
4366 |
"forward a button-multi-press event for some view" |
|
4367 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4368 |
aView isNil ifTrue:[ |
6296 | 4369 |
"/ event arrived, after I destroyed it myself |
4370 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4371 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4372 |
aView sensor buttonMultiPress:button x:x y:y view:aView |
293 | 4373 |
! |
4374 |
||
5134
0ce6b18c2747
alt-button-1 is translated to button2
Claus Gittinger <cg@exept.de>
parents:
5111
diff
changeset
|
4375 |
buttonPress:buttonArg x:x y:y view:aView |
293 | 4376 |
"forward a button-press event for some view" |
4377 |
||
5134
0ce6b18c2747
alt-button-1 is translated to button2
Claus Gittinger <cg@exept.de>
parents:
5111
diff
changeset
|
4378 |
|sensor button| |
293 | 4379 |
|
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4380 |
aView isNil ifTrue:[ |
6296 | 4381 |
"/ event arrived, after I destroyed it myself |
4382 |
^ self |
|
5134
0ce6b18c2747
alt-button-1 is translated to button2
Claus Gittinger <cg@exept.de>
parents:
5111
diff
changeset
|
4383 |
]. |
0ce6b18c2747
alt-button-1 is translated to button2
Claus Gittinger <cg@exept.de>
parents:
5111
diff
changeset
|
4384 |
|
0ce6b18c2747
alt-button-1 is translated to button2
Claus Gittinger <cg@exept.de>
parents:
5111
diff
changeset
|
4385 |
button := buttonArg. |
5999 | 4386 |
"/ used that for X on a mac, with a single button. |
4387 |
"/ No longer done automatically. |
|
5134
0ce6b18c2747
alt-button-1 is translated to button2
Claus Gittinger <cg@exept.de>
parents:
5111
diff
changeset
|
4388 |
(metaDown and:[button == 1]) ifTrue:[ |
6296 | 4389 |
UserPreferences current button2WithAltKey ifTrue:[ |
4390 |
button := 2. |
|
4391 |
]. |
|
5134
0ce6b18c2747
alt-button-1 is translated to button2
Claus Gittinger <cg@exept.de>
parents:
5111
diff
changeset
|
4392 |
]. |
0ce6b18c2747
alt-button-1 is translated to button2
Claus Gittinger <cg@exept.de>
parents:
5111
diff
changeset
|
4393 |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4394 |
sensor := aView sensor. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4395 |
WindowsRightButtonBehavior == true ifTrue:[ |
6296 | 4396 |
button >= 2 ifTrue:[ |
4397 |
sensor buttonPress:1 x:x y:y view:aView. |
|
4398 |
^ self. |
|
4399 |
] |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4400 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4401 |
sensor buttonPress:button x:x y:y view:aView |
293 | 4402 |
! |
4403 |
||
4404 |
buttonRelease:button x:x y:y view:aView |
|
4405 |
"forward a button-release event for some view" |
|
4406 |
||
4407 |
|sensor| |
|
4408 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4409 |
aView isNil ifTrue:[ |
6296 | 4410 |
"/ event arrived, after I destroyed it myself |
4411 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4412 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4413 |
sensor := aView sensor. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4414 |
WindowsRightButtonBehavior == true ifTrue:[ |
6296 | 4415 |
button >= 2 ifTrue:[ |
4416 |
sensor buttonRelease:1 x:x y:y view:aView. |
|
4417 |
sensor buttonPress:button x:x y:y view:aView. |
|
4418 |
sensor buttonRelease:button x:x y:y view:aView. |
|
4419 |
^ self. |
|
4420 |
]. |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4421 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4422 |
sensor buttonRelease:button x:x y:y view:aView |
293 | 4423 |
! |
4424 |
||
4425 |
configureX:x y:y width:w height:h view:aView |
|
4426 |
"forward a configure for some view" |
|
4427 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4428 |
aView isNil ifTrue:[ |
6296 | 4429 |
"/ event arrived, after I destroyed it myself |
4430 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4431 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4432 |
aView sensor configureX:x y:y width:w height:h view:aView |
293 | 4433 |
! |
4434 |
||
4435 |
coveredBy:otherView view:aView |
|
3602
3df4b726ba4b
Use WindowSensor for #coveredBy:
Stefan Vogel <sv@exept.de>
parents:
3597
diff
changeset
|
4436 |
"forward a covered for some view |
3df4b726ba4b
Use WindowSensor for #coveredBy:
Stefan Vogel <sv@exept.de>
parents:
3597
diff
changeset
|
4437 |
(aView has been covered by otherView)" |
3df4b726ba4b
Use WindowSensor for #coveredBy:
Stefan Vogel <sv@exept.de>
parents:
3597
diff
changeset
|
4438 |
|
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4439 |
aView isNil ifTrue:[ |
6296 | 4440 |
"/ event arrived, after I destroyed it myself |
4441 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4442 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4443 |
aView sensor coveredBy:otherView view:aView |
293 | 4444 |
! |
4445 |
||
4446 |
destroyedView:aView |
|
4447 |
"forward a destroyed event for some view" |
|
4448 |
||
3953 | 4449 |
|sensor| |
4450 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4451 |
aView isNil ifTrue:[ |
6296 | 4452 |
"/ event arrived, after I destroyed it myself |
4453 |
^ self |
|
3953 | 4454 |
]. |
4455 |
||
4456 |
"/ this one has special treatment - the destroyed could |
|
4457 |
"/ (in certain situations) arrive after the view has shutdown its |
|
4458 |
"/ sensor. |
|
4459 |
sensor := aView sensor. |
|
4460 |
sensor notNil ifTrue:[ |
|
6296 | 4461 |
sensor destroyedView:aView |
3953 | 4462 |
]. |
293 | 4463 |
! |
4464 |
||
4465 |
exposeX:x y:y width:w height:h view:aView |
|
4466 |
"forward an expose for some view" |
|
4467 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4468 |
aView isNil ifTrue:[ |
6296 | 4469 |
"/ event arrived, after I destroyed it myself |
4470 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4471 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4472 |
aView sensor exposeX:x y:y width:w height:h view:aView |
293 | 4473 |
! |
4474 |
||
4475 |
focusInView:aView |
|
4476 |
"forward a focusIn event for some view" |
|
4477 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4478 |
aView isNil ifTrue:[ |
6296 | 4479 |
"/ event arrived, after I destroyed it myself |
4480 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4481 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4482 |
aView sensor focusInView:aView |
293 | 4483 |
! |
4484 |
||
4350 | 4485 |
focusOutView:aView |
293 | 4486 |
"forward a focusOut event for some view" |
4487 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4488 |
aView isNil ifTrue:[ |
6296 | 4489 |
"/ event arrived, after I destroyed it myself |
4490 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4491 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4492 |
aView sensor focusOutView:aView |
293 | 4493 |
! |
4494 |
||
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
4495 |
graphicsExposeX:x y:y width:w height:h final:final view:aView |
293 | 4496 |
"forward a graphic expose for some view" |
4497 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4498 |
aView isNil ifTrue:[ |
6296 | 4499 |
"/ event arrived, after I destroyed it myself |
4500 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4501 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4502 |
aView sensor graphicsExposeX:x y:y width:w height:h final:final view:aView |
293 | 4503 |
! |
4504 |
||
5960 | 4505 |
hotkeyWithId:aHotkeyId key:aKey view:aView |
4506 |
"forward a hotkey press for a view |
|
4507 |
" |
|
4508 |
||
4509 |
aView isNil ifTrue:[ |
|
6296 | 4510 |
"/ event arrived, after I destroyed it myself |
4511 |
^ self |
|
5960 | 4512 |
]. |
4513 |
aView sensor hotkeyWithId:aHotkeyId key:aKey view:aView |
|
4514 |
! |
|
4515 |
||
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4516 |
keyPress:untranslatedKeyArg x:x y:y view:aView |
293 | 4517 |
"forward a key-press event for some view" |
4518 |
||
509 | 4519 |
<resource: #keyboard (#Escape)> |
4520 |
||
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4521 |
|untranslatedKey| |
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4522 |
|
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4523 |
untranslatedKeyArg isInteger ifTrue:[ |
6296 | 4524 |
untranslatedKey := Character value:untranslatedKeyArg |
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4525 |
] ifFalse:[ |
6296 | 4526 |
untranslatedKey := untranslatedKeyArg |
5828
b77d25ec29ad
comment/format in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
5778
diff
changeset
|
4527 |
]. |
b77d25ec29ad
comment/format in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
5778
diff
changeset
|
4528 |
|
5917
d5b5e701a6e8
changed: #prependModifierToKey:
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
4529 |
"/ Timestamp now print. 'X: ' print. untranslatedKey printCR. |
4070 | 4530 |
|
6175 | 4531 |
"/ ctrl/meta-ESC give up focus& escapes an activePointerGrab |
3691
9427485e2507
Fix previous change: Return in LicenceBox on startup crashed the system.
Stefan Vogel <sv@exept.de>
parents:
3690
diff
changeset
|
4532 |
untranslatedKey == #Escape ifTrue:[ |
6296 | 4533 |
(activePointerGrab notNil |
4534 |
and:[ctrlDown or:[metaDown]]) ifTrue:[ |
|
4535 |
self ungrabPointer. |
|
4536 |
self ungrabKeyboard. |
|
4537 |
self setInputFocusTo:nil |
|
4538 |
] |
|
492
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
4539 |
]. |
e67b71dd143d
added panic-ESC to release grab (Ctrl-ESC)
Claus Gittinger <cg@exept.de>
parents:
479
diff
changeset
|
4540 |
|
293 | 4541 |
self modifierKeyProcessing:untranslatedKey down:true. |
4542 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4543 |
aView isNil ifTrue:[ |
6296 | 4544 |
"/ event arrived, after I destroyed it myself |
4545 |
^ self |
|
4070 | 4546 |
]. |
4547 |
||
4548 |
"/ xlatedKey := self translateKey:untranslatedKey forView:aView. |
|
4549 |
"/ xlatedKey == #Hardcopy ifTrue:[ |
|
4550 |
"/ [ |
|
4551 |
"/ Transcript topView application |
|
4552 |
"/ saveScreenImage:(Image fromView:(aView topView) "inset:0" grab:true) defaultName:'hardcopy'. |
|
4553 |
"/ ] forkAt:Processor userSchedulingPriority + 1. |
|
4554 |
"/ ^ self. |
|
4555 |
"/ ]. |
|
4556 |
"/ |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4557 |
aView sensor keyPress:untranslatedKey x:x y:y view:aView |
5828
b77d25ec29ad
comment/format in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
5778
diff
changeset
|
4558 |
|
5917
d5b5e701a6e8
changed: #prependModifierToKey:
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
4559 |
"Modified (format): / 12-07-2012 / 18:37:40 / cg" |
293 | 4560 |
! |
4561 |
||
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4562 |
keyRelease:untranslatedKeyArg x:x y:y view:aView |
293 | 4563 |
"forward a key-release event for some view" |
4564 |
||
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4565 |
|untranslatedKey xlatedKey| |
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4566 |
|
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4567 |
untranslatedKeyArg isInteger ifTrue:[ |
6296 | 4568 |
untranslatedKey := Character value:untranslatedKeyArg |
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4569 |
] ifFalse:[ |
6296 | 4570 |
untranslatedKey := untranslatedKeyArg |
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
4571 |
]. |
293 | 4572 |
|
4573 |
self modifierKeyProcessing:untranslatedKey down:false. |
|
4574 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4575 |
aView isNil ifTrue:[ |
6296 | 4576 |
"/ event arrived, after I destroyed it myself |
4577 |
^ self |
|
3691
9427485e2507
Fix previous change: Return in LicenceBox on startup crashed the system.
Stefan Vogel <sv@exept.de>
parents:
3690
diff
changeset
|
4578 |
]. |
9427485e2507
Fix previous change: Return in LicenceBox on startup crashed the system.
Stefan Vogel <sv@exept.de>
parents:
3690
diff
changeset
|
4579 |
|
9427485e2507
Fix previous change: Return in LicenceBox on startup crashed the system.
Stefan Vogel <sv@exept.de>
parents:
3690
diff
changeset
|
4580 |
xlatedKey := self translateKey:untranslatedKey forView:aView. |
9427485e2507
Fix previous change: Return in LicenceBox on startup crashed the system.
Stefan Vogel <sv@exept.de>
parents:
3690
diff
changeset
|
4581 |
xlatedKey == #Hardcopy ifTrue:[^ self]. |
9427485e2507
Fix previous change: Return in LicenceBox on startup crashed the system.
Stefan Vogel <sv@exept.de>
parents:
3690
diff
changeset
|
4582 |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4583 |
aView sensor keyRelease:untranslatedKey x:x y:y view:aView |
293 | 4584 |
! |
4585 |
||
4586 |
mappedView:aView |
|
4587 |
"forward a mapped event for some view" |
|
4588 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4589 |
aView isNil ifTrue:[ |
6296 | 4590 |
"/ event arrived, after I destroyed it myself |
4591 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4592 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4593 |
aView sensor mappedView:aView |
293 | 4594 |
! |
4595 |
||
2733
5af2417bc450
pass x/y with mouseWheel event
Claus Gittinger <cg@exept.de>
parents:
2716
diff
changeset
|
4596 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime view:aView |
2677 | 4597 |
"the mousewheel was moved by some amount (signed). |
4598 |
This event is sent to the current pointer view (like keyPress/release)." |
|
2699 | 4599 |
|
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4600 |
aView isNil ifTrue:[ |
6296 | 4601 |
"/ event arrived, after I destroyed it myself |
4602 |
^ self |
|
5610 | 4603 |
]. |
4604 |
aView sensor |
|
6296 | 4605 |
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime view:aView |
2699 | 4606 |
|
4607 |
"Modified: / 21.5.1999 / 13:05:53 / cg" |
|
2677 | 4608 |
! |
4609 |
||
293 | 4610 |
noExposeView:aView |
4611 |
"forward a noExpose event for some view" |
|
4612 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4613 |
aView isNil ifTrue:[ |
6296 | 4614 |
"/ event arrived, after I destroyed it myself |
4615 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4616 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4617 |
aView sensor noExposeView:aView |
293 | 4618 |
! |
4619 |
||
4620 |
pointerEnter:buttonState x:x y:y view:aView |
|
4621 |
"forward a pointer enter for some view" |
|
4622 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4623 |
aView isNil ifTrue:[ |
6296 | 4624 |
"/ event arrived, after I destroyed it myself |
4625 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4626 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4627 |
aView sensor pointerEnter:buttonState x:x y:y view:aView |
293 | 4628 |
! |
4629 |
||
4630 |
pointerLeave:buttonState view:aView |
|
4631 |
"forward a pointer leave for some view" |
|
4632 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4633 |
aView isNil ifTrue:[ |
6296 | 4634 |
"/ event arrived, after I destroyed it myself |
4635 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4636 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4637 |
aView sensor pointerLeave:buttonState view:aView |
293 | 4638 |
! |
4639 |
||
4640 |
saveAndTerminateView:aView |
|
4641 |
"forward a saveAndTerminate event for some view" |
|
4642 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4643 |
aView isNil ifTrue:[ |
6296 | 4644 |
"/ event arrived, after I destroyed it myself |
4645 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4646 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4647 |
aView sensor saveAndTerminateView:aView |
293 | 4648 |
! |
4649 |
||
4650 |
terminateView:aView |
|
4651 |
"forward a terminate event for some view" |
|
4652 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4653 |
aView isNil ifTrue:[ |
6296 | 4654 |
"/ event arrived, after I destroyed it myself |
4655 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4656 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4657 |
aView sensor terminateView:aView. |
293 | 4658 |
! |
4659 |
||
4660 |
unmappedView:aView |
|
4661 |
"forward an unmapped event for some view" |
|
4662 |
||
3231
b7fc5adc9404
care for unknown view in event forwarding code
Claus Gittinger <cg@exept.de>
parents:
3224
diff
changeset
|
4663 |
aView isNil ifTrue:[ |
6296 | 4664 |
"/ event arrived, after I destroyed it myself |
4665 |
^ self |
|
3858
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4666 |
]. |
ecbaa5d75c70
Use SynchronousWindowSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3834
diff
changeset
|
4667 |
aView sensor unmappedView:aView |
293 | 4668 |
! ! |
4669 |
||
4670 |
!DeviceWorkstation methodsFor:'event handling'! |
|
4671 |
||
4672 |
checkForEndOfDispatch |
|
4350 | 4673 |
"return true, if there are still any views of interest - |
4674 |
if not, stop dispatch. |
|
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
|
4675 |
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
|
4676 |
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
|
4677 |
|
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
4678 |
dispatching ifFalse:[^ self]. |
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
4679 |
|
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
4680 |
self == Display ifTrue:[ |
6296 | 4681 |
ExitOnLastClose == true ifFalse:[^ self]. |
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
4682 |
]. |
2826 | 4683 |
exitOnLastClose == true ifFalse:[^ self]. |
293 | 4684 |
|
4685 |
knownViews notNil ifTrue:[ |
|
6296 | 4686 |
"/ if there is no non-popup topview, stop dispatching |
4687 |
(knownViews contains:[:slot | |
|
4688 |
slot notNil |
|
4689 |
and:[slot ~~ 0 |
|
4690 |
and:[(self viewIsRelevantInCheckForEndOfDispatch:slot) |
|
4691 |
and:[true "slot isModal not" |
|
4692 |
"and:[slot realized]"]]]]) |
|
4693 |
ifFalse:[ |
|
4694 |
"/ my last view was closed |
|
4695 |
dispatching := false. |
|
4696 |
'DeviceWorkstation [info]: finished dispatch (last view closed): ' infoPrint. |
|
4697 |
self infoPrintCR. |
|
4698 |
LastActiveScreen == self ifTrue:[ |
|
4699 |
LastActiveScreen := nil. |
|
4700 |
LastActiveProcess := nil. |
|
4701 |
]. |
|
4702 |
eventSema notNil ifTrue:[eventSema signal]. "/ get dispatchLoop out of its wait... |
|
4703 |
] |
|
423
98a3808d9902
additions for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
414
diff
changeset
|
4704 |
]. |
293 | 4705 |
|
4706 |
"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
|
4707 |
"Modified: 18.3.1997 / 10:42:11 / cg" |
293 | 4708 |
! |
4709 |
||
3646 | 4710 |
cleanupAfterDispatch |
4711 |
eventSema notNil ifTrue:[ |
|
6296 | 4712 |
Processor disableSemaphore:eventSema. |
4713 |
eventSema := nil. |
|
3646 | 4714 |
]. |
4715 |
dispatchProcess := nil. |
|
3742 | 4716 |
|
4717 |
DefaultScreen == self ifTrue:[ |
|
6296 | 4718 |
(Transcript isView and:[Transcript topView device ~~ self]) ifTrue:[ |
4719 |
DefaultScreen := Transcript topView device |
|
4720 |
] ifFalse:[ |
|
4721 |
"/ what should the defaultScreen be - help !!!!!! |
|
4722 |
||
4723 |
DefaultScreen := DeviceWorkstation allSubInstances |
|
4724 |
detect:[:aDevice | aDevice isOpen] ifNone:nil |
|
4725 |
] |
|
3742 | 4726 |
] |
3646 | 4727 |
! |
4728 |
||
293 | 4729 |
dispatchEvent |
4730 |
"get and process the next pending event - for any view" |
|
4731 |
||
4732 |
self dispatchEventFor:nil withMask:nil |
|
4733 |
! |
|
4734 |
||
4735 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
4736 |
"central event handling method: |
|
4737 |
get next event and send an appropriate message to the views sensor, |
|
4738 |
or to the view directly (if the view has none). |
|
4739 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
4740 |
otherwise only events for the view with given id are processed |
|
4741 |
(in this case, nothing is done if no events are pending); |
|
4742 |
if the argument aMask is nonNil, only events for this eventMask are |
|
4743 |
handled. The mask is a device dependent event mask." |
|
4744 |
||
4745 |
^ self subclassResponsibility |
|
4746 |
! |
|
4747 |
||
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4748 |
dispatchLoop |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4749 |
"the actual event dispatching loop." |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4750 |
|
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4751 |
[dispatching] whileTrue:[ |
6383 | 4752 |
"abortAll is handled, but not asked for here!!" |
4753 |
AbortAllOperationRequest handle:[:ex | |
|
4754 |
ex return |
|
4755 |
] do:[ |
|
4756 |
[self eventPending] whileFalse:[ |
|
4757 |
Processor activeProcess setStateTo:#ioWait if:#active. |
|
4758 |
eventSema wait. |
|
4759 |
"/ a temporary hack & workaround for semaphore-bug |
|
4760 |
"/ (eventSema waitWithTimeoutMs:500) isNil ifTrue:[ |
|
4761 |
"/ "/ timeout |
|
4762 |
"/ eventSema wouldBlock ifFalse:[ |
|
4763 |
"/ 'DeviceWorkstation [info]: sema did not wake up' infoPrintCR |
|
4764 |
"/ ] ifTrue:[ |
|
4765 |
"/ self eventPending ifTrue:[ |
|
4766 |
"/ 'DeviceWorkstation [info]: sema missed' infoPrintCR |
|
4767 |
"/ ]. |
|
4768 |
"/ ]. |
|
4769 |
"/ ]. |
|
4770 |
dispatching ifFalse:[^ self]. |
|
4771 |
]. |
|
4772 |
dispatching ifTrue:[ |
|
4773 |
self dispatchPendingEvents. |
|
4774 |
]. |
|
4775 |
] |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4776 |
] |
5715 | 4777 |
|
4778 |
"Modified: / 09-02-2011 / 13:59:43 / cg" |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4779 |
! |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4780 |
|
293 | 4781 |
dispatchModalWhile:aBlock |
4350 | 4782 |
"get and process next event for any view as long as the |
293 | 4783 |
argument-block evaluates to true. |
4784 |
This is a modal loop, not switching to other processes, |
|
4350 | 4785 |
effectively polling the device in a (nice) busy loop. |
293 | 4786 |
This should only be (and is only) used for emergency cases. |
4787 |
(such as a graphical debugger, debugging the event-dispatcher itself)" |
|
4788 |
||
4789 |
|myFd| |
|
4790 |
||
4791 |
" |
|
4792 |
if this display has a fileDescriptor to wait on, |
|
4793 |
it is used; otherwise we poll (with a delay to not lock up |
|
4794 |
the workstation) |
|
4795 |
" |
|
4796 |
myFd := self displayFileDescriptor. |
|
4797 |
[aBlock value] whileTrue:[ |
|
6296 | 4798 |
self eventPending ifFalse:[ |
4799 |
myFd isNil ifTrue:[ |
|
4800 |
OperatingSystem millisecondDelay:50 |
|
4801 |
] ifFalse:[ |
|
4802 |
OperatingSystem selectOn:myFd withTimeOut:50. |
|
4803 |
]. |
|
4804 |
Processor evaluateTimeouts. |
|
4805 |
]. |
|
4806 |
self eventPending ifTrue:[ |
|
4807 |
self dispatchEvent |
|
4808 |
]. |
|
293 | 4809 |
] |
4810 |
! |
|
4811 |
||
4812 |
dispatchPendingEvents |
|
405 | 4813 |
"go dispatch events as long as there is one. |
4814 |
This is only used with modal operation. |
|
4815 |
(i.e. when in the modal debugger)" |
|
293 | 4816 |
|
4287 | 4817 |
OSSignalInterrupt handle:[:ex | |
6296 | 4818 |
ex return |
2114 | 4819 |
] do:[ |
6296 | 4820 |
[self eventPending] whileTrue:[ |
4821 |
self dispatchEventFor:nil withMask:nil. |
|
4822 |
"/ multi-screen config: give others a chance |
|
4823 |
"/ (needed because we run at high (non-timesliced) prio) |
|
4824 |
Processor yield. |
|
4825 |
] |
|
293 | 4826 |
] |
4827 |
! |
|
4828 |
||
4829 |
disposeButtonEventsFor:aViewIdOrNil |
|
4830 |
"dispose (i.e. forget) all pending button events on this display" |
|
4831 |
||
4832 |
|mask| |
|
4833 |
||
4834 |
mask := self eventMaskFor:#buttonPress. |
|
4835 |
mask := mask bitOr:(self eventMaskFor:#buttonRelease). |
|
4836 |
mask := mask bitOr:(self eventMaskFor:#buttonMotion). |
|
4837 |
self disposeEventsWithMask:mask for:aViewIdOrNil |
|
4838 |
! |
|
4839 |
||
4840 |
disposeEvents |
|
4841 |
"dispose (i.e. forget) all events pending on this display" |
|
4842 |
||
4843 |
[self eventPending] whileTrue:[ |
|
6296 | 4844 |
self getEventFor:nil withMask:nil into:nil |
293 | 4845 |
]. |
4846 |
! |
|
4847 |
||
4848 |
disposeEventsWithMask:aMask for:aWindowId |
|
4849 |
"dispose (throw away) specific events" |
|
4850 |
||
4851 |
^ self subclassResponsibility |
|
4852 |
! |
|
4853 |
||
4854 |
eventMaskFor:anEventSymbol |
|
4855 |
^ self subclassResponsibility |
|
4856 |
! |
|
4857 |
||
4858 |
eventPending |
|
4859 |
"return true, if any event is pending" |
|
4860 |
||
4861 |
^ self subclassResponsibility |
|
4862 |
! |
|
4863 |
||
4864 |
eventPending:anEventSymbol for:aWindowId |
|
4865 |
"return true, if a specific event is pending for a specific window. |
|
4866 |
This expects device independent event symbols (such as #buttonPress, |
|
4867 |
#buttonRelease etc.) as first argument." |
|
4868 |
||
4869 |
^ self subclassResponsibility |
|
4870 |
! |
|
4871 |
||
3224 | 4872 |
eventPending:anEventMask for:aWindowId withSync:doSync |
4873 |
"return true, if any of the masked events is pending |
|
4874 |
for a specific window. |
|
4875 |
This expects a device dependent event mask as first argument." |
|
4876 |
||
4877 |
^ self subclassResponsibility |
|
4878 |
! |
|
4879 |
||
405 | 4880 |
eventPendingWithSync:doSync |
293 | 4881 |
"return true, if any event is pending" |
4882 |
||
4883 |
^ self subclassResponsibility |
|
4884 |
! |
|
4885 |
||
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
|
4886 |
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
|
4887 |
"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
|
4888 |
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
|
4889 |
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
|
4890 |
|
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
4891 |
^ 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
|
4892 |
! |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
4893 |
|
2169 | 4894 |
eventQueuedAlready |
4895 |
"return true, if any event is pending in some internal queue. |
|
4896 |
The fallBack here returns true if events are pending on the display connection; |
|
4897 |
only devices which use internal queues (i.e. Xlib) need to redefine this." |
|
4898 |
||
4899 |
^ self eventPending |
|
4900 |
! |
|
4901 |
||
405 | 4902 |
eventsPending:anEventMask for:aWindowId withSync:doSync |
3224 | 4903 |
"obsolete - will vanish." |
4904 |
||
4905 |
^ self eventPending:anEventMask for:aWindowId withSync:doSync |
|
293 | 4906 |
! |
4907 |
||
5959
84cbcbd739f1
added: #registerHotKeyForWindow:withId:modifiers:virtualKeyCode:
ab
parents:
5947
diff
changeset
|
4908 |
registerHotKeyForWindow:aDrawableId withId:anId modifiers:aModifier virtualKeyCode:aVirtualKeyCode |
84cbcbd739f1
added: #registerHotKeyForWindow:withId:modifiers:virtualKeyCode:
ab
parents:
5947
diff
changeset
|
4909 |
"Defines a system-wide hot key." |
84cbcbd739f1
added: #registerHotKeyForWindow:withId:modifiers:virtualKeyCode:
ab
parents:
5947
diff
changeset
|
4910 |
|
84cbcbd739f1
added: #registerHotKeyForWindow:withId:modifiers:virtualKeyCode:
ab
parents:
5947
diff
changeset
|
4911 |
^ self subclassResponsibility |
84cbcbd739f1
added: #registerHotKeyForWindow:withId:modifiers:virtualKeyCode:
ab
parents:
5947
diff
changeset
|
4912 |
! |
84cbcbd739f1
added: #registerHotKeyForWindow:withId:modifiers:virtualKeyCode:
ab
parents:
5947
diff
changeset
|
4913 |
|
293 | 4914 |
setEventMask:aMask in:aWindowId |
310 | 4915 |
"arrange that only events from aMask are reported to a view. |
4916 |
Highly device specific, to be defined in concrete subclasses" |
|
4917 |
||
293 | 4918 |
^ self subclassResponsibility |
4919 |
! |
|
4920 |
||
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4921 |
setupDispatchLoop |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4922 |
"create & start the display event dispatch process." |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4923 |
|
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4924 |
|fd checkBlock| |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4925 |
|
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4926 |
fd := self displayFileDescriptor. |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4927 |
|
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4928 |
eventSema := Semaphore new name:'display inputSema'. |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4929 |
|
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4930 |
"/ arrange for the processor to signal that semaphore when input |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4931 |
"/ is available or #eventPending returns true |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4932 |
|
6085 | 4933 |
(fd isNil or:[ OperatingSystem isOSXlike]) ifTrue:[ |
6296 | 4934 |
"no fd -- so have to check for input also" |
4935 |
checkBlock := [self eventPending]. |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4936 |
] ifFalse:[ |
6296 | 4937 |
"there is a fd, so checkblock has to check only the internal queue" |
4938 |
checkBlock := [self eventQueued]. |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4939 |
]. |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4940 |
|
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4941 |
"/ handle all incoming events from the device, sitting on a semaphore. |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4942 |
"/ Tell Processor to trigger this semaphore when some event arrives |
4350 | 4943 |
"/ for me. Since a select alone may not be enough to know if events are pending |
4944 |
"/ (Xlib reads out event-queue while doing output), we also install a poll-check block. |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4945 |
"/ The poll check is also req'd for systems where we cannot do a select |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4946 |
"/ on the eventQ (i.e. windows). |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4947 |
|
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4948 |
Processor signal:eventSema onInput:fd orCheck:checkBlock. |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4949 |
|
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4950 |
DeviceIOErrorSignal handle:[:ex | |
6296 | 4951 |
"test for handlerBlock until the signal is changed to be class-based" |
4952 |
ex creator handlerBlock notNil ifTrue:[ |
|
4953 |
ex defaultAction. |
|
4954 |
] ifFalse:[ |
|
4955 |
(self == self class default and:[AllScreens size == 1]) ifTrue:[ |
|
4956 |
'DeviceWorkstation [error]: I/O error for default display - writing crash.img and exiting' errorPrintCR. |
|
4957 |
SnapshotError ignoreIn:[ ObjectMemory writeCrashImage ]. |
|
4958 |
Smalltalk exit:1. |
|
4959 |
]. |
|
4960 |
'DeviceWorkstation [warning]: stop dispatch due to I/O error: ' errorPrint. |
|
4961 |
self errorPrintCR. |
|
4962 |
self brokenConnection. |
|
4963 |
]. |
|
4964 |
ex return. |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4965 |
] do:[ |
6296 | 4966 |
self initializeDeviceResources. |
4967 |
[ |
|
4968 |
self dispatchLoop |
|
4969 |
] ifCurtailed:[ |
|
4970 |
self cleanupAfterDispatch. |
|
4971 |
self emergencyCloseConnection. |
|
4972 |
]. |
|
4973 |
self cleanupAfterDispatch. |
|
4974 |
self close. |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4975 |
]. |
4629 | 4976 |
|
4977 |
"Modified: / 29-09-2006 / 12:28:04 / cg" |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4978 |
! |
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4979 |
|
293 | 4980 |
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
|
4981 |
"create & start the display event dispatch process." |
293 | 4982 |
|
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4983 |
|p nm| |
293 | 4984 |
|
1185
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
4985 |
"/ |
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
4986 |
"/ only allow one dispatcher process per display |
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
4987 |
"/ |
6253 | 4988 |
(dispatchProcess notNil and:[dispatchProcess isDead not]) ifTrue:[^ self]. |
293 | 4989 |
dispatching := true. |
4990 |
||
4991 |
AllScreens isNil ifTrue:[ |
|
6296 | 4992 |
AllScreens := IdentitySet new:1 |
293 | 4993 |
]. |
4994 |
AllScreens add:self. |
|
4995 |
||
3645
7ed096386bd3
refactored event dispatch loop;
Claus Gittinger <cg@exept.de>
parents:
3644
diff
changeset
|
4996 |
p := [ self setupDispatchLoop ] newProcess. |
1185
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
4997 |
|
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
4998 |
"/ |
f72f2a0d97cf
code cleanup (obsolete pureEvent stuff removed)
Claus Gittinger <cg@exept.de>
parents:
1177
diff
changeset
|
4999 |
"/ 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
|
5000 |
"/ |
762 | 5001 |
(nm := self displayName) notNil ifTrue:[ |
6296 | 5002 |
nm := 'event dispatcher (' , nm , ')'. |
293 | 5003 |
] ifFalse:[ |
6296 | 5004 |
nm := 'event dispatcher'. |
762 | 5005 |
]. |
5006 |
p name:nm. |
|
958 | 5007 |
p priority:(Processor userInterruptPriority). |
2969
c0c385edd320
explicit mark of the dispatcher process as a systemProcess.
Claus Gittinger <cg@exept.de>
parents:
2963
diff
changeset
|
5008 |
p beSystemProcess. |
958 | 5009 |
dispatchProcess := p. |
5010 |
p resume. |
|
2892 | 5011 |
! |
5012 |
||
5013 |
stopDispatch |
|
5014 |
"stop the dispatch process" |
|
5015 |
||
5016 |
|p| |
|
5017 |
||
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
5018 |
LastActiveScreen == self ifTrue:[ |
6296 | 5019 |
LastActiveScreen := nil. |
5020 |
LastActiveProcess := nil. |
|
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
5021 |
]. |
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
5022 |
|
2892 | 5023 |
(p := dispatchProcess) notNil ifTrue:[ |
6296 | 5024 |
dispatchProcess := nil. |
5025 |
p terminateWithAllSubprocessesInGroup. |
|
5026 |
p terminateNoSignal. "/ just in case |
|
2892 | 5027 |
] |
5960 | 5028 |
! |
5029 |
||
5030 |
unregisterHotKeyForWindow:aDrawableId withId:anId |
|
5031 |
"Release a system-wide hot key." |
|
5032 |
||
5033 |
^ self subclassResponsibility |
|
6293 | 5034 |
! |
5035 |
||
5036 |
viewIsRelevantInCheckForEndOfDispatch:aView |
|
5037 |
"return true, if the argument is not to be treated as a user view. |
|
5038 |
These, if any of them is still present, will prevent the endOfDispatch if the |
|
5039 |
exitOnLastClose flag is set." |
|
5040 |
||
5041 |
^ aView isRootView not |
|
6296 | 5042 |
and:[ aView isTopView |
6293 | 5043 |
and:[ aView isPopUpView not ]] |
293 | 5044 |
! ! |
5045 |
||
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5046 |
!DeviceWorkstation methodsFor:'event sending'! |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5047 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5048 |
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
|
5049 |
"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
|
5050 |
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
|
5051 |
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
|
5052 |
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
|
5053 |
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
|
5054 |
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
|
5055 |
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
|
5056 |
(not very user friendly)" |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5057 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5058 |
self subclassResponsibility |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5059 |
! |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5060 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5061 |
simulateKeyboardInput:aCharacterOrString inViewId:viewId |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5062 |
"send input to some other view, by simulating keyPress/keyRelease |
4350 | 5063 |
events. |
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5064 |
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
|
5065 |
Notice: not all alien views allow this kind of synthetic input; |
6296 | 5066 |
some simply ignore it." |
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5067 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5068 |
|control code state| |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5069 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5070 |
aCharacterOrString isString ifTrue:[ |
6296 | 5071 |
aCharacterOrString do:[:char | |
5072 |
self simulateKeyboardInput:char inViewId:viewId |
|
5073 |
]. |
|
5074 |
^ self |
|
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5075 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5076 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5077 |
control := false. |
4075
1ab094bc6a69
Use the ANSI-blessed #codePoint instead of deprecated #asciiValue
Stefan Vogel <sv@exept.de>
parents:
4074
diff
changeset
|
5078 |
code := aCharacterOrString codePoint. |
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5079 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5080 |
(aCharacterOrString == Character cr) ifTrue:[ |
6296 | 5081 |
code := #Return |
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5082 |
] ifFalse:[ |
6296 | 5083 |
(aCharacterOrString == Character tab) ifTrue:[ |
5084 |
code := #Tab |
|
5085 |
] ifFalse:[ |
|
5086 |
(aCharacterOrString == Character esc) ifTrue:[ |
|
5087 |
code := #Escape |
|
5088 |
] |
|
5089 |
] |
|
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5090 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5091 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5092 |
control ifTrue:[ |
6296 | 5093 |
state := self ctrlModifierMask |
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5094 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5095 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5096 |
|
4350 | 5097 |
"/ the stuff below should not be needed |
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5098 |
"/ (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
|
5099 |
"/ 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
|
5100 |
"/ Hopefully, this is correct ... |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5101 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5102 |
code isNumber ifTrue:[ |
6296 | 5103 |
code >= $A codePoint ifTrue:[ |
5104 |
code <= $Z codePoint ifTrue:[ |
|
5105 |
state := self shiftModifierMask |
|
5106 |
] |
|
5107 |
] |
|
2669
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5108 |
]. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5109 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5110 |
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
|
5111 |
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
|
5112 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5113 |
" |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5114 |
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
|
5115 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5116 |
|point id| |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5117 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5118 |
point := Display pointFromUser. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5119 |
id := Display viewIdFromPoint:point. |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5120 |
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
|
5121 |
" |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5122 |
|
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5123 |
"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
|
5124 |
! ! |
7754d5eddaba
event sending abstracted (partial common code for X & Win32)
Claus Gittinger <cg@exept.de>
parents:
2648
diff
changeset
|
5125 |
|
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5126 |
!DeviceWorkstation methodsFor:'font helpers'! |
293 | 5127 |
|
5128 |
ascentOf:aFontId |
|
5129 |
"return the number of pixels above the base line of a font" |
|
5130 |
||
5131 |
^ self subclassResponsibility |
|
5132 |
! |
|
5133 |
||
5134 |
descentOf:aFontId |
|
5135 |
"return the number of pixels below the base line of a font" |
|
5136 |
||
5137 |
^ self subclassResponsibility |
|
5138 |
! |
|
5139 |
||
439
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5140 |
encodingOf:aFontId |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5141 |
"return the characterEncoding of a font. |
3992 | 5142 |
Here, we assume an iso8859-1 encoding" |
5143 |
||
3994 | 5144 |
^ #'iso8859-1' |
439
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5145 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5146 |
"Created: 23.2.1996 / 00:39:06 / cg" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5147 |
! |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5148 |
|
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5149 |
maxAscentOf:aFontId |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5150 |
"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
|
5151 |
in a font" |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5152 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5153 |
^ self subclassResponsibility |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5154 |
! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5155 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5156 |
maxDescentOf:aFontId |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5157 |
"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
|
5158 |
in a font" |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5159 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5160 |
^ self subclassResponsibility |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5161 |
! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5162 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5163 |
maxWidthOfFont:aFontId |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5164 |
"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
|
5165 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5166 |
^ self subclassResponsibility |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5167 |
! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5168 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5169 |
minWidthOfFont:aFontId |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5170 |
"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
|
5171 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5172 |
^ self subclassResponsibility |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5173 |
! ! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5174 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5175 |
!DeviceWorkstation methodsFor:'font stuff'! |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5176 |
|
293 | 5177 |
facesInFamily:aFamilyName |
5178 |
"return a set of all available font faces in aFamily on this display" |
|
5179 |
||
4350 | 5180 |
^ self facesInFamily:aFamilyName filtering:nil |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5181 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5182 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5183 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5184 |
Display facesInFamily:'times' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5185 |
Display facesInFamily:'fixed' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5186 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5187 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5188 |
"Modified: 27.2.1996 / 01:33:47 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5189 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5190 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5191 |
facesInFamily:aFamilyName filtering:filterBlock |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5192 |
"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
|
5193 |
But only those matching filterBlock (if nonNil)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5194 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5195 |
|fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5196 |
|
4350 | 5197 |
fonts := self fontsInFamily:aFamilyName |
6296 | 5198 |
filtering:[:f| f face notNil and:[filterBlock isNil or:[filterBlock value:f]]]. |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5199 |
fonts size == 0 ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5200 |
|
3419
04d77587de17
Do not return font infos as sorted collections
Stefan Vogel <sv@exept.de>
parents:
3415
diff
changeset
|
5201 |
^ fonts collect:[:descr | descr face] |
293 | 5202 |
|
5203 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5204 |
Display facesInFamily:'fixed' filtering:[:f | |
6296 | 5205 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 5206 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5207 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5208 |
"Created: 27.2.1996 / 01:33:25 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5209 |
"Modified: 29.2.1996 / 04:29:01 / cg" |
293 | 5210 |
! |
5211 |
||
2220
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5212 |
flushListOfAvailableFonts |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5213 |
"flush any cached font information - dummy here, |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5214 |
but should be implemented in subclasses, which keep |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5215 |
a list of available device fonts. |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5216 |
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
|
5217 |
are installed or the system-font-path changes." |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5218 |
|
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5219 |
"Created: / 4.8.1998 / 16:52:13 / cg" |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5220 |
! |
0db8feaf7bcf
added #flushListOfAvailableFonts for protocol completeness.
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
5221 |
|
293 | 5222 |
fontFamilies |
5223 |
"return a set of all available font families on this display" |
|
5224 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5225 |
^ self fontFamiliesFiltering:nil |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5226 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5227 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5228 |
Display fontFamilies |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5229 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5230 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5231 |
"Modified: 27.2.1996 / 01:31:14 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5232 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5233 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5234 |
fontFamiliesFiltering:aFilterBlock |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5235 |
"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
|
5236 |
but only those matching aFilterBlock (if nonNil)." |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5237 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5238 |
|fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5239 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5240 |
fonts := self fontsFiltering:aFilterBlock. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5241 |
fonts size == 0 ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5242 |
|
3834 | 5243 |
^ fonts collect:[:descr | descr family] thenSelect:[:family | family notNil] |
293 | 5244 |
|
5245 |
" |
|
4350 | 5246 |
Display fontFamiliesFiltering:[:f | |
6296 | 5247 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 5248 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5249 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5250 |
"Modified: 29.2.1996 / 04:31:51 / cg" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5251 |
! |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5252 |
|
3478 | 5253 |
fontMetricsOf:fontId |
5254 |
"return a fonts metrics info object" |
|
5255 |
||
5256 |
|info| |
|
5257 |
||
5258 |
info := DeviceWorkstation::DeviceFontMetrics new. |
|
5259 |
info |
|
5260 |
ascent:(self ascentOf:fontId) |
|
5261 |
descent:(self descentOf:fontId) |
|
5262 |
maxAscent:(self maxAscentOf:fontId) |
|
5263 |
maxDescent:(self maxDescentOf:fontId) |
|
5264 |
minWidth:(self minWidthOfFont:fontId) |
|
5265 |
maxWidth:(self maxWidthOfFont:fontId) |
|
5266 |
avgWidth:(self widthOf:' ' inFont:fontId). |
|
5267 |
||
5268 |
^ info |
|
991 | 5269 |
! |
5270 |
||
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
5271 |
fontResolutionOf:fontId |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
5272 |
"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
|
5273 |
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
|
5274 |
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
|
5275 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
5276 |
^ self resolution |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
5277 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1044
diff
changeset
|
5278 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5279 |
fontsFiltering:aFilterBlock |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5280 |
"return a set of all available font on this display, |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5281 |
but only those matching aFilterBlock (if nonNil)." |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5282 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5283 |
|allFonts fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5284 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5285 |
allFonts := self listOfAvailableFonts. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5286 |
allFonts isNil ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5287 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5288 |
fonts := Set new. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5289 |
allFonts do:[:fntDescr | |
6296 | 5290 |
(aFilterBlock isNil or:[aFilterBlock value:fntDescr]) ifTrue:[ |
5291 |
fonts add:fntDescr |
|
5292 |
] |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5293 |
]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5294 |
^ fonts |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5295 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5296 |
" |
4350 | 5297 |
Display fontsFiltering:[:f | |
6296 | 5298 |
f encoding notNil and:[f encoding startsWith:'jis']] |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5299 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5300 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5301 |
"Modified: 29.2.1996 / 04:30:35 / cg" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5302 |
! |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5303 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5304 |
fontsInFamily:aFamilyName face:aFaceName filtering:filter |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5305 |
"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
|
5306 |
But only thise matching filter (if nonNil)." |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5307 |
|
3834 | 5308 |
^ self |
6296 | 5309 |
fontsFiltering:[:fntDescr | |
5310 |
(aFamilyName match:fntDescr family caseSensitive:false) |
|
5311 |
and:[ (aFaceName match:fntDescr face caseSensitive:false) |
|
5312 |
and:[ (filter isNil or:[filter value:fntDescr]) ]] |
|
5313 |
] |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5314 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5315 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5316 |
Display fontsInFamily:'fixed' face:'medium' filtering:[:f | |
6296 | 5317 |
f encoding notNil and:[f encoding startsWith:'jis']] |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5318 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5319 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5320 |
"Created: 29.2.1996 / 04:32:56 / cg" |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5321 |
"Modified: 30.6.1997 / 11:07:21 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5322 |
! |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5323 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5324 |
fontsInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5325 |
"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
|
5326 |
on this display. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5327 |
But only those matching filter (if nonNIl)." |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5328 |
|
3834 | 5329 |
^ self |
6296 | 5330 |
fontsFiltering:[:fntDescr | |
5331 |
(aFamilyName match:fntDescr family caseSensitive:false) |
|
5332 |
and:[ (aFaceName match:fntDescr face caseSensitive:false) |
|
5333 |
and:[ (aStyleName match:fntDescr style caseSensitive:false) |
|
5334 |
and:[ (filter isNil or:[filter value:fntDescr]) ]]] |
|
5335 |
] |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5336 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5337 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5338 |
Display fontsInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
6296 | 5339 |
f encoding notNil and:[f encoding startsWith:'jis']] |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5340 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5341 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5342 |
Display fontsInFamily:'fixed' face:'*' style:'roman' filtering:[:f | |
6296 | 5343 |
f encoding notNil and:[f encoding startsWith:'jis']] |
4088 | 5344 |
" |
5345 |
" |
|
5346 |
Display fontsInFamily:'courier' face:'medium' style:'roman' filtering:nil |
|
5347 |
Display fontsInFamily:'courier' face:'normal' style:'roman' filtering:nil |
|
5348 |
Display fontsInFamily:'Courier' face:'normal' style:'roman' filtering:nil |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5349 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5350 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5351 |
"Created: 29.2.1996 / 04:25:30 / cg" |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5352 |
"Modified: 30.6.1997 / 11:07:08 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5353 |
! |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5354 |
|
3834 | 5355 |
fontsInFamily:aFamilyName filtering:filter |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5356 |
"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
|
5357 |
But only those matching filterBlock (if nonNil)." |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5358 |
|
3834 | 5359 |
^ self |
6296 | 5360 |
fontsFiltering:[:fntDescr | |
5361 |
(aFamilyName match:fntDescr family caseSensitive:false) |
|
5362 |
and:[ (filter isNil or:[filter value:fntDescr]) ] |
|
5363 |
] |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5364 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5365 |
" |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5366 |
Display fontsInFamily:'fixed' filtering:[:f | |
6296 | 5367 |
f encoding notNil and:[f encoding startsWith:'jis']] |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5368 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5369 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5370 |
Display fontsInFamily:'*' filtering:[:f | |
6296 | 5371 |
f encoding notNil and:[f encoding startsWith:'jis']] |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5372 |
" |
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5373 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5374 |
"Created: 29.2.1996 / 04:27:49 / cg" |
1796
9384026b7b20
allow matchPattern in #fontsWithFamily:*
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
5375 |
"Modified: 30.6.1997 / 11:06:36 / cg" |
293 | 5376 |
! |
5377 |
||
3415
5318d7f58d35
Rename #fullNameOf: to #fullFontNameOf:
Stefan Vogel <sv@exept.de>
parents:
3413
diff
changeset
|
5378 |
fullFontNameOf:aFontId |
439
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5379 |
"return the full name of a font. |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5380 |
Here, we return nil, not knowing anything about fonts" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5381 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5382 |
^ nil |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5383 |
|
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5384 |
"Created: 23.2.1996 / 00:43:19 / cg" |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5385 |
! |
9948e62438f1
dummy font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
423
diff
changeset
|
5386 |
|
5909
c8177fd7a890
added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents:
5897
diff
changeset
|
5387 |
getDefaultFontWithEncoding:encoding |
4350 | 5388 |
"return a default font id |
5909
c8177fd7a890
added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents:
5897
diff
changeset
|
5389 |
- used when class Font cannot find anything usable. |
c8177fd7a890
added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents:
5897
diff
changeset
|
5390 |
Subclasses will redefine this." |
c8177fd7a890
added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents:
5897
diff
changeset
|
5391 |
|
c8177fd7a890
added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents:
5897
diff
changeset
|
5392 |
"For backward compatibility..." |
c8177fd7a890
added: #getDefaultFontWithEncoding:
Stefan Vogel <sv@exept.de>
parents:
5897
diff
changeset
|
5393 |
^ self getDefaultFont |
293 | 5394 |
! |
5395 |
||
5218
8f370f30a6e5
getFont...pixelSize... for backward compatibility
Claus Gittinger <cg@exept.de>
parents:
5217
diff
changeset
|
5396 |
getFontWithFamily:familyString face:faceString style:styleString pixelSize:sizeArg encoding:encodingSym |
8f370f30a6e5
getFont...pixelSize... for backward compatibility
Claus Gittinger <cg@exept.de>
parents:
5217
diff
changeset
|
5397 |
"try to get the specified font, return id. |
8f370f30a6e5
getFont...pixelSize... for backward compatibility
Claus Gittinger <cg@exept.de>
parents:
5217
diff
changeset
|
5398 |
If not available, try next smaller font. |
8f370f30a6e5
getFont...pixelSize... for backward compatibility
Claus Gittinger <cg@exept.de>
parents:
5217
diff
changeset
|
5399 |
If no font fits, return nil" |
8f370f30a6e5
getFont...pixelSize... for backward compatibility
Claus Gittinger <cg@exept.de>
parents:
5217
diff
changeset
|
5400 |
|
8f370f30a6e5
getFont...pixelSize... for backward compatibility
Claus Gittinger <cg@exept.de>
parents:
5217
diff
changeset
|
5401 |
"/ for backward comaptibility - will vanish |
5610 | 5402 |
^ self |
6296 | 5403 |
getFontWithFamily:familyString |
5404 |
face:faceString |
|
5405 |
style:styleString |
|
5406 |
size:sizeArg |
|
5407 |
sizeUnit:#px |
|
5408 |
encoding:encodingSym |
|
5218
8f370f30a6e5
getFont...pixelSize... for backward compatibility
Claus Gittinger <cg@exept.de>
parents:
5217
diff
changeset
|
5409 |
! |
8f370f30a6e5
getFont...pixelSize... for backward compatibility
Claus Gittinger <cg@exept.de>
parents:
5217
diff
changeset
|
5410 |
|
5187 | 5411 |
getFontWithFamily:familyString face:faceString style:styleString size:sizeArg encoding:encodingSym |
5162 | 5412 |
"try to get the specified font, return id. |
5413 |
If not available, try next smaller font. |
|
5414 |
If no font fits, return nil" |
|
5415 |
||
5610 | 5416 |
^ self |
6296 | 5417 |
getFontWithFamily:familyString |
5418 |
face:faceString |
|
5419 |
style:styleString |
|
5420 |
size:sizeArg |
|
5421 |
sizeUnit:#pt |
|
5422 |
encoding:encodingSym |
|
5162 | 5423 |
! |
5424 |
||
5187 | 5425 |
getFontWithFamily:familyString face:faceString style:styleString size:sizeArg sizeUnit:sizeUnit encoding:encodingSym |
293 | 5426 |
"try to get the specified font, return id. |
4350 | 5427 |
If not available, try next smaller font. |
293 | 5428 |
If no font fits, return nil" |
5429 |
||
5430 |
^ self subclassResponsibility |
|
5431 |
! |
|
5432 |
||
5980 | 5433 |
heightOf:aString from:index1 to:index2 inFont:aFontId |
5434 |
"return the width in pixels of a substring in a specific font" |
|
5435 |
||
5436 |
^ self subclassResponsibility |
|
5437 |
! |
|
5438 |
||
5439 |
heightOf:aString inFont:aFontId |
|
5440 |
"return the width in pixels of a string in a specific font" |
|
5441 |
||
5442 |
|sz| |
|
5443 |
||
5444 |
sz := aString size. |
|
5445 |
sz == 0 ifTrue:[ |
|
6296 | 5446 |
^ 0. |
5980 | 5447 |
]. |
5448 |
^ self heightOf:aString from:1 to:sz inFont:aFontId |
|
5449 |
! |
|
5450 |
||
293 | 5451 |
listOfAvailableFonts |
5452 |
"return a list containing all fonts on this display. |
|
5509
fe84ac005fbc
comment/format in: #listOfAvailableFonts
Stefan Vogel <sv@exept.de>
parents:
5339
diff
changeset
|
5453 |
The returned list is an array of FontDescriptions." |
293 | 5454 |
|
535 | 5455 |
^ self subclassResponsibility |
293 | 5456 |
! |
5457 |
||
5168 | 5458 |
pixelSizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filterBlock |
5459 |
"return a set of all available pixel sizes in aFamily/aFace/aStyle on this display. |
|
5460 |
But only those matching filterBlock (if notNil)." |
|
5461 |
||
5462 |
|fonts| |
|
5463 |
||
5610 | 5464 |
fonts := self |
6296 | 5465 |
fontsInFamily:aFamilyName face:aFaceName style:aStyleName |
5466 |
filtering:[:f | |
|
5467 |
f size notNil |
|
5468 |
and:[filterBlock isNil or:[filterBlock value:f]] |
|
5469 |
]. |
|
5168 | 5470 |
fonts size == 0 ifTrue:[^ nil]. |
5471 |
||
6103 | 5472 |
^ fonts collect:[:descr | descr pixelSize "height"] thenSelect:[:pixelSize| pixelSize notNil]. |
5168 | 5473 |
|
5474 |
" |
|
5610 | 5475 |
Display |
6296 | 5476 |
pixelSizesInFamily:'fixed' face:'medium' style:'roman' |
5477 |
filtering:[:f | |
|
5478 |
f encoding notNil and:[f encoding startsWith:'jis'] |
|
5479 |
] |
|
5610 | 5480 |
|
5481 |
Display |
|
6296 | 5482 |
pixelSizesInFamily:'arial' face:'medium' style:'roman' |
5483 |
filtering:[:f | |
|
5484 |
f encoding == #'ms-ansi' |
|
5485 |
] |
|
5168 | 5486 |
" |
5487 |
||
5488 |
"Created: 27.2.1996 / 01:37:56 / cg" |
|
5489 |
"Modified: 29.2.1996 / 04:26:52 / cg" |
|
5490 |
! |
|
5491 |
||
293 | 5492 |
releaseFont:aFontId |
5493 |
"free a font" |
|
5494 |
||
5495 |
^ self subclassResponsibility |
|
5496 |
! |
|
5497 |
||
5498 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName |
|
5499 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
|
5500 |
on this display" |
|
5501 |
||
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5502 |
^ 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
|
5503 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5504 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5505 |
Display sizesInFamily:'times' face:'medium' style:'italic' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5506 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5507 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5508 |
"Modified: 27.2.1996 / 01:38:42 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5509 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5510 |
|
3419
04d77587de17
Do not return font infos as sorted collections
Stefan Vogel <sv@exept.de>
parents:
3415
diff
changeset
|
5511 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filterBlock |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5512 |
"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
|
5513 |
on this display. |
3419
04d77587de17
Do not return font infos as sorted collections
Stefan Vogel <sv@exept.de>
parents:
3415
diff
changeset
|
5514 |
But only those matching filterBlock (if notNil)." |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5515 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5516 |
|fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5517 |
|
5610 | 5518 |
fonts := self |
6321 | 5519 |
fontsInFamily:aFamilyName face:aFaceName style:aStyleName |
5520 |
filtering:[:f | |
|
5521 |
(f size notNil or:[f isScaledFont]) |
|
5522 |
and:[filterBlock isNil or:[filterBlock value:f]] |
|
5523 |
]. |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5524 |
fonts size == 0 ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5525 |
|
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5526 |
^ fonts collect:[:descr | descr size]. |
293 | 5527 |
|
5528 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5529 |
Display sizesInFamily:'fixed' face:'medium' style:'roman' filtering:[:f | |
6321 | 5530 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 5531 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5532 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5533 |
"Created: 27.2.1996 / 01:37:56 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5534 |
"Modified: 29.2.1996 / 04:26:52 / cg" |
293 | 5535 |
! |
5536 |
||
5537 |
stylesInFamily:aFamilyName face:aFaceName |
|
5538 |
"return a set of all available font styles in aFamily/aFace on this display" |
|
5539 |
||
4350 | 5540 |
^ self stylesInFamily:aFamilyName face:aFaceName filtering:nil |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5541 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5542 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5543 |
Display stylesInFamily:'times' face:'medium' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5544 |
Display stylesInFamily:'times' face:'bold' |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5545 |
" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5546 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5547 |
"Modified: 27.2.1996 / 01:35:43 / cg" |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5548 |
! |
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5549 |
|
3419
04d77587de17
Do not return font infos as sorted collections
Stefan Vogel <sv@exept.de>
parents:
3415
diff
changeset
|
5550 |
stylesInFamily:aFamilyName face:aFaceName filtering:filterBlock |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5551 |
"return a set of all available font styles in aFamily/aFace on this display. |
3419
04d77587de17
Do not return font infos as sorted collections
Stefan Vogel <sv@exept.de>
parents:
3415
diff
changeset
|
5552 |
But only thise matching filterBlock (if notNil)." |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5553 |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5554 |
|fonts| |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5555 |
|
4350 | 5556 |
fonts := self |
6296 | 5557 |
fontsInFamily:aFamilyName face:aFaceName |
5558 |
filtering:[:f| |
|
5559 |
f style notNil |
|
5560 |
and:[filterBlock isNil or:[filterBlock value:f]] |
|
5561 |
]. |
|
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5562 |
fonts size == 0 ifTrue:[^ nil]. |
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5563 |
|
3419
04d77587de17
Do not return font infos as sorted collections
Stefan Vogel <sv@exept.de>
parents:
3415
diff
changeset
|
5564 |
^ fonts collect:[:descr | descr style] |
293 | 5565 |
|
5566 |
" |
|
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5567 |
Display stylesInFamily:'fixed' face:'medium' filtering:[:f | |
6296 | 5568 |
f encoding notNil and:[f encoding startsWith:'jis']] |
293 | 5569 |
" |
465
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5570 |
|
731d2d077883
added filter for font-extraction methods
Claus Gittinger <cg@exept.de>
parents:
439
diff
changeset
|
5571 |
"Created: 27.2.1996 / 01:35:22 / cg" |
479
a1ec90f1dc5c
more & better fontSelection stuff
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
5572 |
"Modified: 29.2.1996 / 04:33:59 / cg" |
293 | 5573 |
! |
5574 |
||
5575 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
|
5576 |
"return the width in pixels of a substring in a specific font" |
|
5577 |
||
5578 |
^ self subclassResponsibility |
|
5579 |
! |
|
5580 |
||
5581 |
widthOf:aString inFont:aFontId |
|
5582 |
"return the width in pixels of a string in a specific font" |
|
5583 |
||
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1011
diff
changeset
|
5584 |
^ self widthOf:aString from:1 to:(aString size) inFont:aFontId |
293 | 5585 |
! ! |
5586 |
||
3177 | 5587 |
!DeviceWorkstation methodsFor:'grabbing'! |
293 | 5588 |
|
5589 |
activeKeyboardGrab |
|
5590 |
"return the view, which currently has the keyboard grabbed, |
|
5591 |
or nil, if there is none" |
|
5592 |
||
5593 |
^ activeKeyboardGrab |
|
5594 |
! |
|
5595 |
||
5596 |
activePointerGrab |
|
5597 |
"return the view, which currently has the pointer grabbed, |
|
5598 |
or nil, if there is none" |
|
5599 |
||
5600 |
^ activePointerGrab |
|
5601 |
! |
|
5602 |
||
5603 |
grabKeyboardIn:aWindowId |
|
5604 |
"grab the keyboard - all keyboard input will be sent to the view |
|
5605 |
with id aWindowId" |
|
5606 |
||
5607 |
^ self subclassResponsibility |
|
5608 |
! |
|
5609 |
||
5610 |
grabKeyboardInView:aView |
|
5611 |
"grab the keyboard - all keyboard input will be sent to aView. |
|
5612 |
Return true if ok, false if it failed for some reason." |
|
5613 |
||
5614 |
activeKeyboardGrab notNil ifTrue:[ |
|
6296 | 5615 |
self ungrabKeyboard. |
5616 |
activeKeyboardGrab := nil |
|
293 | 5617 |
]. |
5618 |
(self grabKeyboardIn:(aView id)) ifTrue:[ |
|
6296 | 5619 |
activeKeyboardGrab := aView. |
5620 |
^ true |
|
293 | 5621 |
]. |
5622 |
^ false |
|
5623 |
! |
|
5624 |
||
5625 |
grabPointerIn:aWindowId |
|
5626 |
"grap the pointer; all pointer events will be reported to the view |
|
5627 |
with id aWindowId. Return true if ok, false if it failed for some reason." |
|
5628 |
||
5629 |
^ self grabPointerIn:aWindowId withCursor:nil pointerMode:#async keyboardMode:#sync confineTo:nil |
|
5630 |
! |
|
5631 |
||
5632 |
grabPointerIn:aWindowId withCursor:cursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
|
5633 |
"grap the pointer - all pointer events will be reported to aWindowId. The cursor will be set to cursorId |
|
5634 |
for the duration of the grab. For pMode/kMode, see X documentation. The pointer is restricted to |
|
5635 |
confineId - if non-nil." |
|
5636 |
||
5637 |
^ self subclassResponsibility |
|
5638 |
! |
|
5639 |
||
3091 | 5640 |
grabPointerIn:aWindowId withCursorId:aCursorIdOrNil |
5641 |
"grap the pointer; all pointer events will be reported to the view |
|
5642 |
with id aWindowId. Return true if ok, false if it failed for some reason." |
|
5643 |
||
5644 |
^ self grabPointerIn:aWindowId withCursor:aCursorIdOrNil pointerMode:#async keyboardMode:#sync confineTo:nil |
|
5645 |
! |
|
5646 |
||
293 | 5647 |
grabPointerInView:aView |
5648 |
"grap the pointer; all pointer events will be reported to |
|
5649 |
aView. Return true if ok, false if it failed for some reason." |
|
5650 |
||
3694 | 5651 |
^ self grabPointerInView:aView withCursor:nil |
5652 |
! |
|
5653 |
||
5654 |
grabPointerInView:aView withCursor:aCursorOrNil |
|
3091 | 5655 |
"grap the pointer; all pointer events will be reported to |
5656 |
aView. Return true if ok, false if it failed for some reason." |
|
5657 |
||
3694 | 5658 |
|cId vId ok| |
3091 | 5659 |
|
5660 |
activePointerGrab notNil ifTrue:[ |
|
6296 | 5661 |
self ungrabPointer. |
5662 |
activePointerGrab := nil |
|
3694 | 5663 |
]. |
5664 |
vId := aView id. |
|
5665 |
aCursorOrNil notNil ifTrue:[ |
|
6296 | 5666 |
cId := aCursorOrNil id. |
5667 |
ok := self grabPointerIn:vId withCursorId:cId. |
|
3694 | 5668 |
] ifFalse:[ |
6296 | 5669 |
ok := self grabPointerIn:vId. |
3694 | 5670 |
]. |
5671 |
||
5672 |
ok ifTrue:[ |
|
6296 | 5673 |
activePointerGrab := aView. |
5674 |
^ true |
|
3091 | 5675 |
]. |
5676 |
^ false |
|
5677 |
! |
|
5678 |
||
293 | 5679 |
setActivePointerGrab:aView |
5680 |
"DO NOT USE. private kludge - will vanish" |
|
5681 |
||
5682 |
activePointerGrab := aView |
|
5683 |
! |
|
5684 |
||
5685 |
ungrabKeyboard |
|
5686 |
"release the keyboard" |
|
5687 |
||
5688 |
^ self subclassResponsibility |
|
5689 |
! |
|
5690 |
||
5691 |
ungrabPointer |
|
5692 |
"release the pointer" |
|
5693 |
||
5694 |
^ self subclassResponsibility |
|
5695 |
! ! |
|
5696 |
||
5697 |
!DeviceWorkstation methodsFor:'graphic context stuff'! |
|
5698 |
||
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
5699 |
noClipIn:aDrawableId gc:aGCId |
293 | 5700 |
"disable clipping rectangle" |
5701 |
||
5702 |
^ self subclassResponsibility |
|
5703 |
! |
|
5704 |
||
5705 |
setBackground:bgColorIndex in:aGCId |
|
3528 | 5706 |
"set background color-index to be drawn with" |
293 | 5707 |
|
5708 |
^ self subclassResponsibility |
|
5709 |
! |
|
5710 |
||
3597
322d40d45f02
fix #setForegroundColor: ans setBackgroundColor: for non-device colors
Stefan Vogel <sv@exept.de>
parents:
3572
diff
changeset
|
5711 |
setBackgroundColor:color in:aGCId |
3528 | 5712 |
"set background color to be drawn with" |
5713 |
||
5714 |
|colorId deviceColor| |
|
5715 |
||
3597
322d40d45f02
fix #setForegroundColor: ans setBackgroundColor: for non-device colors
Stefan Vogel <sv@exept.de>
parents:
3572
diff
changeset
|
5716 |
(color isOnDevice:self) ifTrue:[ |
6296 | 5717 |
colorId := color colorId. |
3597
322d40d45f02
fix #setForegroundColor: ans setBackgroundColor: for non-device colors
Stefan Vogel <sv@exept.de>
parents:
3572
diff
changeset
|
5718 |
] ifFalse:[ |
6296 | 5719 |
deviceColor := color onDevice:self. |
5720 |
deviceColor notNil ifTrue:[ |
|
5721 |
colorId := deviceColor colorId. |
|
5722 |
] |
|
3528 | 5723 |
]. |
5724 |
colorId isNil ifTrue:[ |
|
6296 | 5725 |
'DeviceWorkstation [warning]: could not set bg color' infoPrintCR. |
3528 | 5726 |
] ifFalse:[ |
6296 | 5727 |
self setBackground:colorId in:aGCId. |
3528 | 5728 |
] |
5729 |
! |
|
5730 |
||
293 | 5731 |
setBitmapMask:aBitmapId in:aGCId |
5732 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
|
5733 |
||
5734 |
^ self subclassResponsibility |
|
5735 |
! |
|
5736 |
||
1682 | 5737 |
setClipByChildren:aBool in:aDrawableID gc:aGCId |
293 | 5738 |
"enable/disable drawing into child views" |
5739 |
||
5740 |
^ self subclassResponsibility |
|
5741 |
! |
|
5742 |
||
1710
df5f8609825d
win changes (pass drawableId to clip methods)
Claus Gittinger <cg@exept.de>
parents:
1708
diff
changeset
|
5743 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:drawableId gc:aGCId |
293 | 5744 |
"clip to a rectangle" |
5745 |
||
5746 |
^ self subclassResponsibility |
|
5747 |
! |
|
5748 |
||
787 | 5749 |
setDashes:dashList dashOffset:offset in:aGCId |
5750 |
"set dash attributes. |
|
5751 |
Ignored here - it may be left unimplemented by some devices." |
|
5752 |
||
5753 |
^ self subclassResponsibility |
|
5754 |
||
5755 |
"Created: 4.6.1996 / 18:50:38 / cg" |
|
5756 |
"Modified: 4.6.1996 / 19:05:22 / cg" |
|
5757 |
! |
|
5758 |
||
293 | 5759 |
setFont:aFontId in:aGCId |
5760 |
"set font to be drawn in" |
|
5761 |
||
5762 |
^ self subclassResponsibility |
|
5763 |
! |
|
5764 |
||
5765 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
|
3528 | 5766 |
"set foreground and background color-indices to be drawn with" |
5767 |
||
5768 |
self setForeground:fgColorIndex in:aGCId. |
|
5769 |
self setBackground:bgColorIndex in:aGCId. |
|
293 | 5770 |
! |
5771 |
||
5772 |
setForeground:fgColorIndex in:aGCId |
|
3528 | 5773 |
"set the foreground color-index to be drawn with" |
293 | 5774 |
|
5775 |
^ self subclassResponsibility |
|
5776 |
! |
|
5777 |
||
3528 | 5778 |
setForegroundColor:fgColor backgroundColor:bgColor in:aGCId |
5779 |
"set foreground and background colors to be drawn with" |
|
5780 |
||
5781 |
self setForegroundColor:fgColor in:aGCId. |
|
5782 |
self setBackgroundColor:bgColor in:aGCId. |
|
5783 |
! |
|
5784 |
||
3597
322d40d45f02
fix #setForegroundColor: ans setBackgroundColor: for non-device colors
Stefan Vogel <sv@exept.de>
parents:
3572
diff
changeset
|
5785 |
setForegroundColor:color in:aGCId |
3528 | 5786 |
"set the foreground color to be drawn with" |
5787 |
||
5788 |
|colorId deviceColor| |
|
5789 |
||
3597
322d40d45f02
fix #setForegroundColor: ans setBackgroundColor: for non-device colors
Stefan Vogel <sv@exept.de>
parents:
3572
diff
changeset
|
5790 |
(color isOnDevice:self) ifTrue:[ |
6296 | 5791 |
colorId := color colorId. |
3597
322d40d45f02
fix #setForegroundColor: ans setBackgroundColor: for non-device colors
Stefan Vogel <sv@exept.de>
parents:
3572
diff
changeset
|
5792 |
] ifFalse:[ |
6296 | 5793 |
deviceColor := color onDevice:self. |
5794 |
deviceColor notNil ifTrue:[ |
|
5795 |
colorId := deviceColor colorId. |
|
5796 |
] |
|
3528 | 5797 |
]. |
5798 |
colorId isNil ifTrue:[ |
|
6296 | 5799 |
'DeviceWorkstation [warning]: could not set fg color' infoPrintCR. |
3528 | 5800 |
] ifFalse:[ |
6296 | 5801 |
self setForeground:colorId in:aGCId. |
3528 | 5802 |
] |
5803 |
! |
|
5804 |
||
293 | 5805 |
setFunction:aFunctionSymbol in:aGCId |
5806 |
"set alu function to be drawn with" |
|
5807 |
||
5808 |
^ self subclassResponsibility |
|
5809 |
! |
|
5810 |
||
5811 |
setGraphicsExposures:aBoolean in:aGCId |
|
5812 |
"set or clear the graphics exposures flag" |
|
5813 |
||
5814 |
^ self subclassResponsibility |
|
5815 |
! |
|
5816 |
||
5817 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
|
5818 |
"set line attributes" |
|
5819 |
||
5820 |
^ self subclassResponsibility |
|
5821 |
! |
|
5822 |
||
5823 |
setMaskOriginX:orgX y:orgY in:aGCid |
|
5824 |
"set the mask origin" |
|
5825 |
||
5826 |
^ self subclassResponsibility |
|
5827 |
! |
|
5828 |
||
5829 |
setPixmapMask:aPixmapId in:aGCId |
|
5830 |
"set or clear the drawing mask - a pixmap mask providing full color" |
|
5831 |
||
5832 |
^ self subclassResponsibility |
|
5833 |
! ! |
|
5834 |
||
5632 | 5835 |
!DeviceWorkstation methodsFor:'hooks'! |
5836 |
||
5837 |
addModalWindowListener:aListener |
|
5838 |
aboutToOpenModalWindowHooks isNil ifTrue:[ |
|
6296 | 5839 |
aboutToOpenModalWindowHooks := IdentitySet new. |
5632 | 5840 |
]. |
5841 |
aboutToOpenModalWindowHooks add:aListener |
|
5842 |
||
5843 |
"Created: / 24-10-2010 / 14:57:39 / cg" |
|
5844 |
! |
|
5845 |
||
5846 |
addNonModalWindowListener:aListener |
|
5847 |
aboutToOpenNonModalWindowHooks isNil ifTrue:[ |
|
6296 | 5848 |
aboutToOpenNonModalWindowHooks := IdentitySet new. |
5632 | 5849 |
]. |
5850 |
aboutToOpenNonModalWindowHooks add:aListener |
|
5851 |
||
5852 |
"Created: / 24-10-2010 / 14:58:13 / cg" |
|
5853 |
! |
|
5854 |
||
5855 |
addSelectionHandler:someone |
|
5856 |
"ignored here" |
|
5857 |
! |
|
5858 |
||
5859 |
modalWindowListenersDo:aBlock |
|
5860 |
aboutToOpenModalWindowHooks notNil ifTrue:[ |
|
6296 | 5861 |
aboutToOpenModalWindowHooks do:aBlock |
5632 | 5862 |
]. |
5863 |
||
5634 | 5864 |
" |
5865 |
aboutToOpenModalWindowHooks := nil |
|
5866 |
" |
|
5867 |
||
5632 | 5868 |
"Created: / 24-10-2010 / 14:58:40 / cg" |
5869 |
! |
|
5870 |
||
5871 |
nonModalWindowListenersDo:aBlock |
|
5872 |
aboutToOpenNonModalWindowHooks notNil ifTrue:[ |
|
6296 | 5873 |
aboutToOpenNonModalWindowHooks do:aBlock |
5632 | 5874 |
]. |
5875 |
||
5876 |
"Created: / 24-10-2010 / 14:58:43 / cg" |
|
5877 |
! |
|
5878 |
||
5879 |
removeModalWindowListener:aListener |
|
5633 | 5880 |
aboutToOpenModalWindowHooks notNil ifTrue:[ |
6296 | 5881 |
aboutToOpenModalWindowHooks remove:aListener ifAbsent:[]. |
5882 |
aboutToOpenModalWindowHooks := aboutToOpenModalWindowHooks asNilIfEmpty. |
|
5633 | 5883 |
] |
5632 | 5884 |
|
5885 |
"Created: / 24-10-2010 / 14:58:02 / cg" |
|
5886 |
! |
|
5887 |
||
5888 |
removeNonModalWindowListener:aListener |
|
5633 | 5889 |
aboutToOpenNonModalWindowHooks notNil ifTrue:[ |
6296 | 5890 |
aboutToOpenNonModalWindowHooks remove:aListener ifAbsent:[]. |
5891 |
aboutToOpenNonModalWindowHooks := aboutToOpenNonModalWindowHooks asNilIfEmpty. |
|
5633 | 5892 |
] |
5632 | 5893 |
|
5894 |
"Created: / 24-10-2010 / 14:58:19 / cg" |
|
5895 |
! |
|
5896 |
||
5897 |
removeSelectionHandler:someone |
|
5898 |
"ignored here" |
|
6285 | 5899 |
! |
5900 |
||
5901 |
withoutExitingOnLastCloseDo:aBlock |
|
5902 |
"evaluate a block, but do not exit when the last view is closed. |
|
5903 |
This is used when an operation is to be performed, which possibly |
|
5904 |
leads to a temporary no-more-windows-open situation. |
|
5905 |
Concrete: when reopening a launcher" |
|
5906 |
||
5907 |
|sav| |
|
5908 |
||
5909 |
sav := exitOnLastClose. |
|
5910 |
exitOnLastClose := false. |
|
5911 |
aBlock ensure:[ exitOnLastClose := sav ]. |
|
5632 | 5912 |
! ! |
5913 |
||
3883 | 5914 |
!DeviceWorkstation methodsFor:'initialization & release'! |
0 | 5915 |
|
1973 | 5916 |
brokenConnection |
5917 |
"the connection to the display device was lost." |
|
5918 |
||
3770 | 5919 |
dispatching ifTrue:[ |
6296 | 5920 |
'DeviceWorkstation [info]: finished dispatch (broken connection): ' infoPrint. |
5921 |
self infoPrintCR. |
|
5922 |
dispatching := false. |
|
3770 | 5923 |
]. |
3208 | 5924 |
self emergencyCloseConnection. |
1973 | 5925 |
displayId := nil. |
5926 |
||
2924
9b42e9bafdf7
Forget about cached Displays (cg)
Stefan Vogel <sv@exept.de>
parents:
2922
diff
changeset
|
5927 |
LastActiveScreen == self ifTrue:[ |
6296 | 5928 |
LastActiveScreen := nil. |
5929 |
LastActiveProcess := nil. |
|
4641
448cfd73ba35
Release applicatons when top views are closed.
Stefan Vogel <sv@exept.de>
parents:
4639
diff
changeset
|
5930 |
]. |
448cfd73ba35
Release applicatons when top views are closed.
Stefan Vogel <sv@exept.de>
parents:
4639
diff
changeset
|
5931 |
|
448cfd73ba35
Release applicatons when top views are closed.
Stefan Vogel <sv@exept.de>
parents:
4639
diff
changeset
|
5932 |
"/ tell all of my top views about this. |
448cfd73ba35
Release applicatons when top views are closed.
Stefan Vogel <sv@exept.de>
parents:
4639
diff
changeset
|
5933 |
|
448cfd73ba35
Release applicatons when top views are closed.
Stefan Vogel <sv@exept.de>
parents:
4639
diff
changeset
|
5934 |
self allTopViews do:[:eachTopView | |
6296 | 5935 |
|wg sensor model| |
5936 |
||
5937 |
"notice: we must manually wakeup the windowGroup process here |
|
5938 |
(it might be waiting on an event, |
|
5939 |
and the destroy below is executed by another thread. |
|
5940 |
Otherwise, the windowGroup process would |
|
5941 |
not terminate itself in this case." |
|
5942 |
||
5943 |
(wg := eachTopView windowGroup) notNil ifTrue:[ |
|
5944 |
sensor := wg sensor |
|
5945 |
]. |
|
5946 |
eachTopView destroyed. |
|
5947 |
||
5948 |
"the #destroyed above should release the application model - but is doesn't |
|
5949 |
yet (2006-10) - so we do it here" |
|
5950 |
model := eachTopView model. |
|
5951 |
model notNil ifTrue:[ |
|
5952 |
model release. |
|
5953 |
]. |
|
5954 |
sensor notNil ifTrue:[ |
|
5955 |
sensor eventSemaphore signal. |
|
5956 |
]. |
|
1973 | 5957 |
]. |
5958 |
||
5959 |
self releaseDeviceResources. |
|
5960 |
||
3148
909a1c3c2953
brokenConnection: wakeup the wGroup process to allow it detecting
Claus Gittinger <cg@exept.de>
parents:
3147
diff
changeset
|
5961 |
"Modified: / 19.1.2000 / 10:36:02 / cg" |
1973 | 5962 |
! |
5963 |
||
293 | 5964 |
close |
3555
6ff09db833b0
terminate event process, when closed.
Claus Gittinger <cg@exept.de>
parents:
3529
diff
changeset
|
5965 |
"close down connection to Display - usually never done for the main screen" |
293 | 5966 |
|
1196 | 5967 |
self releaseDeviceResources. |
1194
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
5968 |
self closeConnection. |
3770 | 5969 |
dispatching ifTrue:[ |
6296 | 5970 |
'DeviceWorkstation [info]: finished dispatch (close): ' infoPrint. |
5971 |
self infoPrintCR. |
|
5972 |
dispatching := false. |
|
3770 | 5973 |
]. |
3565 | 5974 |
dispatchProcess notNil ifTrue:[ |
6296 | 5975 |
dispatchProcess terminate. |
3565 | 5976 |
]. |
1194
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
5977 |
|
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
5978 |
"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
|
5979 |
! |
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
5980 |
|
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
5981 |
closeConnection |
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
5982 |
"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
|
5983 |
|
293 | 5984 |
^ self subclassResponsibility |
1194
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
5985 |
|
b38e3cbe03b2
splitted close into #closeConnection and resource releasing #close.
Claus Gittinger <cg@exept.de>
parents:
1192
diff
changeset
|
5986 |
"Created: 13.1.1997 / 22:10:07 / cg" |
293 | 5987 |
! |
5988 |
||
3014 | 5989 |
emergencyCloseConnection |
5990 |
"close down connection to the Display in case of emergency; |
|
5991 |
this is usually invoked after an error and should not try to flush |
|
5992 |
any outstanding graphics requests - usually never done" |
|
5993 |
||
5994 |
^ self close |
|
5995 |
||
5996 |
"Created: 13.1.1997 / 22:10:07 / cg" |
|
5997 |
! |
|
5998 |
||
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
5999 |
exitOnLastClose:aBoolean |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
6000 |
"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
|
6001 |
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
|
6002 |
|
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
6003 |
self == Display ifTrue:[ |
6296 | 6004 |
ExitOnLastClose := aBoolean |
6005 |
]. |
|
6006 |
exitOnLastClose := aBoolean. |
|
2818
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
6007 |
|
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
6008 |
"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
|
6009 |
! |
d5453b85243d
added an exitOnLastClose instVar flag. (smc requirement)
Claus Gittinger <cg@exept.de>
parents:
2793
diff
changeset
|
6010 |
|
3831 | 6011 |
initializeDefaultKeyboardMappingsIn:aKeyboardMap |
6012 |
aKeyboardMap bindValue:#Copy to:#Cmdc. "copy selection to buffer" |
|
6013 |
aKeyboardMap bindValue:#Cut to:#Cmdx. "cut selection into buffer" |
|
6014 |
aKeyboardMap bindValue:#Paste to:#Cmdv. "paste buffer or external selection" |
|
6015 |
||
6016 |
aKeyboardMap bindValue:#UserInterrupt to:#Ctrlc. "interrupt window process" |
|
6017 |
! |
|
6018 |
||
2861
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6019 |
initializeDefaultValues |
2866 | 6020 |
isSlow := false. |
6021 |
motionEventCompression := true. |
|
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6022 |
buttonTranslation isNil ifTrue:[ |
6296 | 6023 |
buttonTranslation := ButtonTranslation. |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6024 |
]. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6025 |
multiClickTimeDelta isNil ifTrue:[ |
6296 | 6026 |
multiClickTimeDelta := MultiClickTimeDelta. |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6027 |
]. |
2867 | 6028 |
shiftDown := false. |
6029 |
ctrlDown := false. |
|
6030 |
metaDown := false. |
|
6031 |
altDown := false. |
|
6032 |
||
2861
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6033 |
self initializeModifierMappings |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6034 |
! |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6035 |
|
1196 | 6036 |
initializeDeviceResources |
6037 |
"initialize heavily used device resources - to avoid looking them up later" |
|
6038 |
||
1623 | 6039 |
blackColor isNil ifTrue:[ |
6296 | 6040 |
blackColor := Color black onDevice:self. |
6041 |
whiteColor := Color white onDevice:self. |
|
6042 |
Color getPrimaryColorsOn:self. |
|
1623 | 6043 |
] |
1369 | 6044 |
|
6045 |
"Modified: 24.2.1997 / 22:07:50 / cg" |
|
1196 | 6046 |
! |
6047 |
||
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6048 |
initializeDeviceSignals |
2983 | 6049 |
deviceErrorSignal := DeviceErrorSignal newSignal. |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6050 |
deviceErrorSignal nameClass:self message:#deviceErrorSignal. |
2983 | 6051 |
deviceIOErrorSignal := DeviceIOErrorSignal newSignal. |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6052 |
deviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6053 |
! |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
6054 |
|
0 | 6055 |
initializeFor:aDisplayOrNilForAny |
6056 |
"initialize the receiver for a connection to a display. If the |
|
6057 |
argument is non-nil, it should specify which workstation should be |
|
6058 |
connected to (in a device specific manner). For X displays, this is |
|
6059 |
to be the display-string i.e. hostname:displayNr. |
|
6060 |
If the argument is nil, connect to the default display." |
|
6061 |
||
71 | 6062 |
^ self subclassResponsibility |
0 | 6063 |
! |
6064 |
||
293 | 6065 |
initializeKeyboardMap |
6066 |
"keystrokes from the server are translated via the keyboard map. |
|
6067 |
Untranslated keystrokes arrive either as characters, or symbols |
|
6068 |
(which are the keySyms as symbol). The mapping table which is |
|
6069 |
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
|
6070 |
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
|
6071 |
this is usually filled via the keyboard.rc startup file. |
293 | 6072 |
" |
6073 |
||
6074 |
keyboardMap isNil ifTrue:[ |
|
6296 | 6075 |
keyboardMap := KeyboardMap new. |
6076 |
self initializeDefaultKeyboardMappingsIn:keyboardMap |
|
293 | 6077 |
]. |
6078 |
||
6079 |
" |
|
6080 |
no more setup here - moved everything out into 'display.rc' file |
|
6081 |
" |
|
0 | 6082 |
! |
6083 |
||
2861
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6084 |
initializeModifierMappings |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6085 |
shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil. |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6086 |
|
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6087 |
shiftModifiers := #(Shift_L Shift_R Shift). |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6088 |
ctrlModifiers := #(Control_L Control_R Control). |
4400 | 6089 |
metaModifiers := #(Meta_L Meta_R Meta). |
6090 |
altModifiers := #(Alt_L Alt_R Alt). |
|
6091 |
||
6092 |
" |
|
6093 |
Display initializeModifierMappings |
|
6094 |
" |
|
2861
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6095 |
! |
098094668b4b
moved some init stuff from XWorkstat to here
Claus Gittinger <cg@exept.de>
parents:
2859
diff
changeset
|
6096 |
|
814 | 6097 |
initializeScreenProperties |
6098 |
"setup screen specific properties." |
|
6099 |
||
885
07df2e77a8fe
dont clobber the supportsDeepIcons flag
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
6100 |
supportsDeepIcons isNil ifTrue:[ |
6296 | 6101 |
supportsDeepIcons := true. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
6102 |
]. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
6103 |
|
1768 | 6104 |
fixColors := fixGrayColors := ditherColors := nil. |
937
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
6105 |
numFixRed := numFixGreen := numFixBlue := 0. |
e4db13d571c0
fixColor and ditherColor stuff moved from Color
Claus Gittinger <cg@exept.de>
parents:
934
diff
changeset
|
6106 |
|
4795
e3a73ffce640
default widthMM and heightMM
Claus Gittinger <cg@exept.de>
parents:
4779
diff
changeset
|
6107 |
widthMM := 320. |
e3a73ffce640
default widthMM and heightMM
Claus Gittinger <cg@exept.de>
parents:
4779
diff
changeset
|
6108 |
heightMM := 240. |
e3a73ffce640
default widthMM and heightMM
Claus Gittinger <cg@exept.de>
parents:
4779
diff
changeset
|
6109 |
|
e3a73ffce640
default widthMM and heightMM
Claus Gittinger <cg@exept.de>
parents:
4779
diff
changeset
|
6110 |
"Modified: / 23-07-2007 / 21:19:57 / cg" |
814 | 6111 |
! |
6112 |
||
2997 | 6113 |
initializeViewStyle |
6114 |
"late viewStyle init - if no viewStyle has been read yet." |
|
6115 |
||
5592 | 6116 |
self class currentScreenQuerySignal answer:self do:[ |
6296 | 6117 |
SimpleView styleSheet isNil ifTrue:[ |
6118 |
SimpleView readStyleSheetAndUpdateAllStyleCaches |
|
6119 |
] ifFalse:[ |
|
6120 |
"maybe some view classes have been loaded and theit styles have to |
|
6121 |
be initialized" |
|
6122 |
SimpleView updateAllStyleCaches. |
|
6123 |
]. |
|
2997 | 6124 |
]. |
6125 |
! |
|
6126 |
||
276
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
6127 |
invalidateConnection |
609 | 6128 |
"clear my connection handle - sent after an imageRestart to |
6129 |
forget about our previous life" |
|
6130 |
||
276
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
6131 |
displayId := nil |
609 | 6132 |
|
6133 |
"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
|
6134 |
! |
160e1410c537
entry to invalidate display connection during early initialization
Claus Gittinger <cg@exept.de>
parents:
261
diff
changeset
|
6135 |
|
0 | 6136 |
reinitialize |
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6137 |
"historic leftover (old subclasses call super reinitialize)" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6138 |
! |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6139 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6140 |
reinitializeFor:aDisplayName |
0 | 6141 |
"reinit after snapin" |
6142 |
||
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6143 |
|prevKnownViews "prevMapping" prevWidth prevHeight| |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6144 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6145 |
"do subclass specific reinitialization" |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6146 |
self reinitialize. |
0 | 6147 |
|
3239 | 6148 |
blackColor notNil ifTrue:[ |
6296 | 6149 |
blackColor releaseFromDevice. |
3239 | 6150 |
]. |
6151 |
whiteColor notNil ifTrue:[ |
|
6296 | 6152 |
whiteColor releaseFromDevice. |
3239 | 6153 |
]. |
2846 | 6154 |
self releaseDeviceFonts. |
2845 | 6155 |
self releaseDeviceCursors. |
6156 |
self releaseDeviceColors. |
|
414
bf996c417cc8
flush device fonts early; allow selective flushing; catch errors during reinitialize of views
Claus Gittinger <cg@exept.de>
parents:
405
diff
changeset
|
6157 |
|
0 | 6158 |
displayId := nil. |
51 | 6159 |
dispatching := false. |
151 | 6160 |
dispatchProcess := nil. |
46 | 6161 |
|
505
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
6162 |
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
|
6163 |
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
|
6164 |
|
46 | 6165 |
"/ prevMapping := idToViewMapping. |
6166 |
"/ idToViewMapping := nil. |
|
6167 |
||
0 | 6168 |
prevKnownViews := knownViews. |
2403 | 6169 |
idToTableIndexMapping := nil. |
0 | 6170 |
knownViews := nil. |
6171 |
knownIds := nil. |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6172 |
lastId := nil. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
6173 |
lastView := nil. |
0 | 6174 |
|
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3602
diff
changeset
|
6175 |
self initializeFor:aDisplayName. |
899
fda82596dea6
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
6176 |
displayId isNil ifTrue:[ |
6296 | 6177 |
^ nil |
899
fda82596dea6
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
885
diff
changeset
|
6178 |
]. |
0 | 6179 |
|
43 | 6180 |
" |
6181 |
first, all Forms must be recreated |
|
51 | 6182 |
(since they may be needed for view recreation as |
43 | 6183 |
background or icons) |
6184 |
" |
|
0 | 6185 |
Form reinitializeAllOn:self. |
6186 |
||
46 | 6187 |
"/ prevMapping notNil ifTrue:[ |
0 | 6188 |
prevKnownViews notNil ifTrue:[ |
6296 | 6189 |
" |
6190 |
first round: flush all device specific stuff |
|
6191 |
" |
|
51 | 6192 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
6296 | 6193 |
prevKnownViews do:[:aView | |
6194 |
(aView notNil and:[aView ~~ 0]) ifTrue:[ |
|
6195 |
aView prepareForReinit |
|
6196 |
] |
|
6197 |
]. |
|
6198 |
||
6199 |
" |
|
6200 |
2nd round: all views should reinstall themself |
|
6201 |
on the new display |
|
6202 |
" |
|
51 | 6203 |
"/ 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
|
6204 |
|
6296 | 6205 |
prevKnownViews do:[:aView | |
6206 |
(aView notNil and:[aView ~~ 0]) ifTrue:[ |
|
6207 |
"have to re-create the view" |
|
6208 |
"abortAll is handled, but not asked for here!!" |
|
6209 |
(UserInterrupt, AbortAllOperationRequest) catch:[ |
|
6210 |
GraphicsContext drawingOnClosedDrawableSignal handle:[:ex | |
|
6211 |
'DeviceWorkstation [warning]: drawing attempt on closed drawable during reinit' errorPrintCR. |
|
6212 |
ex return |
|
6213 |
] do:[ |
|
6214 |
aView reinitialize |
|
6215 |
] |
|
6216 |
] |
|
6217 |
] |
|
6218 |
]. |
|
6219 |
||
6220 |
(prevWidth ~~ width |
|
6221 |
or:[prevHeight ~~ height]) ifTrue:[ |
|
6222 |
" |
|
6223 |
3rd round: all views get a chance to handle |
|
6224 |
changed environment (colors, font sizes etc) |
|
6225 |
" |
|
505
f939ab04e30c
only adjust geometry of views at restart if the displays dimension has changed
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
6226 |
"/ prevMapping keysAndValuesDo:[:anId :aView | |
6296 | 6227 |
prevKnownViews do:[:aView | |
6228 |
(aView notNil and:[aView ~~ 0]) ifTrue:[ |
|
6229 |
aView reAdjustGeometry |
|
6230 |
] |
|
6231 |
]. |
|
6232 |
] |
|
0 | 6233 |
]. |
8 | 6234 |
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
|
6235 |
|
5715 | 6236 |
"Modified: / 09-02-2011 / 13:59:53 / cg" |
1196 | 6237 |
! |
6238 |
||
6239 |
releaseDeviceResources |
|
2837 | 6240 |
"release any cached device resources. |
6241 |
This is invoked when closed or when the display connection is broken |
|
6242 |
(i.e. be prepared to not be able to release resources regularily)" |
|
6243 |
||
4218
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
6244 |
LastActiveScreen == self ifTrue:[ |
6296 | 6245 |
LastActiveScreen := nil. |
6246 |
LastActiveProcess := nil. |
|
4218
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
6247 |
]. |
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
6248 |
|
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
6249 |
Image releaseResourcesOnDevice:self. |
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
6250 |
"This unregisters all the finalization handles" |
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
6251 |
DeviceGraphicsContext releaseResourcesOnDevice:self. |
3121 | 6252 |
blackColor notNil ifTrue:[ |
6296 | 6253 |
blackColor releaseFromDevice. |
6254 |
blackColor := nil. |
|
3121 | 6255 |
]. |
6256 |
whiteColor notNil ifTrue:[ |
|
6296 | 6257 |
whiteColor releaseFromDevice. |
6258 |
whiteColor := nil. |
|
4218
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
6259 |
]. |
2837 | 6260 |
self releaseDeviceColors. |
2843
e13e0c53924a
keep registry of cursors here - no longer use a Cursor Lobby
Claus Gittinger <cg@exept.de>
parents:
2838
diff
changeset
|
6261 |
self releaseDeviceCursors. |
2846 | 6262 |
self releaseDeviceFonts. |
1225
797de68f0760
release deviceResources when closing a connection
Claus Gittinger <cg@exept.de>
parents:
1219
diff
changeset
|
6263 |
|
2837 | 6264 |
focusView := activeView := rootView := lastView := nil. |
6265 |
activeKeyboardGrab := activePointerGrab := nil. |
|
6266 |
AllScreens remove:self ifAbsent:nil. |
|
6267 |
||
1231 | 6268 |
"Modified: 16.1.1997 / 19:34:11 / cg" |
133 | 6269 |
! ! |
6270 |
||
71 | 6271 |
!DeviceWorkstation methodsFor:'interactive queries'! |
6272 |
||
1843 | 6273 |
colorFromUser |
6274 |
"{ Pragma: +optSpace }" |
|
6275 |
||
6276 |
"let user specify a point on the screen (by pressing the left button), |
|
6277 |
return the color of that pixel." |
|
6278 |
||
1973 | 6279 |
|p| |
1843 | 6280 |
|
6281 |
p := self pointFromUser. |
|
4350 | 6282 |
^ self rootView colorAt:p |
1843 | 6283 |
|
6284 |
" |
|
6285 |
Display colorFromUser |
|
6286 |
" |
|
6287 |
||
6288 |
"Modified: 1.8.1997 / 20:00:41 / cg" |
|
6289 |
! |
|
6290 |
||
293 | 6291 |
originFromUser:extent |
1198 | 6292 |
"{ Pragma: +optSpace }" |
6293 |
||
293 | 6294 |
"let user specify a rectangles origin on the screen, return the rectangle. |
4350 | 6295 |
Start with initialRectangle. |
293 | 6296 |
Can be used for dragging operations." |
6297 |
||
3091 | 6298 |
|curs origin root rect prevGrab| |
293 | 6299 |
|
1499 | 6300 |
curs := Cursor origin onDevice:self. |
293 | 6301 |
|
6302 |
" |
|
6303 |
just in case; wait for button to be down ... |
|
6304 |
" |
|
2252 | 6305 |
[self leftButtonPressed] whileFalse:[Delay waitForSeconds:0.05]. |
293 | 6306 |
|
6307 |
root := self rootView. |
|
6308 |
||
6309 |
" |
|
6310 |
grab and wait for leftButton being pressed |
|
6311 |
" |
|
6312 |
origin := self pointerPosition. |
|
6313 |
||
1722 | 6314 |
root clippedByChildren:false. |
1198 | 6315 |
root foreground:blackColor background:whiteColor. |
293 | 6316 |
|
6317 |
root xoring:[ |
|
6296 | 6318 |
|left right top bottom newOrigin newCorner p| |
6319 |
||
6320 |
rect := origin extent:extent. |
|
6321 |
root displayRectangle:rect. |
|
6322 |
||
6323 |
prevGrab := activePointerGrab. |
|
6324 |
self grabPointerInView:root withCursor:curs. |
|
6325 |
||
6326 |
[self leftButtonPressed] whileTrue:[ |
|
6327 |
newOrigin := self pointerPosition. |
|
6328 |
||
6329 |
(newOrigin ~= origin) ifTrue:[ |
|
6330 |
root displayRectangle:rect. |
|
6331 |
||
6332 |
self |
|
6333 |
grabPointerIn:root id |
|
6334 |
withCursor:curs id |
|
6335 |
pointerMode:#async |
|
6336 |
keyboardMode:#sync |
|
6337 |
confineTo:nil. |
|
6338 |
||
6339 |
rect := newOrigin extent:extent. |
|
6340 |
root displayRectangle:rect. |
|
6341 |
self disposeButtonEventsFor:nil. |
|
6342 |
self flush. |
|
6343 |
origin := newOrigin. |
|
6344 |
] ifFalse:[ |
|
6345 |
Delay waitForSeconds:0.05 |
|
6346 |
] |
|
6347 |
]. |
|
6348 |
root displayRectangle:rect. |
|
293 | 6349 |
]. |
6350 |
||
6351 |
self ungrabPointer. |
|
3091 | 6352 |
prevGrab notNil ifTrue:[ |
6296 | 6353 |
self grabPointerInView:prevGrab. |
3091 | 6354 |
]. |
293 | 6355 |
|
6356 |
"flush all events pending on my display" |
|
6357 |
||
1722 | 6358 |
root clippedByChildren:true. |
293 | 6359 |
|
6360 |
self flush. |
|
6361 |
self disposeButtonEventsFor:nil. |
|
6362 |
||
6363 |
^ rect |
|
6364 |
||
6365 |
" |
|
6366 |
Display originFromUser:200@200 |
|
6367 |
" |
|
1198 | 6368 |
|
2252 | 6369 |
"Modified: / 18.8.1998 / 15:00:14 / cg" |
293 | 6370 |
! |
6371 |
||
6372 |
pointFromUser |
|
1198 | 6373 |
"{ Pragma: +optSpace }" |
6374 |
||
293 | 6375 |
"let user specify a point on the screen (by pressing the left button)" |
6376 |
||
6377 |
^ self pointFromUserShowing:(Cursor crossHair). |
|
6378 |
||
6379 |
" |
|
6380 |
Display pointFromUser |
|
6381 |
" |
|
1198 | 6382 |
|
6383 |
"Modified: 13.1.1997 / 22:53:05 / cg" |
|
293 | 6384 |
! |
6385 |
||
81 | 6386 |
pointFromUserShowing:aCursor |
1198 | 6387 |
"{ Pragma: +optSpace }" |
6388 |
||
81 | 6389 |
"let user specify a point on the screen (by pressing leftButton). |
6390 |
Show aCursor while waiting." |
|
6391 |
||
4895 | 6392 |
^ self |
6296 | 6393 |
pointFromUserShowing:aCursor |
6394 |
positionFeedback:nil |
|
4895 | 6395 |
|
6396 |
" |
|
6397 |
Display pointFromUserShowing:(Cursor stop) |
|
6398 |
Display pointFromUserShowing:(Cursor crossHair) |
|
6399 |
Display pointFromUserShowing:(Cursor origin) |
|
6400 |
Display pointFromUser |
|
6401 |
" |
|
6402 |
||
6403 |
"Modified: / 18.8.1998 / 15:00:19 / cg" |
|
6404 |
! |
|
6405 |
||
6406 |
pointFromUserShowing:aCursor positionFeedback:feedbackBlockOrNil |
|
6407 |
"{ Pragma: +optSpace }" |
|
6408 |
||
6409 |
"let user specify a point on the screen (by pressing leftButton). |
|
6075 | 6410 |
Show aCursor while waiting. Pressing shift or ctrl cancels the operation, |
6411 |
and aborts" |
|
4895 | 6412 |
|
6168 | 6413 |
|p prevGrab prevKbdGrab| |
3091 | 6414 |
|
6415 |
prevGrab := activePointerGrab. |
|
6168 | 6416 |
prevKbdGrab := activeKeyboardGrab. |
6417 |
||
23 | 6418 |
self ungrabPointer. |
3091 | 6419 |
self grabPointerInView:(self rootView) withCursor:(aCursor onDevice:self). |
5714
0d3832fcb39e
changed: #pointFromUserShowing:positionFeedback:
Claus Gittinger <cg@exept.de>
parents:
5638
diff
changeset
|
6420 |
|
0d3832fcb39e
changed: #pointFromUserShowing:positionFeedback:
Claus Gittinger <cg@exept.de>
parents:
5638
diff
changeset
|
6421 |
" |
0d3832fcb39e
changed: #pointFromUserShowing:positionFeedback:
Claus Gittinger <cg@exept.de>
parents:
5638
diff
changeset
|
6422 |
wait for no leftButton... |
0d3832fcb39e
changed: #pointFromUserShowing:positionFeedback:
Claus Gittinger <cg@exept.de>
parents:
5638
diff
changeset
|
6423 |
" |
0d3832fcb39e
changed: #pointFromUserShowing:positionFeedback:
Claus Gittinger <cg@exept.de>
parents:
5638
diff
changeset
|
6424 |
[self leftButtonPressed] whileTrue:[ |
6296 | 6425 |
Delay waitForSeconds:0.05. |
5714
0d3832fcb39e
changed: #pointFromUserShowing:positionFeedback:
Claus Gittinger <cg@exept.de>
parents:
5638
diff
changeset
|
6426 |
]. |
0d3832fcb39e
changed: #pointFromUserShowing:positionFeedback:
Claus Gittinger <cg@exept.de>
parents:
5638
diff
changeset
|
6427 |
|
5336
f2f56441b54c
ensure that the grab is released when unwinding from
Claus Gittinger <cg@exept.de>
parents:
5259
diff
changeset
|
6428 |
[ |
6296 | 6429 |
self grabKeyboardInView:(self rootView). |
6430 |
||
6431 |
" |
|
6432 |
wait for leftButton... |
|
6433 |
ctrl, shift or escape terminate that operation |
|
6434 |
" |
|
6435 |
[self leftButtonPressed] whileFalse:[ |
|
6436 |
(self ctrlDown or:[self shiftDown or:[activePointerGrab == nil]]) ifTrue:[ |
|
6437 |
AbortOperationRequest raise. |
|
6438 |
^ nil |
|
6439 |
]. |
|
6440 |
feedbackBlockOrNil notNil ifTrue:[ |
|
6441 |
feedbackBlockOrNil value:(self pointerPosition) |
|
6442 |
]. |
|
6443 |
Delay waitForSeconds:0.05. |
|
6444 |
]. |
|
6445 |
||
6446 |
p := self pointerPosition. |
|
5336
f2f56441b54c
ensure that the grab is released when unwinding from
Claus Gittinger <cg@exept.de>
parents:
5259
diff
changeset
|
6447 |
] ensure:[ |
6296 | 6448 |
self ungrabKeyboard. |
6449 |
prevKbdGrab notNil ifTrue:[ |
|
6450 |
self grabKeyboardInView:prevKbdGrab |
|
6451 |
]. |
|
6452 |
self ungrabPointer. |
|
6453 |
prevGrab notNil ifTrue:[ |
|
6454 |
self grabPointerInView:prevGrab |
|
6455 |
]. |
|
6456 |
"flush all events pending on myself" |
|
6457 |
self disposeButtonEventsFor:nil. |
|
5336
f2f56441b54c
ensure that the grab is released when unwinding from
Claus Gittinger <cg@exept.de>
parents:
5259
diff
changeset
|
6458 |
]. |
f2f56441b54c
ensure that the grab is released when unwinding from
Claus Gittinger <cg@exept.de>
parents:
5259
diff
changeset
|
6459 |
|
23 | 6460 |
^ p |
6461 |
||
71 | 6462 |
" |
4350 | 6463 |
Display pointFromUserShowing:(Cursor stop) |
6464 |
Display pointFromUserShowing:(Cursor crossHair) |
|
6465 |
Display pointFromUserShowing:(Cursor origin) |
|
81 | 6466 |
Display pointFromUser |
6467 |
" |
|
1198 | 6468 |
|
5714
0d3832fcb39e
changed: #pointFromUserShowing:positionFeedback:
Claus Gittinger <cg@exept.de>
parents:
5638
diff
changeset
|
6469 |
"Modified: / 08-02-2011 / 21:48:08 / cg" |
81 | 6470 |
! |
6471 |
||
293 | 6472 |
rectangleFromUser |
1198 | 6473 |
"{ Pragma: +optSpace }" |
6474 |
||
6168 | 6475 |
"let user specify a rectangle in the screen, return the rectangle. |
6476 |
If the user presses ESC, an AbortSignal is raised." |
|
293 | 6477 |
|
6478 |
|origin| |
|
81 | 6479 |
|
6480 |
" |
|
293 | 6481 |
get origin |
6482 |
" |
|
1499 | 6483 |
origin := self pointFromUserShowing:(Cursor origin onDevice:self). |
293 | 6484 |
|
6485 |
" |
|
6486 |
get corner |
|
6487 |
" |
|
4350 | 6488 |
^ self rectangleFromUser:(origin corner:origin). |
6489 |
||
6490 |
" |
|
6491 |
Display rectangleFromUser |
|
71 | 6492 |
" |
1198 | 6493 |
|
1499 | 6494 |
"Modified: 28.3.1997 / 16:14:44 / cg" |
23 | 6495 |
! |
6496 |
||
81 | 6497 |
rectangleFromUser:initialRectangle |
1198 | 6498 |
"{ Pragma: +optSpace }" |
6499 |
||
81 | 6500 |
"let user specify a rectangle on the screen, return the rectangle. |
4350 | 6501 |
Start with initialRectangle. |
133 | 6502 |
A helper for rectangleFromUser; can also be used for resizing operations." |
81 | 6503 |
|
1824 | 6504 |
^ self rectangleFromUser:initialRectangle keepExtent:false |
6505 |
||
6506 |
" |
|
6507 |
Display rectangleFromUser:(100@100 corner:300@300) |
|
6508 |
" |
|
6509 |
||
6510 |
"Modified: 24.7.1997 / 16:04:54 / cg" |
|
6511 |
! |
|
6512 |
||
6513 |
rectangleFromUser:initialRectangle keepExtent:keepExtent |
|
6514 |
"{ Pragma: +optSpace }" |
|
6515 |
||
6516 |
"let user specify a rectangle on the screen, return the rectangle. |
|
4350 | 6517 |
Start with initialRectangle. |
1824 | 6518 |
A helper for rectangleFromUser; can also be used for resizing operations." |
6519 |
||
3091 | 6520 |
|curs1 origin corner root rect doRegrab prevGrab| |
2324
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
6521 |
|
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
6522 |
"/ 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
|
6523 |
"/ 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
|
6524 |
"/ on windows displays. |
a50065345df3
do not regrab under win32, when dragging a rectangleFromUser
Claus Gittinger <cg@exept.de>
parents:
2308
diff
changeset
|
6525 |
doRegrab := self class ~~ WinWorkstation. |
157 | 6526 |
|
1824 | 6527 |
keepExtent ifTrue:[ |
6296 | 6528 |
curs1 := Cursor origin |
4350 | 6529 |
] ifFalse:[ |
6296 | 6530 |
curs1 := Cursor corner |
1824 | 6531 |
]. |
6532 |
curs1 := curs1 onDevice:self. |
|
134 | 6533 |
root := self rootView. |
81 | 6534 |
|
6535 |
" |
|
6536 |
grab and wait for leftButton being pressed |
|
6537 |
" |
|
6538 |
origin := initialRectangle origin. |
|
6539 |
||
1722 | 6540 |
root clippedByChildren:false. |
1198 | 6541 |
root foreground:blackColor background:whiteColor. |
81 | 6542 |
|
6543 |
root xoring:[ |
|
6296 | 6544 |
|left right top bottom newOrigin newCorner p curs| |
6545 |
||
6546 |
keepExtent ifFalse:[ |
|
6547 |
corner := origin. |
|
6548 |
rect := origin corner:corner. |
|
6549 |
root displayRectangle:rect. |
|
6550 |
]. |
|
6551 |
||
6552 |
prevGrab := activePointerGrab. |
|
6553 |
self grabPointerInView:root withCursor:curs1. |
|
6554 |
||
6555 |
" |
|
6556 |
just in case; wait for button to be down ... |
|
6557 |
" |
|
6558 |
[self leftButtonPressed] whileFalse:[Delay waitForSeconds:0.05]. |
|
6559 |
||
6560 |
keepExtent ifTrue:[ |
|
6561 |
p := self pointerPosition. |
|
6562 |
origin := p. |
|
6563 |
corner := origin + initialRectangle extent. |
|
6564 |
rect := origin corner:corner. |
|
6565 |
root displayRectangle:rect. |
|
6566 |
]. |
|
6567 |
||
6568 |
[self leftButtonPressed] whileTrue:[ |
|
6569 |
left := initialRectangle origin x. |
|
6570 |
top := initialRectangle origin y. |
|
6571 |
right := initialRectangle corner x. |
|
6572 |
bottom := initialRectangle corner y. |
|
6573 |
||
6574 |
p := self pointerPosition. |
|
6575 |
keepExtent ifTrue:[ |
|
6576 |
newOrigin := p. |
|
6577 |
newCorner := newOrigin + initialRectangle extent. |
|
6578 |
curs := curs1. |
|
6579 |
] ifFalse:[ |
|
6580 |
p x < initialRectangle left ifTrue:[ |
|
6581 |
p y < initialRectangle top ifTrue:[ |
|
6582 |
curs := Cursor topLeft. |
|
6583 |
left := p x. |
|
6584 |
top := p y. |
|
6585 |
] ifFalse:[ |
|
6586 |
curs := Cursor bottomLeft. |
|
6587 |
left := p x. |
|
6588 |
bottom := p y |
|
6589 |
] |
|
6590 |
] ifFalse:[ |
|
6591 |
p y < initialRectangle top ifTrue:[ |
|
6592 |
curs := Cursor topRight. |
|
6593 |
right := p x. |
|
6594 |
top := p y |
|
6595 |
] ifFalse:[ |
|
6596 |
curs := Cursor bottomRight. |
|
6597 |
right := p x. |
|
6598 |
bottom := p y |
|
6599 |
] |
|
6600 |
]. |
|
6601 |
||
6602 |
newOrigin := left @ top. |
|
6603 |
newCorner := right @ bottom. |
|
6604 |
]. |
|
6605 |
||
6606 |
((newOrigin ~= origin) or:[newCorner ~= corner]) ifTrue:[ |
|
6607 |
root displayRectangle:rect. |
|
6608 |
doRegrab ifTrue:[ |
|
6609 |
self grabPointerInView:root withCursor:curs1. |
|
6610 |
]. |
|
6611 |
||
6612 |
origin := newOrigin. |
|
6613 |
corner := newCorner. |
|
6614 |
rect := origin corner:corner. |
|
6615 |
root displayRectangle:rect. |
|
6616 |
self disposeButtonEventsFor:nil. |
|
6617 |
self flush. |
|
6618 |
] ifFalse:[ |
|
6619 |
Delay waitForSeconds:0.05 |
|
6620 |
] |
|
6621 |
]. |
|
6622 |
root displayRectangle:rect. |
|
23 | 6623 |
]. |
6624 |
||
3091 | 6625 |
|
23 | 6626 |
self ungrabPointer. |
3091 | 6627 |
prevGrab notNil ifTrue:[ |
6296 | 6628 |
self grabPointerInView:prevGrab |
3091 | 6629 |
]. |
23 | 6630 |
|
6631 |
"flush all events pending on my display" |
|
81 | 6632 |
|
1722 | 6633 |
root clippedByChildren:true. |
81 | 6634 |
|
151 | 6635 |
self flush. |
81 | 6636 |
self disposeButtonEventsFor:nil. |
6637 |
||
6638 |
^ rect |
|
157 | 6639 |
|
6640 |
" |
|
1824 | 6641 |
Display rectangleFromUser |
157 | 6642 |
Display rectangleFromUser:(100@100 corner:300@300) |
1824 | 6643 |
Display rectangleFromUser:(100@100 corner:300@300) keepExtent:true |
6644 |
" |
|
6645 |
||
2252 | 6646 |
"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
|
6647 |
"Modified: / 10.9.1998 / 17:38:41 / cg" |
81 | 6648 |
! |
6649 |
||
293 | 6650 |
topviewFromUser |
1198 | 6651 |
"{ Pragma: +optSpace }" |
6652 |
||
293 | 6653 |
"let user specify a view on the screen; if the selected view is |
6654 |
not an ST/X view, nil is returned. |
|
6655 |
Otherwise, the topview is returned." |
|
6656 |
||
6657 |
|v| |
|
6658 |
||
6659 |
v := self viewFromUser. |
|
6660 |
v notNil ifTrue:[ |
|
6296 | 6661 |
v := v topView |
293 | 6662 |
]. |
4350 | 6663 |
^ v |
157 | 6664 |
|
6665 |
" |
|
293 | 6666 |
Display topviewFromUser |
157 | 6667 |
" |
1198 | 6668 |
|
6669 |
"Modified: 13.1.1997 / 22:53:15 / cg" |
|
190 | 6670 |
! |
6671 |
||
23 | 6672 |
viewFromUser |
1198 | 6673 |
"{ Pragma: +optSpace }" |
6674 |
||
23 | 6675 |
"let user specify a view on the screen; if the selected view is |
133 | 6676 |
not an ST/X view, nil is returned. |
6677 |
This returns the view being clicked in, which is not always a topView. |
|
6678 |
(send topView to the returned view or use topviewFromUser, |
|
6679 |
to get the topview)" |
|
23 | 6680 |
|
4350 | 6681 |
^ self viewFromPoint:(self pointFromUser) |
6682 |
||
6683 |
" |
|
6684 |
Display viewFromUser |
|
71 | 6685 |
" |
6686 |
" |
|
6687 |
|v| |
|
6688 |
v := Display viewFromUser. |
|
6689 |
v notNil ifTrue:[v topView] ifFalse:[nil] |
|
6690 |
" |
|
1198 | 6691 |
|
6692 |
"Modified: 13.1.1997 / 22:53:17 / cg" |
|
71 | 6693 |
! |
6694 |
||
293 | 6695 |
viewIdFromUser |
1198 | 6696 |
"{ Pragma: +optSpace }" |
6697 |
||
293 | 6698 |
"let user specify a view on the screen, return its window id. |
6699 |
This works even for non smalltalk views. |
|
4350 | 6700 |
This returns the id of the view being clicked in, |
293 | 6701 |
which is not always a topView." |
6702 |
||
4350 | 6703 |
^ self viewIdFromPoint:(self pointFromUser) |
6704 |
||
6705 |
" |
|
6706 |
Display viewIdFromUser |
|
71 | 6707 |
" |
293 | 6708 |
|
6709 |
"Created: 18.9.1995 / 23:07:20 / claus" |
|
1198 | 6710 |
"Modified: 13.1.1997 / 22:53:20 / cg" |
0 | 6711 |
! ! |
6712 |
||
6713 |
!DeviceWorkstation methodsFor:'keyboard mapping'! |
|
6714 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6715 |
altModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6716 |
"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
|
6717 |
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
|
6718 |
are alt-keys." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6719 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6720 |
^ altModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6721 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6722 |
" |
4350 | 6723 |
Display altModifiers |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6724 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6725 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6726 |
"Created: 2.1.1996 / 14:57:13 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6727 |
"Modified: 2.1.1996 / 15:01:54 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6728 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6729 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6730 |
altModifiers:arrayOfAltModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6731 |
"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
|
6732 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6733 |
altModifiers := arrayOfAltModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6734 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6735 |
"Created: 2.1.1996 / 14:58:24 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6736 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6737 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6738 |
metaModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6739 |
"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
|
6740 |
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
|
6741 |
are meta-keys." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6742 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6743 |
^ metaModifiers |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6744 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6745 |
" |
4350 | 6746 |
Display metaModifiers |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6747 |
" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6748 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6749 |
"Created: 2.1.1996 / 14:57:35 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6750 |
"Modified: 2.1.1996 / 15:02:00 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6751 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6752 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6753 |
metaModifiers:arrayOfMetaModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6754 |
"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
|
6755 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6756 |
metaModifiers := arrayOfMetaModifierKeys |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6757 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6758 |
"Created: 2.1.1996 / 14:58:41 / cg" |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6759 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6760 |
|
293 | 6761 |
modifierKeyProcessing:key down:pressed |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6762 |
"internal, private method. |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6763 |
Called with every keyPress/keyRelease to update the xxxDown flags." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6764 |
|
293 | 6765 |
(altModifiers notNil and:[altModifiers includes:key]) ifTrue:[ |
6296 | 6766 |
altDown := pressed |
293 | 6767 |
] ifFalse:[ |
6296 | 6768 |
(metaModifiers notNil and:[metaModifiers includes:key]) ifTrue:[ |
6769 |
metaDown := pressed |
|
6770 |
] ifFalse:[ |
|
6771 |
(shiftModifiers notNil and:[shiftModifiers includes:key]) ifTrue:[ |
|
6772 |
shiftDown := pressed |
|
6773 |
] ifFalse:[ |
|
6774 |
(ctrlModifiers notNil and:[ctrlModifiers includes:key]) ifTrue:[ |
|
6775 |
ctrlDown := pressed |
|
6776 |
] |
|
6777 |
] |
|
6778 |
] |
|
293 | 6779 |
] |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6780 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6781 |
"Modified: 2.1.1996 / 15:00:25 / cg" |
293 | 6782 |
! |
6783 |
||
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6784 |
modifierKeyTopFor:key |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6785 |
"reverse translation for a modifier key |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6786 |
(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
|
6787 |
|
532 | 6788 |
|t modifiers| |
6789 |
||
6790 |
key == #Alt ifTrue:[ |
|
6296 | 6791 |
modifiers := altModifiers |
532 | 6792 |
] ifFalse:[ |
6296 | 6793 |
key == #Cmd ifTrue:[ |
6794 |
modifiers := metaModifiers |
|
6795 |
] |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6796 |
]. |
2053 | 6797 |
|
6798 |
"/ temporary kludge ... |
|
532 | 6799 |
(modifiers size > 0) ifTrue:[ |
6296 | 6800 |
(modifiers includes:'Num_Lock') ifTrue:[ |
6801 |
modifiers := modifiers copyWithout:'Num_Lock' |
|
6802 |
] |
|
2053 | 6803 |
]. |
6804 |
||
6805 |
(modifiers size > 0) ifTrue:[ |
|
6296 | 6806 |
t := modifiers first. |
6807 |
(t includes:$_) ifTrue:[ |
|
6808 |
t := t copyTo:(t indexOf:$_)-1 |
|
6809 |
]. |
|
6810 |
^ t |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6811 |
]. |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6812 |
^ key |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6813 |
|
2053 | 6814 |
"Created: / 28.2.1996 / 17:07:08 / cg" |
6815 |
"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
|
6816 |
! |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6817 |
|
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6818 |
modifierKeyTranslationFor:untranslatedKey |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6819 |
"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
|
6820 |
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
|
6821 |
|
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6822 |
"should this come from a configurable variable ?" |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6823 |
|
1022 | 6824 |
"/ the next statement will vanish .... |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6825 |
(untranslatedKey == #Control |
4350 | 6826 |
or:[untranslatedKey == #'Control_L' |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6827 |
or:[untranslatedKey == #'Control_R']]) ifTrue:[ |
6296 | 6828 |
^ #Ctrl |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6829 |
]. |
1022 | 6830 |
|
6831 |
(untranslatedKey == #Ctrl |
|
4350 | 6832 |
or:[untranslatedKey == #'Ctrl_L' |
1022 | 6833 |
or:[untranslatedKey == #'Ctrl_R']]) ifTrue:[ |
6296 | 6834 |
^ #Ctrl |
1022 | 6835 |
]. |
4350 | 6836 |
(untranslatedKey == #'Shift' |
6837 |
or:[untranslatedKey == #'Shift_L' |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6838 |
or:[untranslatedKey == #'Shift_R']]) ifTrue:[ |
6296 | 6839 |
^ #Shift |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6840 |
]. |
4350 | 6841 |
(untranslatedKey == #'Alt' |
6842 |
or:[untranslatedKey == #'Alt_L' |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6843 |
or:[untranslatedKey == #'Alt_R']]) ifTrue:[ |
6296 | 6844 |
^ #Alt |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6845 |
]. |
4350 | 6846 |
(untranslatedKey == #'Meta' |
6847 |
or:[untranslatedKey == #'Meta_L' |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6848 |
or:[untranslatedKey == #'Meta_R']]) ifTrue:[ |
6296 | 6849 |
^ #Meta |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6850 |
]. |
4350 | 6851 |
(untranslatedKey == #'Cmd' |
6852 |
or:[untranslatedKey == #'Cmd_L' |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6853 |
or:[untranslatedKey == #'Cmd_R']]) ifTrue:[ |
6296 | 6854 |
^ #Cmd |
4070 | 6855 |
]. |
4350 | 6856 |
(untranslatedKey == #'Super' |
6857 |
or:[untranslatedKey == #'Super_L' |
|
4070 | 6858 |
or:[untranslatedKey == #'Super_R']]) ifTrue:[ |
6296 | 6859 |
^ #Super |
4485 | 6860 |
]. |
4944
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6861 |
|
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6862 |
"/ I know - this is stupid; however the tradition was Cmd for this... |
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6863 |
(untranslatedKey == #'Menu' |
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6864 |
or:[untranslatedKey == #'Menu_L' |
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6865 |
or:[untranslatedKey == #'Menu_R']]) ifTrue:[ |
6296 | 6866 |
^ #Cmd |
4944
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6867 |
]. |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6868 |
^ nil |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6869 |
|
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6870 |
"Created: 28.2.1996 / 16:40:46 / cg" |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6871 |
"Modified: 28.2.1996 / 17:11:34 / cg" |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6872 |
! |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6873 |
|
6146 | 6874 |
modifierKeys |
6875 |
"a list of possible modifiers" |
|
6876 |
||
6877 |
^ #( #Control #'Control_L' #'Control_R' |
|
6296 | 6878 |
#Ctrl #'Ctrl_L' #'Ctrl_R' |
6879 |
#'Shift' #'Shift_L' #'Shift_R' |
|
6880 |
#'Alt' #'Alt_L' #'Alt_R' |
|
6881 |
#'Meta' #'Meta_L' #'Meta_R' |
|
6882 |
#'Cmd' #'Cmd_L' #'Cmd_R' |
|
6883 |
#'Super' #'Super_L' #'Super_R' |
|
6884 |
#'Menu' #'Menu_L' #'Menu_R' |
|
6146 | 6885 |
) |
6886 |
! |
|
6887 |
||
3236 | 6888 |
prependModifierToKey:untranslatedKey |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6889 |
|xlatedKey s modifier| |
51 | 6890 |
|
5917
d5b5e701a6e8
changed: #prependModifierToKey:
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
6891 |
(ctrlDown and:[ metaDown ]) ifTrue:[ |
6296 | 6892 |
"/ right-ALT: already xlated (I hope) |
6893 |
^ untranslatedKey |
|
6011
5f2245003b40
semaphore bug workaround - temporary
Claus Gittinger <cg@exept.de>
parents:
6006
diff
changeset
|
6894 |
]. |
5f2245003b40
semaphore bug workaround - temporary
Claus Gittinger <cg@exept.de>
parents:
6006
diff
changeset
|
6895 |
|
5f2245003b40
semaphore bug workaround - temporary
Claus Gittinger <cg@exept.de>
parents:
6006
diff
changeset
|
6896 |
xlatedKey := untranslatedKey. |
3323 | 6897 |
xlatedKey isCharacter ifFalse:[ |
6296 | 6898 |
xlatedKey := xlatedKey asSymbol |
3323 | 6899 |
]. |
145 | 6900 |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6901 |
modifier := self modifierKeyTranslationFor:untranslatedKey. |
4944
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6902 |
"/ Transcript show: 'untranslatedKey: ' ; showCR: untranslatedKey storeString. |
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6903 |
"/ Transcript show: 'modifier: ' ; showCR: modifier storeString. |
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6904 |
"/ 'untranslatedKey: ' print. untranslatedKey storeString printCR. |
f843d2c7946e
correct translation of Alt-key
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6905 |
"/ 'modifier: ' print. modifier storeString printCR. |
4070 | 6906 |
|
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6907 |
"/ |
4485 | 6908 |
"/ only prepend, if this is not a modifier (otherwise, we get CmdCmd or CtrlCtrl) |
473
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6909 |
"/ |
e954ce348a47
added protocol for reverse modifier mappings
Claus Gittinger <cg@exept.de>
parents:
465
diff
changeset
|
6910 |
modifier isNil ifTrue:[ |
6296 | 6911 |
s := xlatedKey asString. |
6912 |
||
6913 |
"/ NO, do not prepend the Shift modifier. |
|
6914 |
"/ although logical, this makes many keyPress methods incompatible. |
|
6915 |
"/ sigh. |
|
4485 | 6916 |
"/ xlatedKey isSymbol ifTrue:[ |
6917 |
"/ shiftDown ifTrue:[ |
|
6918 |
"/ xlatedKey := 'Shift' , s |
|
6919 |
"/ ]. |
|
6920 |
"/ ]. |
|
6296 | 6921 |
ctrlDown ifTrue:[ |
6922 |
xlatedKey := 'Ctrl' , s |
|
6923 |
]. |
|
6924 |
metaDown ifTrue:[ "/ sigh - new hp's have both CMD and META keys. |
|
6925 |
xlatedKey := 'Cmd' , s |
|
6926 |
]. |
|
6927 |
altDown ifTrue:[ |
|
6928 |
xlatedKey := 'Alt' , s |
|
6929 |
]. |
|
6930 |
xlatedKey isCharacter ifFalse:[ |
|
6931 |
"/ no - breaks a lot of code which is not prepared for that |
|
6932 |
"/ and checks shiftDown instead... |
|
6933 |
"/ shiftDown ifTrue:[ |
|
6934 |
"/ xlatedKey := 'Shift' , s |
|
6935 |
"/]. |
|
6936 |
||
6937 |
"/ sigh: twoByteSymbols are not (yet) allowed |
|
6938 |
xlatedKey isWideString ifFalse:[ |
|
6939 |
xlatedKey := xlatedKey asSymbol |
|
6940 |
]. |
|
6941 |
]. |
|
51 | 6942 |
]. |
6943 |
||
3236 | 6944 |
^ xlatedKey |
5828
b77d25ec29ad
comment/format in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
5778
diff
changeset
|
6945 |
|
5917
d5b5e701a6e8
changed: #prependModifierToKey:
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
6946 |
"Modified (format): / 12-07-2012 / 18:37:22 / cg" |
3236 | 6947 |
! |
6948 |
||
6949 |
translateKey:untranslatedKey forView:aView |
|
6950 |
"Return the key translated via the translation table. |
|
6951 |
Your application program should never depend on the values returned |
|
6952 |
by this method, but instead use symbolic keys (such as #FindNext). |
|
6953 |
Doing so allows easier reconfiguration by changing the translation map |
|
6954 |
in the 'smalltalk.rc' or 'display.rc' startup files. |
|
6955 |
||
6956 |
First, the modifier is prepended, making character X into |
|
6957 |
AltX, CtrlX or CmdX (on many systems, no separate Cmd (or Meta) |
|
6958 |
key exists; on those we always get AltX if the metaModifiers are not set correctly). |
|
6959 |
If multiple modifiers are active, the symbol becoms the concatenation |
|
6960 |
as in AltCtrlq (for control-alt-q). Shift will affect the last component, |
|
6961 |
thus the above with shift becoms: AltCtrlQ instead. |
|
6962 |
Some keyboards offer both Alt and Meta keys - on those, the first has a |
|
6963 |
prefix of Alt, the second has Cmd as prefix. Keyboards with only an Alt |
|
6964 |
key will will create prefix codes of Cmd for that. |
|
6965 |
For symbolic keys (i.e.Tab, Backspace etc, shift is ignored). |
|
6966 |
Then the result is used as a key into the translation keyboardMap |
|
6967 |
to get the final return value." |
|
6968 |
||
3831 | 6969 |
|xlatedKey| |
3236 | 6970 |
|
6971 |
xlatedKey := self prependModifierToKey:untranslatedKey. |
|
6972 |
||
6973 |
"/ translate via keyboardMap |
|
6974 |
||
3831 | 6975 |
xlatedKey := aView keyboardMap valueFor:xlatedKey. |
4030 | 6976 |
xlatedKey notNil ifTrue:[ |
6296 | 6977 |
xlatedKey isCharacter ifFalse:[ |
6978 |
xlatedKey isWideString ifFalse:[ |
|
6979 |
xlatedKey := xlatedKey asSymbol |
|
6980 |
] |
|
6981 |
] |
|
259 | 6982 |
]. |
51 | 6983 |
^ xlatedKey |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6984 |
|
5917
d5b5e701a6e8
changed: #prependModifierToKey:
Claus Gittinger <cg@exept.de>
parents:
5909
diff
changeset
|
6985 |
"Modified: / 12-07-2012 / 18:37:47 / cg" |
293 | 6986 |
! ! |
6987 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
6988 |
!DeviceWorkstation methodsFor:'keyboard queries'! |
293 | 6989 |
|
6990 |
altDown |
|
6991 |
"return true, if the alt-key is currently pressed." |
|
6992 |
||
6993 |
^ altDown |
|
249
f33de7016dba
modifierKeyProcessing (altDown/metaDown ...) now done in smalltalk
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
6994 |
! |
f33de7016dba
modifierKeyProcessing (altDown/metaDown ...) now done in smalltalk
Claus Gittinger <cg@exept.de>
parents:
241
diff
changeset
|
6995 |
|
3244 | 6996 |
altModifierMask |
6997 |
"return the mask bit for the alt modifier key" |
|
6998 |
||
6999 |
self subclassResponsibility |
|
7000 |
||
7001 |
! |
|
7002 |
||
4350 | 7003 |
ctrlDown |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7004 |
"return true, if the control-key is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7005 |
|
4350 | 7006 |
^ ctrlDown |
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7007 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7008 |
|
3244 | 7009 |
ctrlModifierMask |
7010 |
"return the mask bit for the ctrl modifier key" |
|
7011 |
||
7012 |
self subclassResponsibility |
|
7013 |
||
7014 |
! |
|
7015 |
||
1114
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7016 |
leftShiftDown |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7017 |
"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
|
7018 |
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
|
7019 |
|
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7020 |
^ shiftDown |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7021 |
|
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7022 |
"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
|
7023 |
! |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7024 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7025 |
metaDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7026 |
"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
|
7027 |
is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7028 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7029 |
^ metaDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7030 |
! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7031 |
|
3244 | 7032 |
metaModifierMask |
7033 |
"return the mask bit for the meta modifier key" |
|
7034 |
||
7035 |
self subclassResponsibility |
|
7036 |
||
7037 |
! |
|
7038 |
||
1114
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7039 |
rightShiftDown |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7040 |
"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
|
7041 |
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
|
7042 |
|
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7043 |
^ shiftDown |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7044 |
|
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7045 |
"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
|
7046 |
! |
1e1d28b9876a
added queries for left- and rightShift keys.
Claus Gittinger <cg@exept.de>
parents:
1079
diff
changeset
|
7047 |
|
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7048 |
shiftDown |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7049 |
"return true, if the shift-key is currently pressed." |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7050 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7051 |
^ shiftDown |
3244 | 7052 |
! |
7053 |
||
7054 |
shiftModifierMask |
|
7055 |
"return the mask bit for the shift modifier key" |
|
7056 |
||
7057 |
self subclassResponsibility |
|
7058 |
||
339
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7059 |
! ! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7060 |
|
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7061 |
!DeviceWorkstation methodsFor:'misc'! |
16bc1232293b
added modifier-changing protocol
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
7062 |
|
293 | 7063 |
beep |
1198 | 7064 |
"{ Pragma: +optSpace }" |
7065 |
||
293 | 7066 |
"output an audible beep or bell" |
7067 |
||
3078 | 7068 |
UserPreferences current beepEnabled ifTrue:[ |
6296 | 7069 |
Stdout nextPut:(Character bell) |
1906 | 7070 |
] |
1198 | 7071 |
|
3078 | 7072 |
"Modified: / 13.1.1997 / 22:56:13 / cg" |
7073 |
"Modified: / 3.12.1999 / 17:13:52 / ps" |
|
293 | 7074 |
! |
7075 |
||
7076 |
buffered |
|
7077 |
"buffer drawing - do not send it immediately to the display. |
|
7078 |
This is the default; see comment in #unBuffered." |
|
7079 |
||
7080 |
^ self |
|
7081 |
! |
|
7082 |
||
4346
98c44fc2c272
long-button-press handling added
Claus Gittinger <cg@exept.de>
parents:
4339
diff
changeset
|
7083 |
buttonLongPressedHandlerProcess |
4350 | 7084 |
^ buttonLongPressedHandlerProcess |
4346
98c44fc2c272
long-button-press handling added
Claus Gittinger <cg@exept.de>
parents:
4339
diff
changeset
|
7085 |
! |
98c44fc2c272
long-button-press handling added
Claus Gittinger <cg@exept.de>
parents:
4339
diff
changeset
|
7086 |
|
98c44fc2c272
long-button-press handling added
Claus Gittinger <cg@exept.de>
parents:
4339
diff
changeset
|
7087 |
buttonLongPressedHandlerProcess:aProcess |
4350 | 7088 |
buttonLongPressedHandlerProcess := aProcess. |
7089 |
! |
|
7090 |
||
7091 |
buttonPressTimeForMenu |
|
7092 |
^ buttonPressTimeForMenu |
|
7093 |
! |
|
7094 |
||
7095 |
buttonPressTimeForMenu:seconds |
|
7096 |
buttonPressTimeForMenu := seconds |
|
4346
98c44fc2c272
long-button-press handling added
Claus Gittinger <cg@exept.de>
parents:
4339
diff
changeset
|
7097 |
! |
98c44fc2c272
long-button-press handling added
Claus Gittinger <cg@exept.de>
parents:
4339
diff
changeset
|
7098 |
|
293 | 7099 |
compressMotionEvents:aBoolean |
4350 | 7100 |
"turn on/off motion event compression |
293 | 7101 |
- compressions makes always sense except in free-hand drawing of curves" |
7102 |
||
7103 |
motionEventCompression := aBoolean |
|
115 | 7104 |
! |
7105 |
||
4350 | 7106 |
flush |
2744
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
7107 |
"send all buffered drawing to the display. |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
7108 |
This used to be called #synchronizeOutput, but has been renamed |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
7109 |
for ST-80 compatibility." |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
7110 |
|
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
7111 |
^ self |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
7112 |
! |
7129de2192f7
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
7113 |
|
2716
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
7114 |
focusView |
6510 | 7115 |
"the view, which has got the focus from the operating system" |
7116 |
||
2716
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
7117 |
^ focusView |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
7118 |
! |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
7119 |
|
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
7120 |
focusView:aView |
6510 | 7121 |
"the view, which has got the focus from the operating system" |
7122 |
||
2716
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
7123 |
focusView := aView |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
7124 |
! |
b295e9763c24
added a slot for the current focusView
Claus Gittinger <cg@exept.de>
parents:
2712
diff
changeset
|
7125 |
|
3385
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7126 |
redrawAllWindows |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7127 |
|setOfViews| |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7128 |
|
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7129 |
setOfViews := self knownViews. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7130 |
|
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7131 |
setOfViews do:[:aView | |
6296 | 7132 |
aView shown ifTrue:[ |
7133 |
aView isRootView ifFalse:[ |
|
7134 |
aView clearView; invalidate |
|
7135 |
] |
|
7136 |
] |
|
3385
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7137 |
] |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7138 |
|
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7139 |
" |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7140 |
Display redrawAllWindows |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7141 |
" |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7142 |
|
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7143 |
"Modified: 15.10.1997 / 19:06:26 / cg" |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7144 |
! |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7145 |
|
2536 | 7146 |
repadBits:givenBits width:imageWidth height:imageHeight depth:imageDepth from:givenPadding to:wantedPadding |
7147 |
"repadding support - required for some devices when drawing images" |
|
7148 |
||
4350 | 7149 |
|newBits bytesPerLineGiven bytesPerLineWanted |
2536 | 7150 |
dstIndex "{ Class: SmallInteger }" |
7151 |
srcIndex "{ Class: SmallInteger }"| |
|
7152 |
||
7153 |
bytesPerLineGiven := ((width * imageDepth) + givenPadding - 1) // 8. |
|
7154 |
bytesPerLineWanted := ((width * imageDepth) + wantedPadding - 1) // 8. |
|
7155 |
||
7156 |
bytesPerLineGiven == bytesPerLineWanted ifTrue:[^ givenBits]. |
|
7157 |
||
7158 |
newBits := ByteArray new:(bytesPerLineWanted * height). |
|
7159 |
srcIndex := dstIndex := 1. |
|
7160 |
1 to:height do:[:row | |
|
6296 | 7161 |
newBits |
7162 |
replaceFrom:dstIndex |
|
7163 |
to:(dstIndex + bytesPerLineWanted - 1) |
|
7164 |
with:givenBits |
|
7165 |
startingAt:srcIndex. |
|
7166 |
dstIndex := dstIndex + bytesPerLineWanted. |
|
7167 |
srcIndex := srcIndex + bytesPerLineGiven. |
|
2536 | 7168 |
]. |
7169 |
^ newBits. |
|
4350 | 7170 |
|
2536 | 7171 |
! |
7172 |
||
1926 | 7173 |
restoreWindows |
7174 |
"restore the display. |
|
7175 |
Here, a view is popped over all of the screen temporarily" |
|
7176 |
||
7177 |
|v| |
|
7178 |
||
3385
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7179 |
self flush. |
1926 | 7180 |
v := PopUpView onDevice:self. |
7181 |
v origin:0@0 corner:(self bounds corner). |
|
3385
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7182 |
v raise. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7183 |
v realize. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7184 |
self flush. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7185 |
|
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7186 |
Delay waitForSeconds:0.2. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7187 |
v destroy. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7188 |
self flush. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7189 |
Delay waitForSeconds:0.2. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7190 |
self flush. |
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7191 |
|
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7192 |
self redrawAllWindows. |
1926 | 7193 |
|
7194 |
" |
|
7195 |
Display restoreWindows |
|
3385
777869fdc56d
restoreWindows is better (I hope)
Claus Gittinger <cg@exept.de>
parents:
3360
diff
changeset
|
7196 |
Display redrawAllWindows |
1926 | 7197 |
" |
7198 |
||
7199 |
"Modified: 15.10.1997 / 19:06:26 / cg" |
|
7200 |
! |
|
7201 |
||
293 | 7202 |
ringBell |
1198 | 7203 |
"{ Pragma: +optSpace }" |
7204 |
||
293 | 7205 |
"alias for beep; for ST-80 compatibility" |
7206 |
||
7207 |
self beep |
|
1198 | 7208 |
|
7209 |
"Modified: 13.1.1997 / 22:56:02 / cg" |
|
115 | 7210 |
! |
7211 |
||
293 | 7212 |
setInputFocusTo:aWindowId |
7213 |
^ self subclassResponsibility |
|
115 | 7214 |
! |
7215 |
||
293 | 7216 |
sync |
1198 | 7217 |
"{ Pragma: +optSpace }" |
7218 |
||
7219 |
"send all buffered drawing to the display and wait until its processed/drawn. |
|
7220 |
See also #flush, which does not wait. |
|
7221 |
ST-80 seems to only support flush." |
|
293 | 7222 |
|
7223 |
self flush |
|
1198 | 7224 |
|
7225 |
"Modified: 13.1.1997 / 22:55:44 / cg" |
|
115 | 7226 |
! |
7227 |
||
293 | 7228 |
synchronizeOutput |
1198 | 7229 |
"{ Pragma: +optSpace }" |
7230 |
||
3430 | 7231 |
<resource:#obsolete> |
7232 |
||
293 | 7233 |
"send all buffered drawing to the display. |
7234 |
OBSOLETE: please use #flush for ST-80 compatibility." |
|
7235 |
||
7236 |
self obsoleteMethodWarning:'use #flush'. |
|
7237 |
^ self flush |
|
1198 | 7238 |
|
7239 |
"Modified: 13.1.1997 / 22:53:44 / cg" |
|
115 | 7240 |
! |
7241 |
||
293 | 7242 |
unBuffered |
7243 |
"make all drawing be sent immediately to the display. |
|
7244 |
This may horribly slow down your drawings, but will result |
|
7245 |
in any errors to be delivered right after the bad operation |
|
7246 |
(in X only). Only useful for debugging." |
|
7247 |
||
7248 |
^ self |
|
7249 |
! ! |
|
7250 |
||
1717
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7251 |
!DeviceWorkstation methodsFor:'pointer stuff'! |
293 | 7252 |
|
2869 | 7253 |
anyButtonMotionMask |
7254 |
"return an integer for masking out any button from a motion |
|
7255 |
buttonStates value. This is very device specific and to |
|
7256 |
be redefined by concrete subclasses." |
|
7257 |
||
7258 |
^ self subclassResponsibility |
|
7259 |
||
7260 |
"Created: 15.10.1997 / 19:17:00 / cg" |
|
7261 |
! |
|
7262 |
||
1926 | 7263 |
anyButtonPressed |
7264 |
"return true, if the any button is currently pressed" |
|
7265 |
||
7266 |
^ (self buttonStates bitAnd:self anyButtonStateMask) ~~ 0 |
|
7267 |
||
7268 |
"Created: 15.10.1997 / 19:16:32 / cg" |
|
7269 |
! |
|
7270 |
||
7271 |
anyButtonStateMask |
|
7272 |
"return an integer for masking out any button from a |
|
7273 |
buttonStates value. This is very device specific and to |
|
7274 |
be redefined by concrete subclasses." |
|
7275 |
||
7276 |
^ self subclassResponsibility |
|
7277 |
||
7278 |
"Created: 15.10.1997 / 19:17:00 / cg" |
|
7279 |
! |
|
7280 |
||
2880
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7281 |
button1MotionMask |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7282 |
"return an integer for masking out the left button from a |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7283 |
motion buttonStates value. This is very device specific and to |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7284 |
be redefined by concrete subclasses." |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7285 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7286 |
^ self subclassResponsibility |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7287 |
! |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7288 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7289 |
button2MotionMask |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7290 |
"return an integer for masking out the middle button from a |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7291 |
motion buttonStates value. This is very device specific and to |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7292 |
be redefined by concrete subclasses." |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7293 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7294 |
^ self subclassResponsibility |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7295 |
! |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7296 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7297 |
button3MotionMask |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7298 |
"return an integer for masking out the right button from a |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7299 |
motion buttonStates value. This is very device specific and to |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7300 |
be redefined by concrete subclasses." |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7301 |
|
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7302 |
^ self subclassResponsibility |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7303 |
! |
9dda5e03b02b
missing subClassResponsibilty protocol
Claus Gittinger <cg@exept.de>
parents:
2876
diff
changeset
|
7304 |
|
293 | 7305 |
buttonStates |
7306 |
"return an integer representing the state of the pointer buttons; |
|
7307 |
a one-bit represents a pressed button. The bit positions are device specific |
|
7308 |
and to be returned by the *ButtonStateMask methods. |
|
7309 |
Must be redefined by concrete subclasses." |
|
7310 |
||
7311 |
^ self subclassResponsibility |
|
115 | 7312 |
! |
7313 |
||
293 | 7314 |
leftButtonPressed |
7315 |
"return true, if the left button is currently pressed" |
|
7316 |
||
7317 |
^ (self buttonStates bitAnd:self leftButtonStateMask) ~~ 0 |
|
7318 |
! |
|
7319 |
||
7320 |
leftButtonStateMask |
|
7321 |
"return an integer for masking out the left button from a |
|
7322 |
buttonStates value. This is very device specific and to |
|
7323 |
be redefined by concrete subclasses." |
|
7324 |
||
7325 |
^ self subclassResponsibility |
|
115 | 7326 |
! |
7327 |
||
293 | 7328 |
middleButtonPressed |
7329 |
"return true, if the middle button is currently pressed" |
|
7330 |
||
7331 |
^ (self buttonStates bitAnd:self middleButtonStateMask) ~~ 0 |
|
115 | 7332 |
! |
7333 |
||
293 | 7334 |
middleButtonStateMask |
7335 |
"return an integer for masking out the middle button from a |
|
7336 |
buttonStates value. This is very device specific and to |
|
7337 |
be redefined by concrete subclasses." |
|
7338 |
||
7339 |
^ self subclassResponsibility |
|
115 | 7340 |
! |
7341 |
||
293 | 7342 |
pointerPosition |
7343 |
"return the current pointer position in root-window coordinates. |
|
7344 |
Must be redefined by concrete subclasses." |
|
7345 |
||
7346 |
^ self subclassResponsibility |
|
115 | 7347 |
! |
7348 |
||
293 | 7349 |
rightButtonPressed |
7350 |
"return true, if the right button is currently pressed" |
|
7351 |
||
7352 |
^ (self buttonStates bitAnd:self rightButtonStateMask) ~~ 0 |
|
115 | 7353 |
! |
7354 |
||
293 | 7355 |
rightButtonStateMask |
7356 |
"return an integer for masking out the right button from a |
|
7357 |
buttonStates value. This is very device specific and to |
|
7358 |
be redefined by concrete subclasses." |
|
7359 |
||
7360 |
^ self subclassResponsibility |
|
115 | 7361 |
! |
7362 |
||
293 | 7363 |
rootPositionOfLastEvent |
7364 |
"return the position in root-window coordinates |
|
7365 |
of the last button, key or pointer event. |
|
7366 |
Must be redefined by concrete subclasses." |
|
7367 |
||
7368 |
^ self subclassResponsibility |
|
1717
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7369 |
! |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7370 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7371 |
setPointerPosition:newPosition |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7372 |
"change the pointer position in root-window coordinates." |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7373 |
|
3896
268d2a3ee2b5
rootView access only via message
Claus Gittinger <cg@exept.de>
parents:
3883
diff
changeset
|
7374 |
self setPointerPosition:newPosition in:(self rootView id) |
1717
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7375 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7376 |
" |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7377 |
Display setPointerPosition:10@30 |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7378 |
" |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7379 |
! |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7380 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7381 |
setPointerPosition:newPosition in:aWindowID |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7382 |
"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
|
7383 |
Must be redefined by concrete subclasses." |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7384 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7385 |
^ self subclassResponsibility |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7386 |
|
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7387 |
" |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7388 |
Display setPointerPosition:10@30 |
4e48d1778b27
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1710
diff
changeset
|
7389 |
" |
293 | 7390 |
! ! |
7391 |
||
7392 |
!DeviceWorkstation methodsFor:'printing & storing'! |
|
7393 |
||
7394 |
printOn:aStream |
|
7395 |
"for your convenience, add the name of the display connection |
|
7396 |
or 'default' to the printed representation." |
|
7397 |
||
7398 |
|name| |
|
7399 |
||
7400 |
super printOn:aStream. |
|
7401 |
||
7402 |
aStream nextPut:$(. |
|
7403 |
(name := self displayName) isNil ifTrue:[ |
|
6296 | 7404 |
name := 'defaultDisplay' |
293 | 7405 |
]. |
7406 |
aStream nextPutAll:name. |
|
4218
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
7407 |
self isOpen ifFalse:[ |
6296 | 7408 |
aStream nextPutAll:' - closed'. |
4218
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
7409 |
]. |
c483dfc16644
When closing, remove also references from cursors and cursors forms
Stefan Vogel <sv@exept.de>
parents:
4195
diff
changeset
|
7410 |
aStream nextPut:$). |
293 | 7411 |
! ! |
7412 |
||
3791 | 7413 |
!DeviceWorkstation methodsFor:'queries'! |
7414 |
||
6359 | 7415 |
isWindowsPlatform |
6374 | 7416 |
^ self class isWindowsPlatform |
6359 | 7417 |
! |
7418 |
||
3791 | 7419 |
supportedClipboards |
7420 |
"answer a collection of symbols with the supported clipboards.. |
|
7421 |
At least clipboard should be supported on any platform" |
|
7422 |
||
7423 |
^ #(clipboard) |
|
4238 | 7424 |
! |
7425 |
||
4260 | 7426 |
supportsNativeDialogs |
7427 |
^ false |
|
4263 | 7428 |
|
7429 |
" |
|
7430 |
Screen current supportsNativeDialogs |
|
7431 |
" |
|
4260 | 7432 |
! |
7433 |
||
5599 | 7434 |
supportsNativeFileDialogs |
7435 |
^ false |
|
7436 |
||
7437 |
"Created: / 24-08-2010 / 17:23:51 / sr" |
|
7438 |
! |
|
7439 |
||
4238 | 7440 |
supportsNativeWidgets |
7441 |
^ false |
|
4263 | 7442 |
|
7443 |
" |
|
7444 |
Screen current supportsNativeWidgets |
|
7445 |
" |
|
5980 | 7446 |
! |
7447 |
||
7448 |
supportsVariableHeightFonts |
|
6011
5f2245003b40
semaphore bug workaround - temporary
Claus Gittinger <cg@exept.de>
parents:
6006
diff
changeset
|
7449 |
"are fonts with variable height supported? |
5980 | 7450 |
Subclasses may redefine this" |
7451 |
||
7452 |
^ false |
|
3791 | 7453 |
! ! |
7454 |
||
293 | 7455 |
!DeviceWorkstation methodsFor:'retrieving pixels'! |
7456 |
||
1461
6d8b022bfcd8
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1460
diff
changeset
|
7457 |
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
|
7458 |
"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
|
7459 |
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
|
7460 |
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
|
7461 |
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
|
7462 |
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
|
7463 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7464 |
self subclassResponsibility |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7465 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7466 |
"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
|
7467 |
! |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7468 |
|
1461
6d8b022bfcd8
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1460
diff
changeset
|
7469 |
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
|
7470 |
"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
|
7471 |
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
|
7472 |
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
|
7473 |
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
|
7474 |
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
|
7475 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7476 |
^ self |
6296 | 7477 |
getBitsFromId:aDrawableId |
7478 |
x:srcx |
|
7479 |
y:srcy |
|
7480 |
width:w |
|
7481 |
height:h |
|
7482 |
into:imageBits |
|
1460
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7483 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7484 |
"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
|
7485 |
"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
|
7486 |
! |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7487 |
|
1461
6d8b022bfcd8
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1460
diff
changeset
|
7488 |
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
|
7489 |
"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
|
7490 |
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
|
7491 |
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
|
7492 |
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
|
7493 |
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
|
7494 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7495 |
^ self |
6296 | 7496 |
getBitsFromId:aDrawableId |
7497 |
x:srcx |
|
7498 |
y:srcy |
|
7499 |
width:w |
|
7500 |
height:h |
|
7501 |
into:imageBits |
|
1460
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7502 |
|
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7503 |
"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
|
7504 |
"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
|
7505 |
! |
e068ac480152
splitted getBitsFrom into pixmap-get and view-get (windows)
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
7506 |
|
2712
641bad954139
need gc-arg in getPixel (for WIN32)
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
7507 |
getPixelX:x y:y from:aDrawableId with:gcId |
293 | 7508 |
"return the pixel value at x/y" |
7509 |
||
7510 |
^ self subclassResponsibility |
|
2712
641bad954139
need gc-arg in getPixel (for WIN32)
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
7511 |
|
641bad954139
need gc-arg in getPixel (for WIN32)
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
7512 |
"Created: / 22.5.1999 / 01:40:42 / cg" |
115 | 7513 |
! ! |
7514 |
||
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7515 |
!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
|
7516 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7517 |
defaultStyleValueFor:aKey |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7518 |
"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
|
7519 |
These defaults are used if nothing is specified |
4350 | 7520 |
in the style sheet |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7521 |
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
|
7522 |
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
|
7523 |
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
|
7524 |
|
4350 | 7525 |
<resource: #style (#viewSpacing |
6296 | 7526 |
#borderColor #borderWidth |
7527 |
#viewBackgroundColor #shadowColor #lightColor |
|
7528 |
)> |
|
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7529 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7530 |
aKey == #viewSpacing ifTrue:[ |
6296 | 7531 |
^ 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
|
7532 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7533 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7534 |
aKey == #borderColor ifTrue:[ |
6296 | 7535 |
^ Color black |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7536 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7537 |
aKey == #borderWidth ifTrue:[ |
6296 | 7538 |
^ 1 |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7539 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7540 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7541 |
aKey == #shadowColor ifTrue:[ |
6296 | 7542 |
^ Color black |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7543 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7544 |
aKey == #lightColor ifTrue:[ |
6296 | 7545 |
^ Color white |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7546 |
]. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7547 |
aKey == #viewBackgroundColor ifTrue:[ |
6296 | 7548 |
^ Color white |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7549 |
]. |
1684 | 7550 |
aKey == #scrollerViewBackgroundColor ifTrue:[ |
6296 | 7551 |
^ Color white |
1684 | 7552 |
]. |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7553 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7554 |
aKey == #textForegroundColor ifTrue:[ |
6296 | 7555 |
^ Color black. |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7556 |
]. |
1684 | 7557 |
aKey == #textBackgroundColor ifTrue:[ |
6296 | 7558 |
^ Color white. |
1684 | 7559 |
]. |
7560 |
aKey == #selectionForegroundColor ifTrue:[ |
|
6296 | 7561 |
^ Color white. |
1684 | 7562 |
]. |
7563 |
aKey == #selectionBackgroundColor ifTrue:[ |
|
6296 | 7564 |
^ Color black. |
1684 | 7565 |
]. |
1677
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7566 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7567 |
^ nil. |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7568 |
|
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7569 |
"Modified: 29.4.1997 / 11:16:57 / dq" |
1684 | 7570 |
"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
|
7571 |
! ! |
2a980405798c
prepared to fetch default style values from the device (for windows)
Claus Gittinger <cg@exept.de>
parents:
1675
diff
changeset
|
7572 |
|
4838 | 7573 |
!DeviceWorkstation methodsFor:'tray access'! |
7574 |
||
7575 |
addTrayIconFor:aView icon:wicon iconMask:wiconMask toolTipMessage:toolTipMessage |
|
7576 |
"add an icon to the tray for aView (which will receive tray-events in the future. |
|
7577 |
intentionally ignored here - only supported by win32 (for now)" |
|
7578 |
||
7579 |
^ self |
|
7580 |
||
7581 |
"Created: / 31-10-2007 / 01:56:33 / cg" |
|
7582 |
"Modified: / 05-11-2007 / 12:19:04 / cg" |
|
7583 |
! |
|
7584 |
||
7585 |
removeTrayIconFor:aView |
|
7586 |
"remove the tray icon. |
|
7587 |
intentionally ignored here - only supported by win32 (for now)" |
|
7588 |
||
7589 |
^ self |
|
7590 |
||
7591 |
"Created: / 05-11-2007 / 12:17:38 / cg" |
|
7592 |
! |
|
7593 |
||
7594 |
setTrayIconFor:aView icon:wicon iconMask:wiconMaskArg |
|
7595 |
"change the tray icon. |
|
7596 |
intentionally ignored here - only supported by win32 (for now)" |
|
7597 |
||
7598 |
^ self |
|
7599 |
||
7600 |
"Created: / 05-11-2007 / 12:14:09 / cg" |
|
7601 |
! |
|
7602 |
||
7603 |
setTrayIconsToolTipMessageFor:aView to:toolTipMessageArg |
|
5061
f6422d11163a
so allow for smallInt keyPress codes (used to be characters)
Claus Gittinger <cg@exept.de>
parents:
5035
diff
changeset
|
7604 |
"Change the toolTopText. |
4838 | 7605 |
intentionally ignored here - only supported by win32 (for now)" |
7606 |
||
7607 |
^ self |
|
7608 |
||
7609 |
"Created: / 05-11-2007 / 12:14:21 / cg" |
|
7610 |
! ! |
|
7611 |
||
54 | 7612 |
!DeviceWorkstation methodsFor:'view registration'! |
0 | 7613 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
7614 |
addKnownView:aView withId:aWindowID |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
7615 |
"add the View aView with id:aWindowID to the list of known views/id's. |
51 | 7616 |
This map is needed later (on event arrival) to get the view from |
7617 |
the views id (which is passed along with the devices event) quickly." |
|
0 | 7618 |
|
4147
2b602a0c33d1
WOs kludge for alien views (adding same view again with different id)
werner
parents:
4088
diff
changeset
|
7619 |
|freeIdx newArr sz newSize wasBlocked knownIndex | |
46 | 7620 |
|
1483 | 7621 |
wasBlocked := OperatingSystem blockInterrupts. |
7622 |
||
0 | 7623 |
knownViews isNil ifTrue:[ |
6296 | 7624 |
knownViews := WeakArray new:50. |
7625 |
knownIds := Array new:50. |
|
7626 |
freeIdx := 1. |
|
54 | 7627 |
] ifFalse:[ |
6296 | 7628 |
knownIndex := knownViews identityIndexOf: aView. |
7629 |
knownIndex ~~ 0 ifTrue:[ |
|
7630 |
knownIds at:knownIndex put:aWindowID. |
|
7631 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
7632 |
^self. |
|
7633 |
]. |
|
7634 |
freeIdx := knownViews identityIndexOf:nil. |
|
7635 |
freeIdx == 0 ifTrue:[ |
|
7636 |
freeIdx := knownViews identityIndexOf:0. |
|
7637 |
[freeIdx ~~ 0 |
|
7638 |
and:[(knownIds at:freeIdx) notNil]] whileTrue:[ |
|
7639 |
"/ mhmh - the view is already clear in the weakArray |
|
7640 |
"/ but the id is not. |
|
7641 |
"/ (i.e. its collected, but not yet finalized) |
|
7642 |
"/ skip this entry. |
|
7643 |
"/ 'XXX ' print. (knownIds at:freeIdx) displayString printCR. |
|
7644 |
freeIdx := knownViews identityIndexOf:0 startingAt:(freeIdx + 1). |
|
7645 |
]. |
|
7646 |
]. |
|
0 | 7647 |
]. |
46 | 7648 |
|
118 | 7649 |
freeIdx == 0 ifTrue:[ |
6296 | 7650 |
sz := knownViews size. |
7651 |
newSize := sz * 2. |
|
7652 |
newArr := WeakArray new:newSize. |
|
7653 |
newArr replaceFrom:1 to:sz with:knownViews. |
|
7654 |
knownViews := newArr. |
|
7655 |
||
7656 |
newArr := Array new:newSize. |
|
7657 |
newArr replaceFrom:1 to:sz with:knownIds. |
|
7658 |
knownIds := newArr. |
|
7659 |
freeIdx := sz + 1. |
|
54 | 7660 |
]. |
7661 |
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
|
7662 |
knownIds at:freeIdx put:aWindowID. |
1483 | 7663 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
190 | 7664 |
|
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
7665 |
idToTableIndexMapping notNil ifTrue:[ |
6296 | 7666 |
idToTableIndexMapping at:aWindowID put:freeIdx. |
1406
2aa01c6279f0
fast mapping from viewID to view (experimental)
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
7667 |
]. |
2aa01c6279f0
fast mapping from viewID to view (experimental)
Claus Gittinger <cg@exept.de>
parents:
1383
diff
changeset
|
7668 |
|
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
|
7669 |
"/ 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
|
7670 |
"/ 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
|
7671 |
"/ ]. |
48f78f549e5f
dont want two dispatchers after restart (addknownView started it; Smalltalk>>restart did it again)
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
7672 |
|
1515 | 7673 |
"Modified: 2.4.1997 / 19:15:46 / cg" |
1525 | 7674 |
! |
0 | 7675 |
|
2874
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7676 |
initializeTopViewHookFor:aView |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7677 |
"callBack from topViews initialize method. |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7678 |
empty here, but may be useful ..." |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7679 |
! |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7680 |
|
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7681 |
realizedTopViewHookFor:aView |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7682 |
"callBack from topViews realize method. |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7683 |
empty here, but may be useful ..." |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7684 |
! |
213e4f118402
postRealize and initializeHooks added.
Claus Gittinger <cg@exept.de>
parents:
2872
diff
changeset
|
7685 |
|
1478
042a65d624cd
reorganize knownViews/knownIds table when views are removed.
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
7686 |
removeKnownView:aView withId:aViewId |
6331 | 7687 |
"remove aView from the list of known views/id's. |
7688 |
One of aView of aViewId may be nil. The nil one is computed from the other variable." |
|
7689 |
||
7690 |
|index wasBlocked nV nI n dstIdx v id newSize viewToRemove| |
|
54 | 7691 |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7692 |
lastId := nil. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7693 |
lastView := nil. |
2824 | 7694 |
focusView == aView ifTrue:[ |
6331 | 7695 |
focusView := nil |
2824 | 7696 |
]. |
46 | 7697 |
|
0 | 7698 |
knownViews notNil ifTrue:[ |
6331 | 7699 |
wasBlocked := OperatingSystem blockInterrupts. |
7700 |
||
7701 |
viewToRemove := aView. |
|
7702 |
index := 0. |
|
7703 |
aViewId notNil ifTrue:[ |
|
7704 |
idToTableIndexMapping notNil ifTrue:[ |
|
7705 |
index := idToTableIndexMapping at:aViewId ifAbsent:0. |
|
7706 |
] |
|
7707 |
]. |
|
7708 |
index == 0 ifTrue:[ |
|
7709 |
viewToRemove notNil ifTrue:[ |
|
7710 |
index := knownViews identityIndexOf:viewToRemove. |
|
7711 |
]. |
|
7712 |
] ifFalse:[ |
|
7713 |
viewToRemove isNil ifTrue:[ |
|
7714 |
viewToRemove := knownViews at:index ifAbsent:nil. |
|
7715 |
]. |
|
7716 |
]. |
|
7717 |
||
7718 |
index ~~ 0 ifTrue:[ |
|
7719 |
idToTableIndexMapping notNil ifTrue:[ |
|
7720 |
aViewId notNil ifTrue:[ |
|
7721 |
idToTableIndexMapping removeKey:aViewId ifAbsent:nil |
|
7722 |
] ifFalse:[ |
|
7723 |
id := knownIds at:index. |
|
7724 |
id notNil ifTrue:[ |
|
7725 |
idToTableIndexMapping removeKey:id ifAbsent:nil. |
|
7726 |
] |
|
7727 |
] |
|
7728 |
]. |
|
7729 |
knownViews at:index put:nil. |
|
7730 |
knownIds at:index put:nil. |
|
7731 |
lastId := nil. |
|
7732 |
lastView := nil. |
|
7733 |
]. |
|
7734 |
||
7735 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
7736 |
||
6469 | 7737 |
(viewToRemove notNil |
7738 |
and:[ viewToRemove ~~ 0 |
|
7739 |
and:[ viewToRemove isTopView ]]) ifTrue:[ |
|
6331 | 7740 |
"/ check for sparsely filled knownViews - array |
7741 |
wasBlocked := OperatingSystem blockInterrupts. |
|
7742 |
n := 0. |
|
7743 |
knownViews do:[:v | |
|
7744 |
(v notNil and:[v ~~ 0]) ifTrue:[ |
|
7745 |
n := n + 1 |
|
7746 |
]. |
|
7747 |
]. |
|
7748 |
n < (knownViews size * 2 // 3) ifTrue:[ |
|
7749 |
newSize := n * 3 // 2. |
|
7750 |
newSize > 50 ifTrue:[ |
|
7751 |
nV := WeakArray new:newSize. |
|
7752 |
nI := Array new:newSize. |
|
7753 |
dstIdx := 1. |
|
7754 |
1 to:knownViews size do:[:srcIdx | |
|
7755 |
v := knownViews at:srcIdx. |
|
7756 |
(v notNil and:[v ~~ 0]) ifTrue:[ |
|
7757 |
nV at:dstIdx put:v. |
|
7758 |
nI at:dstIdx put:(knownIds at:srcIdx). |
|
7759 |
dstIdx := dstIdx + 1. |
|
7760 |
]. |
|
7761 |
]. |
|
7762 |
idToTableIndexMapping := nil. |
|
7763 |
knownViews := nV. |
|
7764 |
knownIds := nI. |
|
7765 |
idToTableIndexMapping := Dictionary new. |
|
7766 |
knownIds keysAndValuesDo:[:idx :id | |
|
7767 |
id notNil ifTrue:[ |
|
7768 |
idToTableIndexMapping at:id put:idx |
|
7769 |
] |
|
7770 |
]. |
|
7771 |
]. |
|
7772 |
]. |
|
7773 |
wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
7774 |
self checkForEndOfDispatch. |
|
7775 |
]. |
|
0 | 7776 |
] |
958 | 7777 |
|
1478
042a65d624cd
reorganize knownViews/knownIds table when views are removed.
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
7778 |
"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
|
7779 |
"Modified: 27.3.1997 / 17:13:28 / cg" |
0 | 7780 |
! |
7781 |
||
293 | 7782 |
viewFromId:aWindowID |
7783 |
"given an Id, return the corresponding view." |
|
7784 |
||
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
7785 |
|index v idx| |
293 | 7786 |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7787 |
aWindowID = lastId ifTrue:[ |
6296 | 7788 |
lastView notNil ifTrue:[ |
7789 |
^ lastView |
|
7790 |
] |
|
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7791 |
]. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7792 |
|
1473
a44838bcddf0
keep indices - avoids another weak collection
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
7793 |
idToTableIndexMapping notNil ifTrue:[ |
6296 | 7794 |
idx := idToTableIndexMapping at:aWindowID ifAbsent:nil. |
7795 |
idx notNil ifTrue:[ |
|
7796 |
v := knownViews at:idx. |
|
7797 |
(v notNil and:[v ~~ 0]) ifTrue:[ |
|
7798 |
lastView := v. |
|
7799 |
lastId := aWindowID. |
|
7800 |
^ v |
|
7801 |
]. |
|
7802 |
] |
|
1407 | 7803 |
]. |
7804 |
||
2254 | 7805 |
knownIds isNil ifTrue:[ |
6296 | 7806 |
^ nil |
2254 | 7807 |
]. |
7808 |
||
293 | 7809 |
index := knownIds indexOf:aWindowID. |
1484 | 7810 |
index == 0 ifTrue:[ |
6296 | 7811 |
^ nil |
1484 | 7812 |
]. |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7813 |
|
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
7814 |
v := knownViews at:index. |
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
7815 |
v == 0 ifTrue:[ |
6296 | 7816 |
knownViews at:index put:nil. |
7817 |
knownIds at:index put:nil. |
|
7818 |
^ nil |
|
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
7819 |
]. |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7820 |
|
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7821 |
lastId := aWindowID. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7822 |
lastView := v. |
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7823 |
|
1078
f7b6f15899ab
changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents:
1075
diff
changeset
|
7824 |
^ v |
1267
a27c2daaea25
remember lastView/id when searching view by id - helps often
Claus Gittinger <cg@exept.de>
parents:
1258
diff
changeset
|
7825 |
|
1484 | 7826 |
"Modified: 22.3.1997 / 17:19:59 / cg" |
1525 | 7827 |
! |
7828 |
||
7829 |
viewIdKnown:aWindowID |
|
7830 |
"return true, if I still consider a windowId as being valid" |
|
7831 |
||
1547 | 7832 |
|index v| |
1525 | 7833 |
|
7834 |
aWindowID = lastId ifTrue:[ |
|
6296 | 7835 |
lastView notNil ifTrue:[ |
7836 |
^ true |
|
7837 |
] |
|
1525 | 7838 |
]. |
7839 |
||
7840 |
idToTableIndexMapping notNil ifTrue:[ |
|
6296 | 7841 |
index := idToTableIndexMapping at:aWindowID ifAbsent:nil. |
1525 | 7842 |
]. |
1547 | 7843 |
index isNil ifTrue:[ |
6296 | 7844 |
index := knownIds indexOf:aWindowID. |
1547 | 7845 |
]. |
1526 | 7846 |
index ~~ 0 ifTrue:[ |
6296 | 7847 |
v := knownViews at:index. |
7848 |
^ (v notNil and:[v ~~ 0]) |
|
1526 | 7849 |
]. |
7850 |
^ false. |
|
1525 | 7851 |
|
7852 |
"Created: 4.4.1997 / 11:01:07 / cg" |
|
1547 | 7853 |
"Modified: 4.4.1997 / 19:07:55 / cg" |
0 | 7854 |
! ! |
7855 |
||
12 | 7856 |
!DeviceWorkstation methodsFor:'window stuff'! |
7857 |
||
2756 | 7858 |
activateWindow:aWindowId |
7859 |
"make a window active. |
|
4353 | 7860 |
Fall back to raiseWindow here" |
7861 |
||
5151 | 7862 |
self raiseWindowToTop:aWindowId. |
4353 | 7863 |
! |
7864 |
||
293 | 7865 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
7866 |
"clear a rectangular area of a window to its view background" |
|
7867 |
||
2648 | 7868 |
"/ mhmh - should not be needed |
293 | 7869 |
^ self subclassResponsibility |
7870 |
! |
|
7871 |
||
7872 |
clearWindow:aWindowId |
|
7873 |
"clear a windows to its view background" |
|
7874 |
||
2648 | 7875 |
"/ mhmh - should not be needed |
293 | 7876 |
^ self subclassResponsibility |
7877 |
! |
|
7878 |
||
7879 |
lowerWindow:aWindowId |
|
609 | 7880 |
"lower a window" |
7881 |
||
293 | 7882 |
^ self subclassResponsibility |
609 | 7883 |
|
7884 |
"Modified: 24.4.1996 / 19:40:04 / cg" |
|
293 | 7885 |
! |
7886 |
||
2106
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
7887 |
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
|
7888 |
"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
|
7889 |
|
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
7890 |
"/ OBSOLETE interface - this looses the minExtent/maxExtent properties |
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
7891 |
"/ use mapView:...minWidth:minHeight:maxWidth:maxHeight: |
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
7892 |
|
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
7893 |
^ self |
6296 | 7894 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
7895 |
width:w height:h minExtent:nil maxExtent:nil |
|
2106
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
7896 |
! |
8fdc7283a99f
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2053
diff
changeset
|
7897 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
7898 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
6296 | 7899 |
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
|
7900 |
"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
|
7901 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
7902 |
^ self subclassResponsibility |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
7903 |
|
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
7904 |
"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
|
7905 |
! |
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
7906 |
|
293 | 7907 |
mapWindow:aWindowId |
609 | 7908 |
"map a window" |
7909 |
||
293 | 7910 |
^ self subclassResponsibility |
609 | 7911 |
|
7912 |
"Modified: 24.4.1996 / 19:43:06 / cg" |
|
293 | 7913 |
! |
7914 |
||
4489
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
7915 |
mapWindow:aWindowId animation:animationSymbolorNil time:timeInMillisOrNil |
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
7916 |
"unmap a window" |
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
7917 |
|
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
7918 |
^ self mapWindow:aWindowId |
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
7919 |
! |
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
7920 |
|
293 | 7921 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
609 | 7922 |
"move & resize a window" |
7923 |
||
1002 | 7924 |
"/ fallBack: move & resize as two individual operations |
7925 |
||
7926 |
self moveWindow:aWindowId x:x y:y. |
|
1003 | 7927 |
self resizeWindow:aWindowId width:w height:h. |
293 | 7928 |
! |
7929 |
||
7930 |
moveWindow:aWindowId x:x y:y |
|
609 | 7931 |
"move a window" |
7932 |
||
293 | 7933 |
^ self subclassResponsibility |
609 | 7934 |
|
7935 |
"Modified: 24.4.1996 / 19:40:36 / cg" |
|
293 | 7936 |
! |
7937 |
||
7938 |
raiseWindow:aWindowId |
|
5151 | 7939 |
"raise a window. |
7940 |
In some systems (aka MSWindows), this raises only above all other st/x views, |
|
7941 |
but not above other-application's views, which have a TOPMOST attribute. |
|
7942 |
Se raiseWindowToTop for this." |
|
609 | 7943 |
|
293 | 7944 |
^ self subclassResponsibility |
609 | 7945 |
|
7946 |
"Modified: 24.4.1996 / 19:40:42 / cg" |
|
293 | 7947 |
! |
7948 |
||
5151 | 7949 |
raiseWindowToTop:aWindowId |
7950 |
"raise a window above all others (even above non-st/x windows)" |
|
7951 |
||
7952 |
self raiseWindow:aWindowId |
|
7953 |
! |
|
7954 |
||
2428 | 7955 |
reparentWindow:windowId to:newParentWindowId |
7956 |
"change a windows parent (an optional interface). |
|
7957 |
Returns true if successfull." |
|
7958 |
||
7959 |
^ false |
|
7960 |
! |
|
7961 |
||
293 | 7962 |
resizeWindow:aWindowId width:w height:h |
609 | 7963 |
"resize a window" |
7964 |
||
293 | 7965 |
^ self subclassResponsibility |
609 | 7966 |
|
7967 |
"Modified: 24.4.1996 / 19:40:47 / cg" |
|
12 | 7968 |
! |
7969 |
||
7970 |
restoreCursors |
|
1475 | 7971 |
"restore the cursors of all views to their current cursor. |
7972 |
This undoes the effect of #setCursors:" |
|
46 | 7973 |
|
12 | 7974 |
knownViews notNil ifTrue:[ |
6296 | 7975 |
knownViews validElementsDo:[:aView | |
7976 |
|c vid cid| |
|
7977 |
||
7978 |
(vid := aView id) notNil ifTrue:[ |
|
7979 |
c := aView cursor. |
|
7980 |
(c notNil and:[(cid := c id) notNil]) ifTrue:[ |
|
7981 |
self setCursor:cid in:vid |
|
7982 |
] |
|
7983 |
] |
|
7984 |
]. |
|
7985 |
self flush |
|
12 | 7986 |
] |
7987 |
||
1475 | 7988 |
" |
7989 |
Display setCursors:(Cursor wait). |
|
7990 |
Delay waitForSeconds:5. |
|
7991 |
Display restoreCursors |
|
7992 |
" |
|
7993 |
||
7994 |
"Modified: 20.3.1997 / 16:28:25 / cg" |
|
12 | 7995 |
! |
7996 |
||
293 | 7997 |
setBackingStore:how in:aWindowId |
2648 | 7998 |
"turn on/off backing-store for a window. |
7999 |
A view with backingStore will redraw automatically |
|
8000 |
from the backing pixmap (without sending expose events). |
|
8001 |
An implementation may ignore this request." |
|
23 | 8002 |
|
1002 | 8003 |
"/ default here is to ignore the request |
23 | 8004 |
! |
8005 |
||
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8006 |
setBitGravity:how in:aWindowId |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8007 |
"set bit gravity for a window" |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8008 |
|
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8009 |
"/ default here is to ignore the request |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8010 |
! |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8011 |
|
293 | 8012 |
setCursor:aCursorId in:aWindowId |
2648 | 8013 |
"set a windows cursor" |
8014 |
||
8015 |
"/ mhmh - could be ignored |
|
12 | 8016 |
^ self subclassResponsibility |
8017 |
! |
|
8018 |
||
293 | 8019 |
setCursors:aCursor |
1475 | 8020 |
"change the cursor of all views on the receiver device |
8021 |
to aCursorId, without affecting the views idea of what |
|
8022 |
the cursor is (so that it can be restored from the views |
|
8023 |
cursor instance variable later). |
|
8024 |
Use of this is not recommended - its better to change |
|
8025 |
the cursor of a windowGroup alone." |
|
293 | 8026 |
|
2648 | 8027 |
|id| |
293 | 8028 |
|
3063
cb325adb5731
care for nil cursor in #setCursors:
Claus Gittinger <cg@exept.de>
parents:
3038
diff
changeset
|
8029 |
aCursor isNil ifTrue:[^ self]. |
cb325adb5731
care for nil cursor in #setCursors:
Claus Gittinger <cg@exept.de>
parents:
3038
diff
changeset
|
8030 |
|
1499 | 8031 |
id := (aCursor onDevice:self) id. |
293 | 8032 |
id notNil ifTrue:[ |
6296 | 8033 |
knownViews validElementsDo:[:aView | |
8034 |
|vid| |
|
8035 |
||
8036 |
(vid := aView id) notNil ifTrue:[ |
|
8037 |
self setCursor:id in:vid |
|
8038 |
] |
|
8039 |
]. |
|
8040 |
self flush |
|
293 | 8041 |
] |
8042 |
||
1475 | 8043 |
" |
8044 |
Display setCursors:(Cursor wait). |
|
8045 |
Delay waitForSeconds:5. |
|
8046 |
Display restoreCursors. |
|
8047 |
" |
|
8048 |
||
1499 | 8049 |
"Modified: 28.3.1997 / 16:14:59 / cg" |
0 | 8050 |
! |
8051 |
||
4369
998f4525d159
Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents:
4353
diff
changeset
|
8052 |
setForegroundWindow:aWindowId |
998f4525d159
Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents:
4353
diff
changeset
|
8053 |
"make a window active. |
998f4525d159
Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents:
4353
diff
changeset
|
8054 |
Fall back to raiseWindow here" |
998f4525d159
Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents:
4353
diff
changeset
|
8055 |
|
5151 | 8056 |
self raiseWindowToTop:aWindowId. |
4369
998f4525d159
Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents:
4353
diff
changeset
|
8057 |
! |
998f4525d159
Make snapshot writing more robust against errors.
Stefan Vogel <sv@exept.de>
parents:
4353
diff
changeset
|
8058 |
|
293 | 8059 |
setIconName:aString in:aWindowId |
8060 |
"set a windows icon name" |
|
10 | 8061 |
|
1002 | 8062 |
"/ default here is to ignore the request |
0 | 8063 |
! |
8064 |
||
8065 |
setSaveUnder:yesOrNo in:aWindowId |
|
2648 | 8066 |
"turn on/off save-under for a window. |
8067 |
A view with saveUnder will save the pixels of the |
|
8068 |
area covered by itself and repair from those when |
|
8069 |
unmapped (therefore, no expose events are generated later). |
|
8070 |
It is especially useful for popUp menus. |
|
8071 |
An implementation may ignore this request." |
|
10 | 8072 |
|
1002 | 8073 |
"/ default here is to ignore the request |
0 | 8074 |
! |
8075 |
||
1881 | 8076 |
setTransient:aWindowId for:aMainWindowId |
2648 | 8077 |
"set aWindowId to be a transient of aMainWindow. |
8078 |
This informs the windowManager that those are to |
|
8079 |
be handled as a group w.r.t. iconification and deiconification. |
|
4350 | 8080 |
An implementation may ignore this |
2648 | 8081 |
(being somewhat inconvenient to the user, though)" |
8082 |
||
8083 |
"/ default here is to ignore the request |
|
1881 | 8084 |
|
8085 |
"Created: 20.8.1997 / 20:38:32 / cg" |
|
8086 |
! |
|
8087 |
||
0 | 8088 |
setWindowBackground:aColorIndex in:aWindowId |
10 | 8089 |
"set a windows background color" |
0 | 8090 |
|
8091 |
^ self subclassResponsibility |
|
8092 |
! |
|
8093 |
||
8094 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
|
2636 | 8095 |
"set a windows background pattern to be a form. |
8096 |
No need to be implemented in concrete workstation; |
|
8097 |
if not implemented, its done by (slower) smalltalk code |
|
8098 |
(must return false from #supportsViewBackgroundPixmap query)" |
|
8099 |
||
8100 |
^ self |
|
8101 |
||
8102 |
"Modified: / 4.5.1999 / 19:06:13 / cg" |
|
0 | 8103 |
! |
8104 |
||
8105 |
setWindowBorderColor:aColorIndex in:aWindowId |
|
10 | 8106 |
"set a windows border color" |
8107 |
||
1002 | 8108 |
"/ default here is to ignore the request |
8109 |
||
8110 |
^ self |
|
0 | 8111 |
! |
8112 |
||
8113 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
|
10 | 8114 |
"set a windows border pattern" |
8115 |
||
1002 | 8116 |
"/ default here is to ignore the request |
8117 |
||
8118 |
^ self |
|
0 | 8119 |
! |
8120 |
||
8121 |
setWindowBorderShape:aPixmapId in:aWindowId |
|
10 | 8122 |
"set a windows border shape" |
8123 |
||
1002 | 8124 |
"/ default here is to ignore the request |
8125 |
||
8126 |
^ self |
|
0 | 8127 |
! |
8128 |
||
293 | 8129 |
setWindowBorderWidth:aNumber in:aWindowId |
8130 |
"set a windows border width" |
|
10 | 8131 |
|
0 | 8132 |
^ self subclassResponsibility |
8133 |
! |
|
8134 |
||
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
8135 |
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
|
8136 |
"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
|
8137 |
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
|
8138 |
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
|
8139 |
|
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8140 |
"/ 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
|
8141 |
|
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
8142 |
"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
|
8143 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
849
diff
changeset
|
8144 |
|
1007
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8145 |
setWindowGravity:how in:aWindowId |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8146 |
"set window gravity for a window" |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8147 |
|
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8148 |
"/ default here is to ignore the request |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8149 |
! |
6b6b2a63f01d
support for non-selectable devices (WIN32)
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
8150 |
|
0 | 8151 |
setWindowIcon:aForm in:aWindowId |
2648 | 8152 |
"define a bitmap to be used as icon" |
8153 |
||
8154 |
self |
|
6296 | 8155 |
setWindowIcon:aForm |
8156 |
mask:nil |
|
8157 |
in:aWindowId |
|
1375 | 8158 |
! |
8159 |
||
8160 |
setWindowIcon:aForm mask:aMaskForm in:aWindowId |
|
8161 |
"set a windows icon & iconMask" |
|
10 | 8162 |
|
2648 | 8163 |
"/ default here is to ignore the request |
0 | 8164 |
! |
8165 |
||
8166 |
setWindowIconWindow:aView in:aWindowId |
|
10 | 8167 |
"set a windows icon window" |
8168 |
||
2648 | 8169 |
"/ default here is to ignore the request |
8170 |
! |
|
8171 |
||
3244 | 8172 |
setWindowMinExtent:minExt maxExtent:maxExt in:aWindowId |
8173 |
"set a windows minimum & max extents. |
|
8174 |
nil arguments are ignored." |
|
8175 |
||
8176 |
|minW minH maxW maxH| |
|
8177 |
||
8178 |
minExt notNil ifTrue:[ |
|
6296 | 8179 |
minW := minExt x. |
8180 |
minH := minExt y. |
|
3244 | 8181 |
]. |
8182 |
maxExt notNil ifTrue:[ |
|
6296 | 8183 |
maxW := maxExt x. |
8184 |
maxH := maxExt y. |
|
3244 | 8185 |
]. |
8186 |
self setWindowMinExtentX:minW y:minH maxExtentX:maxW y:maxH in:aWindowId |
|
8187 |
! |
|
8188 |
||
8189 |
setWindowMinExtentX:minW y:minH maxExtentX:maxW y:maxH in:aWindowId |
|
2648 | 8190 |
"set a windows minimum & max extents. |
8191 |
nil arguments are ignored." |
|
8192 |
||
0 | 8193 |
^ self subclassResponsibility |
8194 |
! |
|
8195 |
||
293 | 8196 |
setWindowName:aString in:aWindowId |
2872 | 8197 |
"define a windows name (i.e. windowTitle)" |
10 | 8198 |
|
0 | 8199 |
^ self subclassResponsibility |
8200 |
! |
|
8201 |
||
5977
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8202 |
setWindowPid:anIntegerOrNil in:aWindowId |
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8203 |
"Sets the _NET_WM_PID property for the window. |
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8204 |
This may be used by the window manager to group windows. |
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8205 |
If anIntegerOrNil is nil, then PID of currently running |
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8206 |
Smalltalk is used" |
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8207 |
|
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8208 |
"/ default here is to ignore the request |
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8209 |
|
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8210 |
"Created: / 04-01-2013 / 16:02:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8211 |
! |
8d55715c166f
ICCCM 2.0 Compliancy: correctly set NET_WM_CLASS and _NET_WM_PID properties
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5969
diff
changeset
|
8212 |
|
293 | 8213 |
setWindowShape:aPixmapId in:aWindowId |
8214 |
"set a windows visible shape" |
|
8215 |
||
1002 | 8216 |
"/ default here is to ignore the request |
0 | 8217 |
! |
8218 |
||
8219 |
unmapWindow:aWindowId |
|
609 | 8220 |
"unmap a window" |
8221 |
||
0 | 8222 |
^ self subclassResponsibility |
609 | 8223 |
|
8224 |
"Modified: 24.4.1996 / 19:42:39 / cg" |
|
1532 | 8225 |
! |
8226 |
||
4489
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
8227 |
unmapWindow:aWindowId animation:animationSymbolorNil time:timeInMillisOrNil |
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
8228 |
"unmap a window" |
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
8229 |
|
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
8230 |
^ self unmapWindow:aWindowId |
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
8231 |
! |
8e481f09dd33
preps for animated map/unmap
Claus Gittinger <cg@exept.de>
parents:
4485
diff
changeset
|
8232 |
|
1532 | 8233 |
windowIsIconified:aWindowId |
8234 |
"return true, if a window is iconified" |
|
8235 |
||
8236 |
^ self subclassResponsibility |
|
8237 |
||
8238 |
"Modified: 24.4.1996 / 19:42:39 / cg" |
|
8239 |
"Created: 4.4.1997 / 14:45:26 / cg" |
|
0 | 8240 |
! ! |
8241 |
||
3478 | 8242 |
!DeviceWorkstation::DeviceFontMetrics methodsFor:'accessing'! |
8243 |
||
8244 |
ascent |
|
3862 | 8245 |
"return the ascent" |
3478 | 8246 |
|
8247 |
^ ascent |
|
8248 |
! |
|
8249 |
||
6296 | 8250 |
ascent:ascentArg descent:descentArg |
6164
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
8251 |
ascent := ascentArg. |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
8252 |
descent := descentArg. |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
8253 |
! |
1860d4131349
class: DeviceWorkstation::DeviceFontMetrics
Stefan Vogel <sv@exept.de>
parents:
6149
diff
changeset
|
8254 |
|
3478 | 8255 |
ascent:ascentArg descent:descentArg maxAscent:maxAscentArg maxDescent:maxDescentArg minWidth:minWidthArg maxWidth:maxWidthArg avgWidth:avgWidthArg |
3862 | 8256 |
"set corresponding instance variables" |
8257 |
||
3478 | 8258 |
ascent := ascentArg. |
8259 |
descent := descentArg. |
|
8260 |
maxAscent := maxAscentArg. |
|
8261 |
maxDescent := maxDescentArg. |
|
8262 |
minWidth := minWidthArg. |
|
8263 |
maxWidth := maxWidthArg. |
|
8264 |
averageWidth := avgWidthArg |
|
8265 |
! |
|
8266 |
||
4350 | 8267 |
ascent:ascentArg descent:descentArg maxAscent:maxAscentArg maxDescent:maxDescentArg |
4020 | 8268 |
minWidth:minWidthArg maxWidth:maxWidthArg avgWidth:avgWidthArg minCode:minCodeArg maxCode:maxCodeArg |
8269 |
"set corresponding instance variables" |
|
8270 |
||
8271 |
ascent := ascentArg. |
|
8272 |
descent := descentArg. |
|
8273 |
maxAscent := maxAscentArg. |
|
8274 |
maxDescent := maxDescentArg. |
|
8275 |
minWidth := minWidthArg. |
|
8276 |
maxWidth := maxWidthArg. |
|
8277 |
averageWidth := avgWidthArg. |
|
8278 |
minCode := minCodeArg. |
|
8279 |
maxCode := maxCodeArg. |
|
8280 |
! |
|
8281 |
||
4350 | 8282 |
ascent:ascentArg descent:descentArg maxAscent:maxAscentArg maxDescent:maxDescentArg |
4020 | 8283 |
minWidth:minWidthArg maxWidth:maxWidthArg avgWidth:avgWidthArg minCode:minCodeArg maxCode:maxCodeArg |
8284 |
direction:directionArg |
|
8285 |
"set corresponding instance variables" |
|
8286 |
||
8287 |
ascent := ascentArg. |
|
8288 |
descent := descentArg. |
|
8289 |
maxAscent := maxAscentArg. |
|
8290 |
maxDescent := maxDescentArg. |
|
8291 |
minWidth := minWidthArg. |
|
8292 |
maxWidth := maxWidthArg. |
|
8293 |
averageWidth := avgWidthArg. |
|
8294 |
minCode := minCodeArg. |
|
8295 |
maxCode := maxCodeArg. |
|
8296 |
direction := directionArg. |
|
8297 |
! |
|
8298 |
||
4350 | 8299 |
ascent:ascentArg descent:descentArg maxAscent:maxAscentArg maxDescent:maxDescentArg |
4087 | 8300 |
minWidth:minWidthArg maxWidth:maxWidthArg avgWidth:avgWidthArg minCode:minCodeArg maxCode:maxCodeArg |
8301 |
direction:directionArg encoding:encodingArg |
|
8302 |
"set corresponding instance variables" |
|
8303 |
||
8304 |
ascent := ascentArg. |
|
8305 |
descent := descentArg. |
|
8306 |
maxAscent := maxAscentArg. |
|
8307 |
maxDescent := maxDescentArg. |
|
8308 |
minWidth := minWidthArg. |
|
8309 |
maxWidth := maxWidthArg. |
|
8310 |
averageWidth := avgWidthArg. |
|
8311 |
minCode := minCodeArg. |
|
8312 |
maxCode := maxCodeArg. |
|
8313 |
direction := directionArg. |
|
8314 |
encoding := encodingArg. |
|
8315 |
! |
|
8316 |
||
3478 | 8317 |
averageWidth |
3862 | 8318 |
"return the averageWidth" |
3478 | 8319 |
|
8320 |
^ averageWidth |
|
8321 |
! |
|
8322 |
||
8323 |
descent |
|
3862 | 8324 |
"return the descent" |
3478 | 8325 |
|
8326 |
^ descent |
|
8327 |
! |
|
8328 |
||
4020 | 8329 |
direction |
8330 |
"return the drawing direction (think of hebrew and arabic !!)" |
|
8331 |
||
4021 | 8332 |
^ direction ? #LeftToRight |
4020 | 8333 |
! |
8334 |
||
3478 | 8335 |
encoding |
3862 | 8336 |
"return the encoding" |
3478 | 8337 |
|
8338 |
^ encoding |
|
8339 |
! |
|
8340 |
||
8341 |
maxAscent |
|
3862 | 8342 |
"return the maxAscent" |
3478 | 8343 |
|
8344 |
^ maxAscent |
|
8345 |
! |
|
8346 |
||
4022 | 8347 |
maxCode |
8348 |
^ maxCode ? 16rFFFF |
|
8349 |
! |
|
8350 |
||
3478 | 8351 |
maxDescent |
3862 | 8352 |
"return the maxDescent" |
3478 | 8353 |
|
8354 |
^ maxDescent |
|
8355 |
! |
|
8356 |
||
8357 |
maxWidth |
|
3862 | 8358 |
"return the maxWidth" |
3478 | 8359 |
|
8360 |
^ maxWidth |
|
8361 |
! |
|
8362 |
||
4022 | 8363 |
minCode |
8364 |
^ minCode ? 0 |
|
8365 |
! |
|
8366 |
||
3478 | 8367 |
minWidth |
3862 | 8368 |
"return the minWidth" |
3478 | 8369 |
|
8370 |
^ minWidth |
|
8371 |
! ! |
|
8372 |
||
1075
62f0cfb3c956
dont return nil entries in #knownViews
Claus Gittinger <cg@exept.de>
parents:
1074
diff
changeset
|
8373 |
!DeviceWorkstation class methodsFor:'documentation'! |
293 | 8374 |
|
8375 |
version |
|
6555 | 8376 |
^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.620 2014-07-25 21:25:22 cg Exp $' |
5509
fe84ac005fbc
comment/format in: #listOfAvailableFonts
Stefan Vogel <sv@exept.de>
parents:
5339
diff
changeset
|
8377 |
! |
fe84ac005fbc
comment/format in: #listOfAvailableFonts
Stefan Vogel <sv@exept.de>
parents:
5339
diff
changeset
|
8378 |
|
fe84ac005fbc
comment/format in: #listOfAvailableFonts
Stefan Vogel <sv@exept.de>
parents:
5339
diff
changeset
|
8379 |
version_CVS |
6555 | 8380 |
^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.620 2014-07-25 21:25:22 cg Exp $' |
0 | 8381 |
! ! |
3740
14cfe4f8255e
Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents:
3710
diff
changeset
|
8382 |
|
5980 | 8383 |
|
293 | 8384 |
DeviceWorkstation initialize! |