author | Claus Gittinger <cg@exept.de> |
Wed, 24 Oct 2012 15:08:09 +0200 | |
changeset 2936 | 914fbb4edbae |
parent 2847 | 65280fe44707 |
child 2939 | 5e2872ba0b95 |
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 |
]. |
|
2824 | 133 |
lcKey == $w ifTrue:[ |
134 |
lastView notNil ifTrue:[ |
|
135 |
obj := lastView topView |
|
136 |
] |
|
2435 | 137 |
]. |
138 |
obj notNil ifTrue:[ |
|
139 |
key isLowercase ifTrue:[ |
|
2823 | 140 |
objToInspect := obj |
2435 | 141 |
] ifFalse:[ |
2823 | 142 |
objToBrowse := obj |
2435 | 143 |
]. |
144 |
]. |
|
2300 | 145 |
]. |
146 |
||
2823 | 147 |
objToInspect notNil ifTrue:[ |
148 |
[ objToInspect inspect ] forkAt:(Processor userSchedulingPriority). |
|
149 |
]. |
|
150 |
objToBrowse notNil ifTrue:[ |
|
151 |
[ objToBrowse browse ] forkAt:(Processor userSchedulingPriority). |
|
152 |
]. |
|
153 |
||
2300 | 154 |
^ true |
2823 | 155 |
|
2824 | 156 |
"Modified: / 12-11-2010 / 11:51:04 / cg" |
2300 | 157 |
! ! |
158 |
||
159 |
!FlyByWindowInformation methodsFor:'help texts'! |
|
160 |
||
161 |
helpTextFor:aView at:aPointOrNil |
|
2699 | 162 |
"generate the text to be shown as popup-flyby info" |
163 |
||
2824 | 164 |
|resources| |
165 |
||
2300 | 166 |
lastView := aView. |
167 |
lastApplication := aView application. |
|
168 |
||
2824 | 169 |
resources := self class classResources. |
170 |
||
171 |
^ Text streamContents:[:s | |
|
172 |
|topViewToInspect applicationToInspect |
|
173 |
masterApplicationToInspect topApplicationToInspect modelToInspect |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
174 |
genComponentNameForApplication| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
175 |
|
2824 | 176 |
genComponentNameForApplication := |
177 |
[:app :s | |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
178 |
(app notNil |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
179 |
and:[ app builder notNil ]) ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
180 |
|components v| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
181 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
182 |
components := app builder namedComponents. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
183 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
184 |
v := aView. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
185 |
[ (components includes:v) not |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
186 |
and:[v container notNil] |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
187 |
] whileTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
188 |
v := v container. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
189 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
190 |
(components includes:v) ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
191 |
|k| |
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 |
k := components keyAtValue:v. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
194 |
v == aView ifTrue:[ |
2824 | 195 |
s nextPutLine:(' component: ' , k). |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
196 |
] ifFalse:[ |
2824 | 197 |
s nextPutLine:(' subview of component: ' , k). |
2700
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 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
200 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
201 |
]. |
2314 | 202 |
|
2300 | 203 |
aView topView ~~ aView ifTrue:[ |
2314 | 204 |
topViewToInspect := aView topView. |
2300 | 205 |
]. |
206 |
lastApplication notNil ifTrue:[ |
|
2314 | 207 |
applicationToInspect := lastApplication. |
208 |
masterApplicationToInspect := lastApplication masterApplication. |
|
2824 | 209 |
masterApplicationToInspect notNil ifTrue:[ |
210 |
masterApplicationToInspect == applicationToInspect ifTrue:[ |
|
211 |
masterApplicationToInspect := nil |
|
212 |
] ifFalse:[ |
|
213 |
topApplicationToInspect := masterApplicationToInspect topApplication. |
|
214 |
topApplicationToInspect == masterApplicationToInspect ifTrue:[ |
|
215 |
topApplicationToInspect := nil |
|
216 |
] |
|
217 |
]. |
|
218 |
] |
|
2314 | 219 |
]. |
220 |
aView model notNil ifTrue:[ |
|
221 |
modelToInspect := aView model. |
|
222 |
((modelToInspect == applicationToInspect) |
|
223 |
or:[ modelToInspect == masterApplicationToInspect ]) ifTrue:[ |
|
224 |
modelToInspect := nil. |
|
2300 | 225 |
]. |
226 |
]. |
|
2314 | 227 |
|
2824 | 228 |
applicationToInspect notNil ifTrue:[ |
229 |
s nextPutLine:(resources string:'Application: %1' with:applicationToInspect class name allBold). |
|
230 |
genComponentNameForApplication value:applicationToInspect value:s. |
|
2314 | 231 |
]. |
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
232 |
masterApplicationToInspect notNil ifTrue:[ |
2824 | 233 |
s nextPutLine:(resources string:'Master-Application: %1' with:masterApplicationToInspect class name allBold). |
234 |
"/ genComponentNameForApplication value:masterApplicationToInspect value:s. |
|
235 |
]. |
|
236 |
topApplicationToInspect notNil ifTrue:[ |
|
237 |
s nextPutLine:(resources string:'Top-Application: %1' with:topApplicationToInspect class name allBold). |
|
238 |
"/ genComponentNameForApplication value:topApplicationToInspect value:s. |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
239 |
]. |
2824 | 240 |
s nextPutLine:(resources string:'View: %1 "%2"' with:aView class name allBold with:aView name). |
241 |
topViewToInspect notNil ifTrue:[ |
|
242 |
s nextPutLine:(resources string:'Topview: %1' with:topViewToInspect class name allBold). |
|
2314 | 243 |
]. |
2824 | 244 |
modelToInspect notNil ifTrue:[ |
245 |
s nextPutLine:(resources string:'Model: %1' with:modelToInspect class name allBold). |
|
246 |
]. |
|
2699 | 247 |
|
2300 | 248 |
s cr. |
249 |
s nextPutLine:'Press:'. |
|
2435 | 250 |
s nextPutLine:' ? to show the viewtree'. |
2314 | 251 |
applicationToInspect notNil ifTrue:[ |
2300 | 252 |
s nextPutLine:' a to inspect application (A to browse)'. |
2314 | 253 |
masterApplicationToInspect notNil ifTrue:[ |
2300 | 254 |
s nextPutLine:' m to inspect masterApplication (M to browse)'. |
2824 | 255 |
topApplicationToInspect notNil ifTrue:[ |
256 |
s nextPutLine:' t to inspect masterApplication (T to browse)'. |
|
257 |
] |
|
2300 | 258 |
]. |
259 |
]. |
|
2823 | 260 |
s nextPutLine:' v to inspect view (V to browse)'. |
261 |
topViewToInspect notNil ifTrue:[ |
|
2824 | 262 |
s nextPutLine:' w to inspect topWindow (W to browse)'. |
2823 | 263 |
]. |
264 |
modelToInspect notNil ifTrue:[ |
|
265 |
s nextPutLine:' o to inspect model (O to browse)'. |
|
266 |
]. |
|
267 |
s cr. |
|
268 |
s nextPutLine:'RETURN to browse application.'. |
|
269 |
s nextPutAll:'ESC or click to leave flyBy-info mode.'. |
|
2300 | 270 |
] |
271 |
||
272 |
" |
|
273 |
self shownInformationOfViewUnderMouseUntilButtonIsPressed |
|
274 |
" |
|
2823 | 275 |
|
2824 | 276 |
"Modified: / 12-11-2010 / 11:54:59 / cg" |
2300 | 277 |
! ! |
278 |
||
2710 | 279 |
!FlyByWindowInformation methodsFor:'private'! |
280 |
||
2847
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
281 |
handleMouseIn:aView x:x y:y |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
282 |
finished == true ifTrue:[^ self]. |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
283 |
super handleMouseIn:aView x:x y:y |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
284 |
! |
65280fe44707
category of: #handleMouseIn:x:y:
Claus Gittinger <cg@exept.de>
parents:
2836
diff
changeset
|
285 |
|
2710 | 286 |
targetViewInitiatesHelpViaSensor |
287 |
^ false |
|
288 |
! ! |
|
289 |
||
2300 | 290 |
!FlyByWindowInformation methodsFor:'queries'! |
291 |
||
292 |
toolTipFollowsMouse |
|
293 |
^ true |
|
294 |
! ! |
|
295 |
||
296 |
!FlyByWindowInformation methodsFor:'start & stop'! |
|
297 |
||
2699 | 298 |
initiateHelpFor:aView at:aPointOrNil |
2710 | 299 |
self initiateHelpFor:aView at:aPointOrNil now:true |
2699 | 300 |
! |
301 |
||
302 |
initiateHelpFor:aView at:aPointOrNil now:showItNow |
|
2702 | 303 |
finished == true ifTrue:[^ self]. |
2699 | 304 |
super initiateHelpFor:aView at:aPointOrNil now:showItNow |
305 |
! |
|
306 |
||
2300 | 307 |
start |
308 |
|l| |
|
309 |
||
2702 | 310 |
finished == true ifTrue:[^ self]. |
311 |
||
2300 | 312 |
l := FlyByHelp currentHelpListener. |
313 |
l notNil ifTrue:[ |
|
314 |
FlyByHelp stop. |
|
315 |
cleanupAction := [ FlyByHelp start ]. |
|
316 |
]. |
|
317 |
finishSemaphore := Semaphore new. |
|
2699 | 318 |
finished := false. |
2300 | 319 |
super start. |
320 |
! |
|
321 |
||
322 |
stop |
|
2699 | 323 |
finished := true. |
2300 | 324 |
super stop. |
325 |
cleanupAction value. |
|
326 |
finishSemaphore notNil ifTrue:[ |
|
327 |
finishSemaphore signalIf. |
|
328 |
]. |
|
329 |
! |
|
330 |
||
331 |
waitUntilFinished |
|
332 |
finishSemaphore wait. |
|
333 |
! ! |
|
334 |
||
335 |
!FlyByWindowInformation class methodsFor:'documentation'! |
|
336 |
||
2587 | 337 |
version_CVS |
338 |
^ '$Header$' |
|
2300 | 339 |
! ! |