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