author | Claus Gittinger <cg@exept.de> |
Fri, 12 Nov 2010 11:39:53 +0100 | |
changeset 2823 | cd54d69eec13 |
parent 2710 | 0ce76feb3f91 |
child 2824 | 34ec9ea82209 |
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 |
||
2699 | 85 |
handleMouseIn:aView x:x y:y |
2702 | 86 |
finished == true ifTrue:[^ self]. |
2699 | 87 |
super handleMouseIn:aView x:x y:y |
88 |
! |
|
89 |
||
2300 | 90 |
keyPress:key x:x y:y view:aView |
2823 | 91 |
|obj objToInspect objToBrowse lcKey| |
2300 | 92 |
|
93 |
key == #Escape ifTrue:[ |
|
94 |
self stop. |
|
95 |
^ true |
|
96 |
]. |
|
97 |
||
2435 | 98 |
key == $? ifTrue:[ |
99 |
[ |
|
100 |
WindowTreeView openOn:(lastView topView) initialSelection:lastView. |
|
101 |
] fork. |
|
102 |
self stop. |
|
103 |
^ true. |
|
2300 | 104 |
]. |
2435 | 105 |
|
2823 | 106 |
key == #Return ifTrue:[ |
107 |
objToBrowse := lastApplication ? lastView |
|
108 |
]. |
|
109 |
||
2435 | 110 |
key isCharacter ifTrue:[ |
111 |
lcKey := key asLowercase. |
|
112 |
||
113 |
lcKey == $a ifTrue:[ |
|
114 |
obj := lastApplication |
|
115 |
]. |
|
116 |
lcKey == $o ifTrue:[ |
|
117 |
obj := lastView model |
|
118 |
]. |
|
119 |
lcKey == $m ifTrue:[ |
|
120 |
obj := lastApplication masterApplication |
|
2300 | 121 |
]. |
2435 | 122 |
lcKey == $v ifTrue:[ |
123 |
obj := lastView |
|
124 |
]. |
|
125 |
lcKey == $t ifTrue:[ |
|
126 |
obj := lastView topView |
|
127 |
]. |
|
128 |
obj notNil ifTrue:[ |
|
129 |
key isLowercase ifTrue:[ |
|
2823 | 130 |
objToInspect := obj |
2435 | 131 |
] ifFalse:[ |
2823 | 132 |
objToBrowse := obj |
2435 | 133 |
]. |
134 |
]. |
|
2300 | 135 |
]. |
136 |
||
2823 | 137 |
objToInspect notNil ifTrue:[ |
138 |
[ objToInspect inspect ] forkAt:(Processor userSchedulingPriority). |
|
139 |
]. |
|
140 |
objToBrowse notNil ifTrue:[ |
|
141 |
[ objToBrowse browse ] forkAt:(Processor userSchedulingPriority). |
|
142 |
]. |
|
143 |
||
2300 | 144 |
^ true |
2823 | 145 |
|
146 |
"Modified: / 12-11-2010 / 11:38:23 / cg" |
|
2300 | 147 |
! ! |
148 |
||
149 |
!FlyByWindowInformation methodsFor:'help texts'! |
|
150 |
||
151 |
helpTextFor:aView at:aPointOrNil |
|
2699 | 152 |
"generate the text to be shown as popup-flyby info" |
153 |
||
2300 | 154 |
lastView := aView. |
155 |
lastApplication := aView application. |
|
156 |
||
157 |
^ String streamContents:[:s | |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
158 |
|topViewToInspect applicationToInspect masterApplicationToInspect modelToInspect |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
159 |
genComponentNameForApplication| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
160 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
161 |
genComponentNameForApplication := [:app :s | |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
162 |
(app notNil |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
163 |
and:[ app builder notNil ]) ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
164 |
|components v| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
165 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
166 |
components := app builder namedComponents. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
167 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
168 |
v := aView. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
169 |
[ (components includes:v) not |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
170 |
and:[v container notNil] |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
171 |
] whileTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
172 |
v := v container. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
173 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
174 |
(components includes:v) ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
175 |
|k| |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
176 |
|
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
177 |
k := components keyAtValue:v. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
178 |
v == aView ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
179 |
s nextPutLine:(' Component: ' , k). |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
180 |
] ifFalse:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
181 |
s nextPutLine:(' Subview of Component: ' , k). |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
182 |
]. |
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 |
]. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
185 |
]. |
2314 | 186 |
|
2300 | 187 |
aView topView ~~ aView ifTrue:[ |
2314 | 188 |
topViewToInspect := aView topView. |
2300 | 189 |
]. |
190 |
lastApplication notNil ifTrue:[ |
|
2314 | 191 |
applicationToInspect := lastApplication. |
192 |
masterApplicationToInspect := lastApplication masterApplication. |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
193 |
masterApplicationToInspect == applicationToInspect ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
194 |
masterApplicationToInspect := nil |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
195 |
]. |
2314 | 196 |
]. |
197 |
aView model notNil ifTrue:[ |
|
198 |
modelToInspect := aView model. |
|
199 |
((modelToInspect == applicationToInspect) |
|
200 |
or:[ modelToInspect == masterApplicationToInspect ]) ifTrue:[ |
|
201 |
modelToInspect := nil. |
|
2300 | 202 |
]. |
203 |
]. |
|
2314 | 204 |
|
2352 | 205 |
s nextPutLine:('View: ' , aView class name, ' "',aView name printString,'"'). |
2314 | 206 |
modelToInspect notNil ifTrue:[ |
207 |
s nextPutLine:('Model: ' , modelToInspect class name). |
|
208 |
]. |
|
209 |
topViewToInspect notNil ifTrue:[ |
|
210 |
s nextPutLine:('Topview: ' , topViewToInspect class name). |
|
211 |
]. |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
212 |
masterApplicationToInspect notNil ifTrue:[ |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
213 |
s nextPutLine:('Masterapplication: ' , masterApplicationToInspect class name). |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
214 |
genComponentNameForApplication value:masterApplicationToInspect value:s. |
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
215 |
]. |
2314 | 216 |
applicationToInspect notNil ifTrue:[ |
217 |
s nextPutLine:('Application: ' , applicationToInspect class name). |
|
2700
bad11f9b735f
#helpTextFor:at: - also show component's name
Claus Gittinger <cg@exept.de>
parents:
2699
diff
changeset
|
218 |
genComponentNameForApplication value:applicationToInspect value:s. |
2314 | 219 |
]. |
220 |
||
2699 | 221 |
"/ identity it as component |
222 |
||
2300 | 223 |
s cr. |
224 |
s nextPutLine:'Press:'. |
|
2435 | 225 |
s nextPutLine:' ? to show the viewtree'. |
2314 | 226 |
applicationToInspect notNil ifTrue:[ |
2300 | 227 |
s nextPutLine:' a to inspect application (A to browse)'. |
2314 | 228 |
masterApplicationToInspect notNil ifTrue:[ |
2300 | 229 |
s nextPutLine:' m to inspect masterApplication (M to browse)'. |
230 |
]. |
|
231 |
]. |
|
2823 | 232 |
s nextPutLine:' v to inspect view (V to browse)'. |
233 |
topViewToInspect notNil ifTrue:[ |
|
234 |
s nextPutLine:' t to inspect topView (T to browse)'. |
|
235 |
]. |
|
236 |
modelToInspect notNil ifTrue:[ |
|
237 |
s nextPutLine:' o to inspect model (O to browse)'. |
|
238 |
]. |
|
239 |
s cr. |
|
240 |
s nextPutLine:'RETURN to browse application.'. |
|
241 |
s nextPutAll:'ESC or click to leave flyBy-info mode.'. |
|
2300 | 242 |
] |
243 |
||
244 |
" |
|
245 |
self shownInformationOfViewUnderMouseUntilButtonIsPressed |
|
246 |
" |
|
2823 | 247 |
|
248 |
"Modified: / 12-11-2010 / 11:39:34 / cg" |
|
2300 | 249 |
! ! |
250 |
||
2710 | 251 |
!FlyByWindowInformation methodsFor:'private'! |
252 |
||
253 |
targetViewInitiatesHelpViaSensor |
|
254 |
^ false |
|
255 |
! ! |
|
256 |
||
2300 | 257 |
!FlyByWindowInformation methodsFor:'queries'! |
258 |
||
259 |
toolTipFollowsMouse |
|
260 |
^ true |
|
261 |
! ! |
|
262 |
||
263 |
!FlyByWindowInformation methodsFor:'start & stop'! |
|
264 |
||
2699 | 265 |
initiateHelpFor:aView at:aPointOrNil |
2710 | 266 |
self initiateHelpFor:aView at:aPointOrNil now:true |
2699 | 267 |
! |
268 |
||
269 |
initiateHelpFor:aView at:aPointOrNil now:showItNow |
|
2702 | 270 |
finished == true ifTrue:[^ self]. |
2699 | 271 |
super initiateHelpFor:aView at:aPointOrNil now:showItNow |
272 |
! |
|
273 |
||
2300 | 274 |
start |
275 |
|l| |
|
276 |
||
2702 | 277 |
finished == true ifTrue:[^ self]. |
278 |
||
2300 | 279 |
l := FlyByHelp currentHelpListener. |
280 |
l notNil ifTrue:[ |
|
281 |
FlyByHelp stop. |
|
282 |
cleanupAction := [ FlyByHelp start ]. |
|
283 |
]. |
|
284 |
finishSemaphore := Semaphore new. |
|
2699 | 285 |
finished := false. |
2300 | 286 |
super start. |
287 |
! |
|
288 |
||
289 |
stop |
|
2699 | 290 |
finished := true. |
2300 | 291 |
super stop. |
292 |
cleanupAction value. |
|
293 |
finishSemaphore notNil ifTrue:[ |
|
294 |
finishSemaphore signalIf. |
|
295 |
]. |
|
296 |
! |
|
297 |
||
298 |
waitUntilFinished |
|
299 |
finishSemaphore wait. |
|
300 |
! ! |
|
301 |
||
302 |
!FlyByWindowInformation class methodsFor:'documentation'! |
|
303 |
||
304 |
version |
|
305 |
^ '$Header$' |
|
2587 | 306 |
! |
307 |
||
308 |
version_CVS |
|
309 |
^ '$Header$' |
|
2300 | 310 |
! ! |