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