author | Claus Gittinger <cg@exept.de> |
Wed, 19 Nov 2014 20:56:18 +0100 | |
changeset 3394 | d1f97f49ea4f |
parent 3334 | d334c9dd9b76 |
child 3418 | a758dd978f99 |
permissions | -rw-r--r-- |
1802 | 1 |
" |
2 |
COPYRIGHT (c) 2001 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 |
" |
|
1536 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
14 |
ActiveHelp subclass:#FlyByHelp |
|
2680 | 15 |
instanceVariableNames:'currentFrame currentView currentHelpView showProcess closeProcess' |
3255 | 16 |
classVariableNames:'MaxNumberOfLines MaxNumberOfColumns' |
1536 | 17 |
poolDictionaries:'' |
18 |
category:'Interface-Help' |
|
19 |
! |
|
20 |
||
1802 | 21 |
!FlyByHelp class methodsFor:'documentation'! |
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2001 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 |
" |
|
1893 | 35 |
! |
36 |
||
37 |
examples |
|
38 |
" |
|
3220 | 39 |
UserPreferences current toolTipShapeStyle:nil |
40 |
UserPreferences current toolTipShapeStyle:#cartoon |
|
41 |
||
1893 | 42 |
FlyByHelp isActive |
43 |
||
44 |
FlyByHelp stop |
|
45 |
FlyByHelp start |
|
46 |
" |
|
1802 | 47 |
! ! |
1536 | 48 |
|
2692 | 49 |
!FlyByHelp class methodsFor:'accessing'! |
50 |
||
51 |
currentlyShownView |
|
2846
e90ba00f9df1
changed: #currentlyShownView
Claus Gittinger <cg@exept.de>
parents:
2826
diff
changeset
|
52 |
TheOneAndOnlyHelpListener isNil ifTrue:[^ nil]. |
2692 | 53 |
^ TheOneAndOnlyHelpListener currentlyShownView |
2846
e90ba00f9df1
changed: #currentlyShownView
Claus Gittinger <cg@exept.de>
parents:
2826
diff
changeset
|
54 |
|
e90ba00f9df1
changed: #currentlyShownView
Claus Gittinger <cg@exept.de>
parents:
2826
diff
changeset
|
55 |
"Modified: / 09-06-2010 / 16:35:48 / cg" |
3255 | 56 |
! |
57 |
||
58 |
maxNumberOfColumns |
|
59 |
^ MaxNumberOfColumns ? 200 |
|
60 |
! |
|
61 |
||
62 |
maxNumberOfLines |
|
63 |
^ MaxNumberOfLines ? 40 |
|
2692 | 64 |
! ! |
65 |
||
2684 | 66 |
!FlyByHelp methodsFor:'defaults'! |
67 |
||
68 |
flyByHelpTimeoutMillis |
|
69 |
"abort flyby help text generation, if no text can be generated within that |
|
70 |
time delta. This is used to abort long-lasting parsing/scanning/analysis in |
|
71 |
large methods when the mouse is moved over some syntactic constructs, and |
|
72 |
it takes too long to parse... |
|
73 |
The returned time is given in ms" |
|
74 |
||
75 |
^ 300 |
|
76 |
! ! |
|
77 |
||
2392 | 78 |
!FlyByHelp methodsFor:'event handling'! |
1540 | 79 |
|
2474 | 80 |
buttonMotion:buttonAndModifierState x:x y:y view:aView |
2519 | 81 |
aView == currentHelpView ifTrue:[ |
82 |
"/ the help-bubble itself |
|
83 |
^ false |
|
84 |
]. |
|
85 |
||
2518 | 86 |
"/ don't start tooltip, if this view is not active |
3243 | 87 |
"/ does not work, because motion events are reported for the current focus-view, |
3321 | 88 |
"/ which is always active. Must check after we have determined the view under the pointer |
2518 | 89 |
"/ aView topView isActive ifFalse:[^ false]. |
2477
b009e0b51999
suppress tooltip for inactive (lower) windows
Claus Gittinger <cg@exept.de>
parents:
2474
diff
changeset
|
90 |
|
2474 | 91 |
^ super buttonMotion:buttonAndModifierState x:x y:y view:aView |
1540 | 92 |
! |
93 |
||
2611
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
94 |
buttonPress:button x:x y:y view:aView |
3198 | 95 |
|prevView| |
96 |
||
97 |
"/ hideHelp nils the currentView |
|
98 |
"/ we restore it, so the tooltip is not shown again for this view |
|
99 |
"/ until the mouse really leaves the view |
|
100 |
"/ let's call this the "do-not-show-in-this-view mode" |
|
101 |
prevView := currentView. |
|
2978
4358a9302b95
changed: #buttonPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2925
diff
changeset
|
102 |
self hideHelp. |
3198 | 103 |
currentView := prevView. |
104 |
||
105 |
^ false |
|
2978
4358a9302b95
changed: #buttonPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2925
diff
changeset
|
106 |
|
4358a9302b95
changed: #buttonPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2925
diff
changeset
|
107 |
"Modified: / 23-12-2011 / 20:37:28 / cg" |
2611
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
108 |
! |
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
109 |
|
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
110 |
keyPress:key x:x y:y view:aView |
3216 | 111 |
<resource: #keyboard (#Escape)> |
112 |
||
3198 | 113 |
|prevView| |
114 |
||
2885
a70144d85a81
changed: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2884
diff
changeset
|
115 |
currentHelpView notNil ifTrue:[ |
2925
352825e1163c
changed: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
116 |
key == $§ ifTrue:[ |
2979
306456bdfb61
comment in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2978
diff
changeset
|
117 |
"/ generate a line suitable for the resources file (a null translation) |
3216 | 118 |
"/ into the clipboard; makes it easy to add missing translations to a .rs file, |
119 |
"/ by pressing paragrapj whenever you see an untranslated helptext |
|
2885
a70144d85a81
changed: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2884
diff
changeset
|
120 |
aView setClipboardText:(lastHelpText storeString , ' ' , lastHelpText storeString). |
2612 | 121 |
self hideHelp. |
122 |
^ true |
|
123 |
]. |
|
2979
306456bdfb61
comment in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2978
diff
changeset
|
124 |
key == #Escape ifTrue:[ |
3198 | 125 |
prevView := currentView. |
2979
306456bdfb61
comment in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2978
diff
changeset
|
126 |
self hideHelp. |
3198 | 127 |
currentView := prevView. |
2979
306456bdfb61
comment in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2978
diff
changeset
|
128 |
^ true |
2885
a70144d85a81
changed: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2884
diff
changeset
|
129 |
]. |
3216 | 130 |
(#('Shift' #'Shift_L' #'Shift_R') includes:key) ifTrue:[ |
131 |
"/ do not close on those... |
|
132 |
^ false |
|
133 |
]. |
|
2611
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
134 |
]. |
3198 | 135 |
|
136 |
"/ hideHelp nils the currentView |
|
137 |
"/ we restore it, so the tooltip is not shown again for this view |
|
138 |
"/ until the mouse really leaves the view |
|
139 |
"/ let's call this the "do-not-show-in-this-view mode" |
|
140 |
prevView := currentView. |
|
141 |
self hideHelpIgnoringErrors. |
|
142 |
currentView := prevView. |
|
143 |
||
144 |
^ false |
|
145 |
"/ ^ super keyPress:key x:x y:y view:aView |
|
2884
7d37f5a0719e
changed: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
146 |
|
2979
306456bdfb61
comment in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2978
diff
changeset
|
147 |
"Modified (format): / 25-12-2011 / 10:25:23 / cg" |
2611
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
148 |
! |
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
149 |
|
2521
7e51aa294156
care for mousewheel while showing help
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
150 |
mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView |
7e51aa294156
care for mousewheel while showing help
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
151 |
currentHelpView notNil ifTrue:[ |
7e51aa294156
care for mousewheel while showing help
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
152 |
self handleMouseIn:aView x:x y:y. |
7e51aa294156
care for mousewheel while showing help
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
153 |
]. |
7e51aa294156
care for mousewheel while showing help
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
154 |
^ false |
7e51aa294156
care for mousewheel while showing help
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
155 |
! |
7e51aa294156
care for mousewheel while showing help
Claus Gittinger <cg@exept.de>
parents:
2519
diff
changeset
|
156 |
|
1540 | 157 |
pointerLeave:state view:aView |
2611
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
158 |
aView == currentHelpView ifTrue:[^ true]. |
3198 | 159 |
|
160 |
"/ clear the do-not-show-in-this-view mode (see keyPress) |
|
161 |
"/ (currentHelpView isNil and:[currentView notNil]) ifTrue:[currentView := nil]. |
|
162 |
||
2611
f578b9c43a6f
handle escape key to close flyByHelp
Claus Gittinger <cg@exept.de>
parents:
2521
diff
changeset
|
163 |
^ super pointerLeave:state view:aView |
1540 | 164 |
! ! |
165 |
||
2392 | 166 |
!FlyByHelp methodsFor:'help texts'! |
1536 | 167 |
|
168 |
helpTextFromModel:aModel view:aView at:aPointOrNil |
|
169 |
"helper: ask aModel for its helpText." |
|
170 |
||
171 |
|text| |
|
172 |
||
173 |
aPointOrNil notNil ifTrue:[ |
|
174 |
(aModel respondsTo:#flyByHelpTextFor:at:) ifTrue:[ |
|
175 |
text := aModel flyByHelpTextFor:aView at:aPointOrNil. |
|
2754 | 176 |
text notNil ifTrue:[^ text]. |
1536 | 177 |
]. |
178 |
]. |
|
2754 | 179 |
(aModel respondsTo:#flyByHelpTextFor:) ifTrue:[ |
180 |
text := aModel flyByHelpTextFor:aView. |
|
181 |
text notNil ifTrue:[^ text]. |
|
1536 | 182 |
]. |
2754 | 183 |
^ nil |
1536 | 184 |
! |
185 |
||
186 |
helpTextFromView:aView at:aPointOrNil |
|
187 |
"helper: ask aView for its helpText." |
|
188 |
||
2754 | 189 |
|text key app| |
1536 | 190 |
|
191 |
aPointOrNil notNil ifTrue:[ |
|
192 |
(aView respondsTo:#flyByHelpTextAt:) ifTrue:[ |
|
193 |
text := aView flyByHelpTextAt:aPointOrNil. |
|
2754 | 194 |
text notNil ifTrue:[^ text]. |
1536 | 195 |
]. |
196 |
]. |
|
2754 | 197 |
(aView respondsTo:#flyByHelpText) ifTrue:[ |
198 |
text := aView flyByHelpText. |
|
199 |
text notNil ifTrue:[^ text]. |
|
200 |
]. |
|
201 |
(aView respondsTo:#helpKey) ifTrue:[ |
|
202 |
key := aView helpKey. |
|
203 |
key notNil ifTrue:[ |
|
204 |
app := aView application. |
|
205 |
app isNil ifTrue:[ |
|
206 |
app := Error handle:[:ex | nil] do:[ aView windowGroup mainGroup application ]. |
|
207 |
]. |
|
208 |
app notNil ifTrue:[ |
|
209 |
^ app flyByHelpTextForKey:key |
|
210 |
]. |
|
211 |
^ aView resources string:key |
|
1536 | 212 |
]. |
213 |
]. |
|
2754 | 214 |
^ nil. |
2392 | 215 |
! ! |
216 |
||
217 |
!FlyByHelp methodsFor:'private'! |
|
1536 | 218 |
|
219 |
hideIfPointerLeft:aView |
|
220 |
"hide help, if the pointer is not in aView" |
|
221 |
||
222 |
|whereOnScreen| |
|
223 |
||
224 |
currentFrame notNil ifTrue:[ |
|
225 |
whereOnScreen := aView graphicsDevice pointerPosition. |
|
226 |
||
227 |
(currentFrame notNil |
|
228 |
and:[(currentFrame insetBy:1@1) containsPoint:whereOnScreen]) ifFalse:[ |
|
229 |
self hideHelp. |
|
230 |
]. |
|
231 |
]. |
|
232 |
||
233 |
"Modified: 28.5.1996 / 20:18:28 / cg" |
|
234 |
! |
|
235 |
||
236 |
initiateHelpFor:aView at:aPointOrNil now:showItNow |
|
237 |
"ask aView for helpText, passing x/y coordinates; |
|
238 |
start a timeout process to display this helpText after some delay; |
|
239 |
Normally used internally, but can also be used by widgets to force |
|
240 |
re-negotiation of the displayed helpText |
|
241 |
(for example in a menu, when the selection changes)" |
|
242 |
||
2679
552847065fb3
car not to hog the cpu by flyByHelp processing
Claus Gittinger <cg@exept.de>
parents:
2651
diff
changeset
|
243 |
|text delayTime now| |
1536 | 244 |
|
245 |
(self interestedIn:aView) ifFalse:[ |
|
246 |
^ self |
|
247 |
]. |
|
248 |
||
2679
552847065fb3
car not to hog the cpu by flyByHelp processing
Claus Gittinger <cg@exept.de>
parents:
2651
diff
changeset
|
249 |
now := Timestamp now. |
552847065fb3
car not to hog the cpu by flyByHelp processing
Claus Gittinger <cg@exept.de>
parents:
2651
diff
changeset
|
250 |
|
2680 | 251 |
"/ do not allow for more than 200 ms to be spent in the |
2679
552847065fb3
car not to hog the cpu by flyByHelp processing
Claus Gittinger <cg@exept.de>
parents:
2651
diff
changeset
|
252 |
"/ helpText gatherer (the codeView parses the code for the variable under the cursor) |
552847065fb3
car not to hog the cpu by flyByHelp processing
Claus Gittinger <cg@exept.de>
parents:
2651
diff
changeset
|
253 |
[ |
2826
74bd82edee5a
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2799
diff
changeset
|
254 |
Error handle:[:ex | |
3394 | 255 |
('FlyByhelp [warning]: error while asking for helpText: ',ex description) errorPrintCR. |
256 |
ex suspendedContext fullPrintAllOn:Transcript. |
|
2872
ea7e6fe01727
comment/format in: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
257 |
"/ self halt. |
2826
74bd82edee5a
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2799
diff
changeset
|
258 |
] do:[ |
74bd82edee5a
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2799
diff
changeset
|
259 |
text := self helpTextFor:aView at:aPointOrNil. |
74bd82edee5a
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2799
diff
changeset
|
260 |
]. |
2684 | 261 |
] valueWithWatchDog:[ ^ self ] afterMilliseconds:(self flyByHelpTimeoutMillis). |
2679
552847065fb3
car not to hog the cpu by flyByHelp processing
Claus Gittinger <cg@exept.de>
parents:
2651
diff
changeset
|
262 |
|
1536 | 263 |
lastHelpText = text ifTrue:[ |
3228 | 264 |
lastHelpWidget == aView ifTrue:[ |
265 |
self toolTipFollowsMouse ifFalse:[ |
|
266 |
^ self |
|
267 |
] |
|
2392 | 268 |
] |
1536 | 269 |
]. |
270 |
||
271 |
text size > 0 ifTrue:[ |
|
2778 | 272 |
(showItNow not and:[(delayTime := self delayTime) > 0]) ifTrue:[ |
1536 | 273 |
self stopHelpDisplayProcess. |
2392 | 274 |
showProcess := |
275 |
[ |
|
2680 | 276 |
Delay waitForSeconds:delayTime. |
2774
7894ba397774
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2754
diff
changeset
|
277 |
[ |
7894ba397774
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2754
diff
changeset
|
278 |
aView device anyButtonPressed ifFalse:[ |
2777
4cdef981fdb3
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
279 |
showProcess := nil. |
2774
7894ba397774
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2754
diff
changeset
|
280 |
self showHelp:text for:aView |
7894ba397774
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2754
diff
changeset
|
281 |
] |
7894ba397774
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2754
diff
changeset
|
282 |
] ensure:[ |
7894ba397774
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2754
diff
changeset
|
283 |
showProcess := nil. |
2680 | 284 |
] |
2392 | 285 |
] forkAt:(Processor userSchedulingPriority + 1). |
1536 | 286 |
] ifFalse:[ |
287 |
self showHelp:text for:aView |
|
288 |
] |
|
1542 | 289 |
] ifFalse:[ |
290 |
self hideHelp |
|
1536 | 291 |
]. |
2872
ea7e6fe01727
comment/format in: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2848
diff
changeset
|
292 |
|
2901
fed697afcef8
changed: #initiateHelpFor:at:now:
Claus Gittinger <cg@exept.de>
parents:
2900
diff
changeset
|
293 |
"Modified: / 22-03-2011 / 19:10:28 / cg" |
1536 | 294 |
! ! |
295 |
||
2392 | 296 |
!FlyByHelp methodsFor:'queries'! |
297 |
||
2692 | 298 |
currentlyShownView |
299 |
^ currentHelpView |
|
300 |
! |
|
301 |
||
2392 | 302 |
toolTipFollowsMouse |
303 |
^ false |
|
304 |
! ! |
|
305 |
||
1768 | 306 |
!FlyByHelp methodsFor:'show & hide help'! |
1536 | 307 |
|
3248
d72c8e4f7684
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
3247
diff
changeset
|
308 |
activeHelpViewForApplication:applicationOrNil text:helpText onDevice:aDevice |
d72c8e4f7684
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
3247
diff
changeset
|
309 |
applicationOrNil notNil ifTrue:[ |
d72c8e4f7684
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
3247
diff
changeset
|
310 |
^ applicationOrNil activeHelpViewFor:helpText onDevice:aDevice |
d72c8e4f7684
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
3247
diff
changeset
|
311 |
]. |
d72c8e4f7684
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
3247
diff
changeset
|
312 |
^ ActiveHelpView for:helpText onDevice:aDevice. |
d72c8e4f7684
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
3247
diff
changeset
|
313 |
! |
d72c8e4f7684
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
3247
diff
changeset
|
314 |
|
1536 | 315 |
hideHelp |
316 |
"hide the help text" |
|
317 |
||
318 |
|p| |
|
319 |
||
3198 | 320 |
"/ lastHelpText := nil. |
1536 | 321 |
self stopHelpDisplayProcess. |
3258 | 322 |
lastHelpText := nil. |
1536 | 323 |
|
324 |
currentHelpView notNil ifTrue:[ |
|
325 |
[ |
|
2780 | 326 |
currentHelpView notNil ifTrue:[ |
327 |
currentHelpView unmap. |
|
328 |
currentHelpView destroy. |
|
329 |
currentHelpView := nil. |
|
330 |
currentView := nil. |
|
331 |
] |
|
1536 | 332 |
] valueUninterruptably |
333 |
]. |
|
334 |
currentFrame := nil. |
|
3198 | 335 |
(p := closeProcess) notNil ifTrue:[ |
336 |
closeProcess := nil. |
|
1536 | 337 |
p terminate. |
338 |
] |
|
339 |
||
340 |
"Modified: 28.6.1997 / 14:03:50 / cg" |
|
341 |
! |
|
342 |
||
343 |
showHelp:aHelpText for:view |
|
344 |
"show the help text for aView" |
|
345 |
||
3251
afc7d588b25b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
346 |
|wg applicationOrNil org p v dev helpTextShown textLines |
3334 | 347 |
helpViewWidth helpViewHeight usableWidth monitorBounds usableHeight |
348 |
showTime| |
|
1536 | 349 |
|
2781 | 350 |
"/ thisContext fullPrintAllOn:Transcript. |
2651 | 351 |
(wg := view windowGroup) notNil ifTrue:[ |
352 |
wg isInModalLoop ifTrue:[ |
|
353 |
wg isModal ifFalse:[ |
|
354 |
^ self |
|
355 |
]. |
|
2628
03a41945fb37
do not show flyBy help for a view,
Claus Gittinger <cg@exept.de>
parents:
2612
diff
changeset
|
356 |
]. |
03a41945fb37
do not show flyBy help for a view,
Claus Gittinger <cg@exept.de>
parents:
2612
diff
changeset
|
357 |
]. |
03a41945fb37
do not show flyBy help for a view,
Claus Gittinger <cg@exept.de>
parents:
2612
diff
changeset
|
358 |
|
1536 | 359 |
view == currentView ifTrue:[ |
360 |
lastHelpText = aHelpText ifTrue:[ |
|
361 |
^ self |
|
362 |
] |
|
363 |
]. |
|
3228 | 364 |
lastHelpWidget := view. |
1536 | 365 |
|
366 |
lastHelpText := aHelpText. |
|
3251
afc7d588b25b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
367 |
helpTextShown := aHelpText. |
3257 | 368 |
"/ the text originator must already have generated CRs; |
369 |
"/ no longer done here (otherwise, we could not generate tooltips with windows filenames in it) |
|
370 |
textLines := helpTextShown "withCRs" asCollectionOfLines asStringCollection. |
|
3255 | 371 |
textLines size > (self class maxNumberOfLines) ifTrue:[ |
372 |
textLines := (textLines copyTo:(self class maxNumberOfLines)) copyWith:'...' |
|
3251
afc7d588b25b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
373 |
]. |
3255 | 374 |
textLines := textLines collect:[:l | l contractAtEndTo:(self class maxNumberOfColumns)]. |
3251
afc7d588b25b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
375 |
helpTextShown := textLines asString. |
1536 | 376 |
|
2780 | 377 |
(p := closeProcess) notNil ifTrue:[ |
378 |
closeProcess := nil. |
|
1536 | 379 |
p terminate. |
380 |
]. |
|
381 |
currentHelpView notNil ifTrue:[ |
|
382 |
self hideHelp |
|
383 |
]. |
|
384 |
||
385 |
org := view originRelativeTo:nil. |
|
386 |
currentFrame := org extent:view extent. |
|
2848 | 387 |
org := org + (view extent // 2). |
1536 | 388 |
|
1677
dc49ab70b762
open helpView on the correcdt device
Claus Gittinger <cg@exept.de>
parents:
1657
diff
changeset
|
389 |
dev := view graphicsDevice. |
3248
d72c8e4f7684
more control over the shape style
Claus Gittinger <cg@exept.de>
parents:
3247
diff
changeset
|
390 |
wg notNil ifTrue:[ applicationOrNil := wg application ]. |
3251
afc7d588b25b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
391 |
v := self activeHelpViewForApplication:applicationOrNil text:helpTextShown onDevice:dev. |
afc7d588b25b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
392 |
v perform:#controllingHelpListener: with:self ifNotUnderstood:[]. |
1536 | 393 |
|
2848 | 394 |
helpViewWidth := v width. |
395 |
helpViewHeight := v height. |
|
1677
dc49ab70b762
open helpView on the correcdt device
Claus Gittinger <cg@exept.de>
parents:
1657
diff
changeset
|
396 |
|
3114 | 397 |
org := dev pointerPosition + (0@18"24"). |
398 |
monitorBounds := dev monitorBoundsAt:org. |
|
399 |
usableWidth := monitorBounds width - 2. |
|
400 |
usableHeight := dev usableHeightAt:org. |
|
401 |
||
402 |
helpViewWidth > usableWidth ifTrue:[v width:(helpViewWidth := usableWidth)]. |
|
3247 | 403 |
helpViewHeight > usableHeight ifTrue:[v height:(helpViewHeight := usableHeight)]. |
3114 | 404 |
|
405 |
(org x + helpViewWidth) > (monitorBounds left + usableWidth) ifTrue:[ |
|
406 |
org := ((monitorBounds left + usableWidth - helpViewWidth) @ org y). |
|
1536 | 407 |
]. |
3114 | 408 |
(org y + helpViewHeight) > (monitorBounds top + usableHeight) ifTrue:[ |
409 |
org := org x @ (monitorBounds top + usableHeight - helpViewHeight). |
|
1536 | 410 |
]. |
411 |
||
412 |
v origin:org. |
|
413 |
v realize. |
|
414 |
v enableButtonMotionEvents. |
|
415 |
v enableMotionEvents. |
|
416 |
currentHelpView := v. |
|
2392 | 417 |
currentView := view. |
1536 | 418 |
|
3334 | 419 |
showTime := self showTime. |
420 |
(showTime notNil and:[showTime > 0]) ifTrue:[ |
|
2392 | 421 |
closeProcess := [ |
1546 | 422 |
[ |
3334 | 423 |
(Delay forSeconds:showTime) wait. |
2392 | 424 |
[ |
2780 | 425 |
|v| |
426 |
(v := currentHelpView) notNil ifTrue:[ |
|
2392 | 427 |
currentHelpView := nil. |
2780 | 428 |
v unmap. |
429 |
v destroy. |
|
2392 | 430 |
] |
431 |
] valueUninterruptably |
|
432 |
] ifCurtailed:[ |
|
433 |
closeProcess := nil. |
|
434 |
]. |
|
435 |
] newProcess. |
|
436 |
closeProcess priority:(Processor userSchedulingPriority + 1). |
|
437 |
closeProcess resume. |
|
438 |
]. |
|
1536 | 439 |
|
1963
fb6663696d20
removed withCRs in showHelp:
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
440 |
"Modified: / 31-08-1995 / 19:20:45 / claus" |
2848 | 441 |
"Modified: / 16-07-2010 / 14:33:13 / cg" |
1536 | 442 |
! |
443 |
||
444 |
stopHelpDisplayProcess |
|
445 |
|p| |
|
446 |
||
2680 | 447 |
(p := showProcess) notNil ifTrue:[ |
448 |
showProcess := nil. |
|
1536 | 449 |
p terminate. |
450 |
]. |
|
451 |
||
452 |
"Created: 28.6.1997 / 14:03:17 / cg" |
|
453 |
! ! |
|
454 |
||
455 |
!FlyByHelp class methodsFor:'documentation'! |
|
456 |
||
2979
306456bdfb61
comment in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2978
diff
changeset
|
457 |
version |
3394 | 458 |
^ '$Header: /cvs/stx/stx/libview2/FlyByHelp.st,v 1.68 2014-11-19 19:56:18 cg Exp $' |
2979
306456bdfb61
comment in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2978
diff
changeset
|
459 |
! |
306456bdfb61
comment in: #keyPress:x:y:view:
Claus Gittinger <cg@exept.de>
parents:
2978
diff
changeset
|
460 |
|
2754 | 461 |
version_CVS |
3394 | 462 |
^ '$Header: /cvs/stx/stx/libview2/FlyByHelp.st,v 1.68 2014-11-19 19:56:18 cg Exp $' |
1536 | 463 |
! ! |
3114 | 464 |