author | Claus Gittinger <cg@exept.de> |
Fri, 11 Jan 2013 16:49:05 +0100 | |
changeset 2942 | e5ab3d1211d7 |
parent 2939 | 5e2872ba0b95 |
child 2943 | e7d181ac8f06 |
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 |
|
2823 | 86 |
|obj objToInspect objToBrowse lcKey| |
2300 | 87 |
|
88 |
key == #Escape ifTrue:[ |
|
89 |
self stop. |
|
90 |
^ true |
|
91 |
]. |
|
92 |
||
2435 | 93 |
key == $? ifTrue:[ |
94 |
[ |
|
2836
a2e82ebd3bc3
changed: #keyPress:x:y:view: check if WindowTreeView class is present
Stefan Vogel <sv@exept.de>
parents:
2824
diff
changeset
|
95 |
WindowTreeView notNil ifTrue:[ |
a2e82ebd3bc3
changed: #keyPress:x:y:view: check if WindowTreeView class is present
Stefan Vogel <sv@exept.de>
parents:
2824
diff
changeset
|
96 |
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
|
97 |
] ifFalse:[ |
a2e82ebd3bc3
changed: #keyPress:x:y:view: check if WindowTreeView class is present
Stefan Vogel <sv@exept.de>
parents:
2824
diff
changeset
|
98 |
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
|
99 |
]. |
2435 | 100 |
] fork. |
101 |
self stop. |
|
102 |
^ true. |
|
2300 | 103 |
]. |
2435 | 104 |
|
2823 | 105 |
key == #Return ifTrue:[ |
106 |
objToBrowse := lastApplication ? lastView |
|
107 |
]. |
|
108 |
||
2435 | 109 |
key isCharacter ifTrue:[ |
110 |
lcKey := key asLowercase. |
|
111 |
||
112 |
lcKey == $a ifTrue:[ |
|
113 |
obj := lastApplication |
|
114 |
]. |
|
115 |
lcKey == $o ifTrue:[ |
|
2824 | 116 |
lastView notNil ifTrue:[ |
117 |
obj := lastView model |
|
118 |
]. |
|
2435 | 119 |
]. |
120 |
lcKey == $m ifTrue:[ |
|
2824 | 121 |
lastApplication notNil ifTrue:[ |
122 |
obj := lastApplication masterApplication |
|
123 |
] |
|
124 |
]. |
|
125 |
lcKey == $t ifTrue:[ |
|
126 |
lastApplication notNil ifTrue:[ |
|
127 |
obj := lastApplication topApplication |
|
128 |
]. |
|
2300 | 129 |
]. |
2435 | 130 |
lcKey == $v ifTrue:[ |
131 |
obj := lastView |
|
132 |
]. |
|
2939 | 133 |
lcKey == $g ifTrue:[ |
134 |
obj := lastView windowGroup |
|
135 |
]. |
|
2824 | 136 |
lcKey == $w ifTrue:[ |
137 |
lastView notNil ifTrue:[ |
|
138 |
obj := lastView topView |
|
139 |
] |
|
2435 | 140 |
]. |
141 |
obj notNil ifTrue:[ |
|
142 |
key isLowercase ifTrue:[ |
|
2823 | 143 |
objToInspect := obj |
2435 | 144 |
] ifFalse:[ |
2823 | 145 |
objToBrowse := obj |
2435 | 146 |
]. |
147 |
]. |
|
2300 | 148 |
]. |
149 |
||
2823 | 150 |
objToInspect notNil ifTrue:[ |
151 |
[ objToInspect inspect ] forkAt:(Processor userSchedulingPriority). |
|
152 |
]. |
|
153 |
objToBrowse notNil ifTrue:[ |
|
154 |
[ objToBrowse browse ] forkAt:(Processor userSchedulingPriority). |
|
155 |
]. |
|
156 |
||
2300 | 157 |
^ true |
2823 | 158 |
|
2824 | 159 |
"Modified: / 12-11-2010 / 11:51:04 / cg" |
2300 | 160 |
! ! |
161 |
||
162 |
!FlyByWindowInformation methodsFor:'help texts'! |
|
163 |
||
164 |
helpTextFor:aView at:aPointOrNil |
|
2699 | 165 |
"generate the text to be shown as popup-flyby info" |
166 |
||
2824 | 167 |
|resources| |
168 |
||
2300 | 169 |
lastView := aView. |
170 |
lastApplication := aView application. |
|
171 |
||
2824 | 172 |
resources := self class classResources. |
173 |
||
174 |
^ Text streamContents:[:s | |
|
175 |
|topViewToInspect applicationToInspect |
|
176 |
masterApplicationToInspect topApplicationToInspect modelToInspect |
|
2939 | 177 |
genComponentNameForApplication windowGroupToInspect| |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
178 |
|
2824 | 179 |
genComponentNameForApplication := |
180 |
[:app :s | |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
181 |
(app notNil |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
182 |
and:[ app builder notNil ]) ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
183 |
|components v| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
184 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
185 |
components := app builder namedComponents. |
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 |
v := aView. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
188 |
[ (components includes:v) not |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
189 |
and:[v container notNil] |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
190 |
] whileTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
191 |
v := v container. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
192 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
193 |
(components includes:v) ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
194 |
|k| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
195 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
196 |
k := components keyAtValue:v. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
197 |
v == aView ifTrue:[ |
2824 | 198 |
s nextPutLine:(' component: ' , k). |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
199 |
] ifFalse:[ |
2824 | 200 |
s nextPutLine:(' subview of component: ' , k). |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
201 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
202 |
]. |
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 |
]. |
2314 | 205 |
|
2300 | 206 |
aView topView ~~ aView ifTrue:[ |
2314 | 207 |
topViewToInspect := aView topView. |
2300 | 208 |
]. |
209 |
lastApplication notNil ifTrue:[ |
|
2314 | 210 |
applicationToInspect := lastApplication. |
211 |
masterApplicationToInspect := lastApplication masterApplication. |
|
2824 | 212 |
masterApplicationToInspect notNil ifTrue:[ |
213 |
masterApplicationToInspect == applicationToInspect ifTrue:[ |
|
214 |
masterApplicationToInspect := nil |
|
215 |
] ifFalse:[ |
|
216 |
topApplicationToInspect := masterApplicationToInspect topApplication. |
|
217 |
topApplicationToInspect == masterApplicationToInspect ifTrue:[ |
|
218 |
topApplicationToInspect := nil |
|
219 |
] |
|
220 |
]. |
|
221 |
] |
|
2314 | 222 |
]. |
223 |
aView model notNil ifTrue:[ |
|
224 |
modelToInspect := aView model. |
|
225 |
((modelToInspect == applicationToInspect) |
|
226 |
or:[ modelToInspect == masterApplicationToInspect ]) ifTrue:[ |
|
227 |
modelToInspect := nil. |
|
2300 | 228 |
]. |
229 |
]. |
|
2314 | 230 |
|
2824 | 231 |
applicationToInspect notNil ifTrue:[ |
232 |
s nextPutLine:(resources string:'Application: %1' with:applicationToInspect class name allBold). |
|
233 |
genComponentNameForApplication value:applicationToInspect value:s. |
|
2314 | 234 |
]. |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
235 |
masterApplicationToInspect notNil ifTrue:[ |
2824 | 236 |
s nextPutLine:(resources string:'Master-Application: %1' with:masterApplicationToInspect class name allBold). |
237 |
"/ genComponentNameForApplication value:masterApplicationToInspect value:s. |
|
238 |
]. |
|
239 |
topApplicationToInspect notNil ifTrue:[ |
|
240 |
s nextPutLine:(resources string:'Top-Application: %1' with:topApplicationToInspect class name allBold). |
|
241 |
"/ genComponentNameForApplication value:topApplicationToInspect value:s. |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
242 |
]. |
2824 | 243 |
s nextPutLine:(resources string:'View: %1 "%2"' with:aView class name allBold with:aView name). |
244 |
topViewToInspect notNil ifTrue:[ |
|
245 |
s nextPutLine:(resources string:'Topview: %1' with:topViewToInspect class name allBold). |
|
2314 | 246 |
]. |
2824 | 247 |
modelToInspect notNil ifTrue:[ |
248 |
s nextPutLine:(resources string:'Model: %1' with:modelToInspect class name allBold). |
|
249 |
]. |
|
2699 | 250 |
|
2300 | 251 |
s cr. |
252 |
s nextPutLine:'Press:'. |
|
2435 | 253 |
s nextPutLine:' ? to show the viewtree'. |
2314 | 254 |
applicationToInspect notNil ifTrue:[ |
2300 | 255 |
s nextPutLine:' a to inspect application (A to browse)'. |
2314 | 256 |
masterApplicationToInspect notNil ifTrue:[ |
2300 | 257 |
s nextPutLine:' m to inspect masterApplication (M to browse)'. |
2824 | 258 |
topApplicationToInspect notNil ifTrue:[ |
259 |
s nextPutLine:' t to inspect masterApplication (T to browse)'. |
|
260 |
] |
|
2300 | 261 |
]. |
262 |
]. |
|
2823 | 263 |
s nextPutLine:' v to inspect view (V to browse)'. |
264 |
topViewToInspect notNil ifTrue:[ |
|
2824 | 265 |
s nextPutLine:' w to inspect topWindow (W to browse)'. |
2823 | 266 |
]. |
2939 | 267 |
aView windowGroup notNil ifTrue:[ |
268 |
s nextPutLine:' g to inspect windowGroup'. |
|
269 |
]. |
|
2823 | 270 |
modelToInspect notNil ifTrue:[ |
271 |
s nextPutLine:' o to inspect model (O to browse)'. |
|
272 |
]. |
|
273 |
s cr. |
|
274 |
s nextPutLine:'RETURN to browse application.'. |
|
275 |
s nextPutAll:'ESC or click to leave flyBy-info mode.'. |
|
2300 | 276 |
] |
277 |
||
278 |
" |
|
279 |
self shownInformationOfViewUnderMouseUntilButtonIsPressed |
|
280 |
" |
|
2823 | 281 |
|
2824 | 282 |
"Modified: / 12-11-2010 / 11:54:59 / cg" |
2300 | 283 |
! ! |
284 |
||
2710 | 285 |
!FlyByWindowInformation methodsFor:'private'! |
286 |
||
2847
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
287 |
handleMouseIn:aView x:x y:y |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
288 |
finished == true ifTrue:[^ self]. |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
289 |
super handleMouseIn:aView x:x y:y |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
290 |
! |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
291 |
|
2710 | 292 |
targetViewInitiatesHelpViaSensor |
293 |
^ false |
|
294 |
! ! |
|
295 |
||
2300 | 296 |
!FlyByWindowInformation methodsFor:'queries'! |
297 |
||
298 |
toolTipFollowsMouse |
|
299 |
^ true |
|
300 |
! ! |
|
301 |
||
302 |
!FlyByWindowInformation methodsFor:'start & stop'! |
|
303 |
||
2699 | 304 |
initiateHelpFor:aView at:aPointOrNil |
2710 | 305 |
self initiateHelpFor:aView at:aPointOrNil now:true |
2699 | 306 |
! |
307 |
||
308 |
initiateHelpFor:aView at:aPointOrNil now:showItNow |
|
2702 | 309 |
finished == true ifTrue:[^ self]. |
2699 | 310 |
super initiateHelpFor:aView at:aPointOrNil now:showItNow |
311 |
! |
|
312 |
||
2300 | 313 |
start |
314 |
|l| |
|
315 |
||
2702 | 316 |
finished == true ifTrue:[^ self]. |
317 |
||
2300 | 318 |
l := FlyByHelp currentHelpListener. |
319 |
l notNil ifTrue:[ |
|
320 |
FlyByHelp stop. |
|
321 |
cleanupAction := [ FlyByHelp start ]. |
|
322 |
]. |
|
323 |
finishSemaphore := Semaphore new. |
|
2699 | 324 |
finished := false. |
2300 | 325 |
super start. |
326 |
! |
|
327 |
||
328 |
stop |
|
2699 | 329 |
finished := true. |
2300 | 330 |
super stop. |
331 |
cleanupAction value. |
|
332 |
finishSemaphore notNil ifTrue:[ |
|
333 |
finishSemaphore signalIf. |
|
334 |
]. |
|
335 |
! |
|
336 |
||
337 |
waitUntilFinished |
|
338 |
finishSemaphore wait. |
|
339 |
! ! |
|
340 |
||
341 |
!FlyByWindowInformation class methodsFor:'documentation'! |
|
342 |
||
2587 | 343 |
version_CVS |
344 |
^ '$Header$' |
|
2300 | 345 |
! ! |