author | Claus Gittinger <cg@exept.de> |
Mon, 16 Sep 2013 12:56:06 +0200 | |
changeset 3058 | d7792b7a50b7 |
parent 2943 | e7d181ac8f06 |
child 3065 | 311d632319d9 |
permissions | -rw-r--r-- |
2587 | 1 |
" |
2 |
COPYRIGHT (c) 2008 by eXept Software AG |
|
3 |
All Rights Reserved |
|
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 |
" |
|
2300 | 12 |
"{ Package: 'stx:libtool2' }" |
13 |
||
14 |
FlyByHelp subclass:#FlyByWindowInformation |
|
2699 | 15 |
instanceVariableNames:'lastApplication lastView cleanupAction finishSemaphore finished' |
2300 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-Help' |
|
19 |
! |
|
20 |
||
21 |
!FlyByWindowInformation class methodsFor:'documentation'! |
|
22 |
||
2587 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 2008 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
2300 | 37 |
examples |
38 |
" |
|
39 |
self shownInformationOfViewUnderMouseUntilButtonIsPressed |
|
40 |
" |
|
41 |
! |
|
42 |
||
43 |
shownInformationOfViewUnderMouseUntilButtonIsPressed |
|
44 |
self start waitUntilFinished |
|
45 |
||
46 |
" |
|
47 |
self shownInformationOfViewUnderMouseUntilButtonIsPressed |
|
48 |
" |
|
49 |
! ! |
|
50 |
||
51 |
!FlyByWindowInformation methodsFor:'accessing'! |
|
52 |
||
2699 | 53 |
cleanupAction:something |
2300 | 54 |
cleanupAction := something. |
55 |
! |
|
56 |
||
57 |
lastApplication |
|
58 |
^ lastApplication |
|
59 |
! |
|
60 |
||
61 |
lastView |
|
62 |
^ lastView |
|
63 |
! ! |
|
64 |
||
2543 | 65 |
!FlyByWindowInformation methodsFor:'defaults'! |
66 |
||
67 |
flyByHelpTimeoutMillis |
|
68 |
^ 1000 |
|
69 |
! ! |
|
70 |
||
2300 | 71 |
!FlyByWindowInformation methodsFor:'event handling'! |
72 |
||
2340 | 73 |
buttonMotion:buttonAndModifierState x:x y:y view:aView |
2702 | 74 |
finished == true ifTrue:[^ self]. |
75 |
||
2340 | 76 |
super buttonMotion:buttonAndModifierState x:x y:y view:aView. |
2300 | 77 |
^ true |
78 |
! |
|
79 |
||
80 |
buttonPress:button x:x y:y view:aView |
|
81 |
self stop. |
|
82 |
^ true |
|
83 |
! |
|
84 |
||
85 |
keyPress:key x:x y:y view:aView |
|
2943
e7d181ac8f06
class: FlyByWindowInformation
Claus Gittinger <cg@exept.de>
parents:
2939
diff
changeset
|
86 |
<resource: #keyboard (#Escape #Return)> |
e7d181ac8f06
class: FlyByWindowInformation
Claus Gittinger <cg@exept.de>
parents:
2939
diff
changeset
|
87 |
|
2823 | 88 |
|obj objToInspect objToBrowse lcKey| |
2300 | 89 |
|
90 |
key == #Escape ifTrue:[ |
|
91 |
self stop. |
|
92 |
^ true |
|
93 |
]. |
|
94 |
||
2435 | 95 |
key == $? ifTrue:[ |
96 |
[ |
|
2836
a2e82ebd3bc3
changed: #keyPress:x:y:view: check if WindowTreeView class is present
Stefan Vogel <sv@exept.de>
parents:
2824
diff
changeset
|
97 |
WindowTreeView notNil ifTrue:[ |
a2e82ebd3bc3
changed: #keyPress:x:y:view: check if WindowTreeView class is present
Stefan Vogel <sv@exept.de>
parents:
2824
diff
changeset
|
98 |
WindowTreeView openOn:(lastView topView) initialSelection:lastView. |
a2e82ebd3bc3
changed: #keyPress:x:y:view: check if WindowTreeView class is present
Stefan Vogel <sv@exept.de>
parents:
2824
diff
changeset
|
99 |
] ifFalse:[ |
a2e82ebd3bc3
changed: #keyPress:x:y:view: check if WindowTreeView class is present
Stefan Vogel <sv@exept.de>
parents:
2824
diff
changeset
|
100 |
self warn:'WindowTreeView class is not present!!'. |
a2e82ebd3bc3
changed: #keyPress:x:y:view: check if WindowTreeView class is present
Stefan Vogel <sv@exept.de>
parents:
2824
diff
changeset
|
101 |
]. |
2435 | 102 |
] fork. |
103 |
self stop. |
|
104 |
^ true. |
|
2300 | 105 |
]. |
2435 | 106 |
|
2823 | 107 |
key == #Return ifTrue:[ |
108 |
objToBrowse := lastApplication ? lastView |
|
109 |
]. |
|
110 |
||
2435 | 111 |
key isCharacter ifTrue:[ |
112 |
lcKey := key asLowercase. |
|
113 |
||
114 |
lcKey == $a ifTrue:[ |
|
115 |
obj := lastApplication |
|
116 |
]. |
|
117 |
lcKey == $o ifTrue:[ |
|
2824 | 118 |
lastView notNil ifTrue:[ |
119 |
obj := lastView model |
|
120 |
]. |
|
2435 | 121 |
]. |
122 |
lcKey == $m ifTrue:[ |
|
2824 | 123 |
lastApplication notNil ifTrue:[ |
124 |
obj := lastApplication masterApplication |
|
125 |
] |
|
126 |
]. |
|
127 |
lcKey == $t ifTrue:[ |
|
128 |
lastApplication notNil ifTrue:[ |
|
129 |
obj := lastApplication topApplication |
|
130 |
]. |
|
2300 | 131 |
]. |
2435 | 132 |
lcKey == $v ifTrue:[ |
133 |
obj := lastView |
|
134 |
]. |
|
2939 | 135 |
lcKey == $g ifTrue:[ |
136 |
obj := lastView windowGroup |
|
137 |
]. |
|
2824 | 138 |
lcKey == $w ifTrue:[ |
139 |
lastView notNil ifTrue:[ |
|
140 |
obj := lastView topView |
|
141 |
] |
|
2435 | 142 |
]. |
143 |
obj notNil ifTrue:[ |
|
144 |
key isLowercase ifTrue:[ |
|
2823 | 145 |
objToInspect := obj |
2435 | 146 |
] ifFalse:[ |
2823 | 147 |
objToBrowse := obj |
2435 | 148 |
]. |
149 |
]. |
|
2300 | 150 |
]. |
151 |
||
2823 | 152 |
objToInspect notNil ifTrue:[ |
153 |
[ objToInspect inspect ] forkAt:(Processor userSchedulingPriority). |
|
154 |
]. |
|
155 |
objToBrowse notNil ifTrue:[ |
|
156 |
[ objToBrowse browse ] forkAt:(Processor userSchedulingPriority). |
|
157 |
]. |
|
158 |
||
2300 | 159 |
^ true |
2823 | 160 |
|
2824 | 161 |
"Modified: / 12-11-2010 / 11:51:04 / cg" |
2300 | 162 |
! ! |
163 |
||
164 |
!FlyByWindowInformation methodsFor:'help texts'! |
|
165 |
||
166 |
helpTextFor:aView at:aPointOrNil |
|
2699 | 167 |
"generate the text to be shown as popup-flyby info" |
168 |
||
2824 | 169 |
|resources| |
170 |
||
2300 | 171 |
lastView := aView. |
172 |
lastApplication := aView application. |
|
173 |
||
2824 | 174 |
resources := self class classResources. |
175 |
||
176 |
^ Text streamContents:[:s | |
|
177 |
|topViewToInspect applicationToInspect |
|
178 |
masterApplicationToInspect topApplicationToInspect modelToInspect |
|
2939 | 179 |
genComponentNameForApplication windowGroupToInspect| |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
180 |
|
2824 | 181 |
genComponentNameForApplication := |
182 |
[:app :s | |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
183 |
(app notNil |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
184 |
and:[ app builder notNil ]) ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
185 |
|components v| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
186 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
187 |
components := app builder namedComponents. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
188 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
189 |
v := aView. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
190 |
[ (components includes:v) not |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
191 |
and:[v container notNil] |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
192 |
] whileTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
193 |
v := v container. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
194 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
195 |
(components includes:v) ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
196 |
|k| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
197 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
198 |
k := components keyAtValue:v. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
199 |
v == aView ifTrue:[ |
2824 | 200 |
s nextPutLine:(' component: ' , k). |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
201 |
] ifFalse:[ |
2824 | 202 |
s nextPutLine:(' subview of component: ' , k). |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
203 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
204 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
205 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
206 |
]. |
2314 | 207 |
|
2300 | 208 |
aView topView ~~ aView ifTrue:[ |
2314 | 209 |
topViewToInspect := aView topView. |
2300 | 210 |
]. |
211 |
lastApplication notNil ifTrue:[ |
|
2314 | 212 |
applicationToInspect := lastApplication. |
213 |
masterApplicationToInspect := lastApplication masterApplication. |
|
2824 | 214 |
masterApplicationToInspect notNil ifTrue:[ |
215 |
masterApplicationToInspect == applicationToInspect ifTrue:[ |
|
216 |
masterApplicationToInspect := nil |
|
217 |
] ifFalse:[ |
|
218 |
topApplicationToInspect := masterApplicationToInspect topApplication. |
|
219 |
topApplicationToInspect == masterApplicationToInspect ifTrue:[ |
|
220 |
topApplicationToInspect := nil |
|
221 |
] |
|
222 |
]. |
|
223 |
] |
|
2314 | 224 |
]. |
225 |
aView model notNil ifTrue:[ |
|
226 |
modelToInspect := aView model. |
|
227 |
((modelToInspect == applicationToInspect) |
|
228 |
or:[ modelToInspect == masterApplicationToInspect ]) ifTrue:[ |
|
229 |
modelToInspect := nil. |
|
2300 | 230 |
]. |
231 |
]. |
|
2314 | 232 |
|
2824 | 233 |
applicationToInspect notNil ifTrue:[ |
234 |
s nextPutLine:(resources string:'Application: %1' with:applicationToInspect class name allBold). |
|
235 |
genComponentNameForApplication value:applicationToInspect value:s. |
|
2314 | 236 |
]. |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
237 |
masterApplicationToInspect notNil ifTrue:[ |
2824 | 238 |
s nextPutLine:(resources string:'Master-Application: %1' with:masterApplicationToInspect class name allBold). |
239 |
"/ genComponentNameForApplication value:masterApplicationToInspect value:s. |
|
240 |
]. |
|
241 |
topApplicationToInspect notNil ifTrue:[ |
|
242 |
s nextPutLine:(resources string:'Top-Application: %1' with:topApplicationToInspect class name allBold). |
|
243 |
"/ genComponentNameForApplication value:topApplicationToInspect value:s. |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
244 |
]. |
2824 | 245 |
s nextPutLine:(resources string:'View: %1 "%2"' with:aView class name allBold with:aView name). |
246 |
topViewToInspect notNil ifTrue:[ |
|
247 |
s nextPutLine:(resources string:'Topview: %1' with:topViewToInspect class name allBold). |
|
2314 | 248 |
]. |
2824 | 249 |
modelToInspect notNil ifTrue:[ |
250 |
s nextPutLine:(resources string:'Model: %1' with:modelToInspect class name allBold). |
|
251 |
]. |
|
2699 | 252 |
|
2300 | 253 |
s cr. |
254 |
s nextPutLine:'Press:'. |
|
2435 | 255 |
s nextPutLine:' ? to show the viewtree'. |
2314 | 256 |
applicationToInspect notNil ifTrue:[ |
2300 | 257 |
s nextPutLine:' a to inspect application (A to browse)'. |
2314 | 258 |
masterApplicationToInspect notNil ifTrue:[ |
2300 | 259 |
s nextPutLine:' m to inspect masterApplication (M to browse)'. |
2824 | 260 |
topApplicationToInspect notNil ifTrue:[ |
261 |
s nextPutLine:' t to inspect masterApplication (T to browse)'. |
|
262 |
] |
|
2300 | 263 |
]. |
264 |
]. |
|
2823 | 265 |
s nextPutLine:' v to inspect view (V to browse)'. |
266 |
topViewToInspect notNil ifTrue:[ |
|
2824 | 267 |
s nextPutLine:' w to inspect topWindow (W to browse)'. |
2823 | 268 |
]. |
2939 | 269 |
aView windowGroup notNil ifTrue:[ |
270 |
s nextPutLine:' g to inspect windowGroup'. |
|
271 |
]. |
|
2823 | 272 |
modelToInspect notNil ifTrue:[ |
273 |
s nextPutLine:' o to inspect model (O to browse)'. |
|
274 |
]. |
|
275 |
s cr. |
|
276 |
s nextPutLine:'RETURN to browse application.'. |
|
277 |
s nextPutAll:'ESC or click to leave flyBy-info mode.'. |
|
2300 | 278 |
] |
279 |
||
280 |
" |
|
281 |
self shownInformationOfViewUnderMouseUntilButtonIsPressed |
|
282 |
" |
|
2823 | 283 |
|
2824 | 284 |
"Modified: / 12-11-2010 / 11:54:59 / cg" |
2300 | 285 |
! ! |
286 |
||
2710 | 287 |
!FlyByWindowInformation methodsFor:'private'! |
288 |
||
3058
d7792b7a50b7
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
2943
diff
changeset
|
289 |
activeHelpViewForApplication:applicationOrNil text:helpText onDevice:aDevice |
d7792b7a50b7
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
2943
diff
changeset
|
290 |
^ (ActiveHelpView for:helpText onDevice:aDevice) shapeStyle:nil. |
d7792b7a50b7
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
2943
diff
changeset
|
291 |
! |
d7792b7a50b7
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
2943
diff
changeset
|
292 |
|
2847
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
293 |
handleMouseIn:aView x:x y:y |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
294 |
finished == true ifTrue:[^ self]. |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
295 |
super handleMouseIn:aView x:x y:y |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
296 |
! |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
297 |
|
2710 | 298 |
targetViewInitiatesHelpViaSensor |
299 |
^ false |
|
300 |
! ! |
|
301 |
||
2300 | 302 |
!FlyByWindowInformation methodsFor:'queries'! |
303 |
||
304 |
toolTipFollowsMouse |
|
305 |
^ true |
|
306 |
! ! |
|
307 |
||
308 |
!FlyByWindowInformation methodsFor:'start & stop'! |
|
309 |
||
2699 | 310 |
initiateHelpFor:aView at:aPointOrNil |
2710 | 311 |
self initiateHelpFor:aView at:aPointOrNil now:true |
2699 | 312 |
! |
313 |
||
314 |
initiateHelpFor:aView at:aPointOrNil now:showItNow |
|
2702 | 315 |
finished == true ifTrue:[^ self]. |
2699 | 316 |
super initiateHelpFor:aView at:aPointOrNil now:showItNow |
317 |
! |
|
318 |
||
2300 | 319 |
start |
320 |
|l| |
|
321 |
||
2702 | 322 |
finished == true ifTrue:[^ self]. |
323 |
||
2300 | 324 |
l := FlyByHelp currentHelpListener. |
325 |
l notNil ifTrue:[ |
|
326 |
FlyByHelp stop. |
|
327 |
cleanupAction := [ FlyByHelp start ]. |
|
328 |
]. |
|
329 |
finishSemaphore := Semaphore new. |
|
2699 | 330 |
finished := false. |
2300 | 331 |
super start. |
332 |
! |
|
333 |
||
334 |
stop |
|
2699 | 335 |
finished := true. |
2300 | 336 |
super stop. |
337 |
cleanupAction value. |
|
338 |
finishSemaphore notNil ifTrue:[ |
|
339 |
finishSemaphore signalIf. |
|
340 |
]. |
|
341 |
! |
|
342 |
||
343 |
waitUntilFinished |
|
344 |
finishSemaphore wait. |
|
345 |
! ! |
|
346 |
||
347 |
!FlyByWindowInformation class methodsFor:'documentation'! |
|
348 |
||
2587 | 349 |
version_CVS |
350 |
^ '$Header$' |
|
2300 | 351 |
! ! |
2943
e7d181ac8f06
class: FlyByWindowInformation
Claus Gittinger <cg@exept.de>
parents:
2939
diff
changeset
|
352 |