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