author | Claus Gittinger <cg@exept.de> |
Wed, 29 Oct 1997 19:03:07 +0100 | |
changeset 363 | 10683a97de93 |
parent 354 | a6de8821d3bf |
child 369 | 9d34f1ff4d29 |
permissions | -rw-r--r-- |
156 | 1 |
" |
2 |
COPYRIGHT (c) 1995 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 |
" |
|
12 |
||
13 |
||
14 |
||
148 | 15 |
ApplicationModel subclass:#UIHelpTool |
286 | 16 |
instanceVariableNames:'specClass dictionary listSelection maxCharsPerLine modifiedHolder' |
148 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-UIPainter' |
|
20 |
! |
|
21 |
||
22 |
!UIHelpTool class methodsFor:'documentation'! |
|
23 |
||
156 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1995 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
||
37 |
||
38 |
! |
|
39 |
||
148 | 40 |
documentation |
41 |
" |
|
42 |
used by the UIPainter to add help text to any component which will be shown |
|
43 |
during runing an application with enabled activeHelp mode. |
|
156 | 44 |
|
45 |
[author:] |
|
46 |
Claus Atzkern |
|
148 | 47 |
" |
48 |
! ! |
|
49 |
||
286 | 50 |
!UIHelpTool class methodsFor:'instance creation'! |
51 |
||
52 |
openOnClass:aClass |
|
53 |
" |
|
54 |
UIHelpTool openOnClass:UIPainter |
|
55 |
" |
|
56 |
|helpTool| |
|
57 |
||
58 |
helpTool := UIHelpTool new. |
|
59 |
helpTool openInterface:#standAloneSpec. |
|
292 | 60 |
helpTool helpSpecFrom:aClass |
286 | 61 |
|
62 |
||
63 |
! ! |
|
64 |
||
65 |
!UIHelpTool class methodsFor:'constants'! |
|
66 |
||
67 |
label |
|
68 |
^ 'Help' |
|
69 |
! ! |
|
70 |
||
151 | 71 |
!UIHelpTool class methodsFor:'help specs'! |
72 |
||
73 |
helpSpec |
|
74 |
"return a dictionary filled with helpKey -> helptext associations. |
|
292 | 75 |
These are used by the activeHelp tool." |
76 |
||
172 | 77 |
" |
292 | 78 |
UIHelpTool openOnClass:UIHelpTool |
79 |
" |
|
80 |
||
172 | 81 |
^ super helpSpec addPairsFrom:#( |
151 | 82 |
|
172 | 83 |
#activeHelpAccessKey |
286 | 84 |
'This ID is used to access an active help text for the selected component' |
172 | 85 |
|
86 |
) |
|
151 | 87 |
! ! |
88 |
||
148 | 89 |
!UIHelpTool class methodsFor:'interface specs'! |
90 |
||
354 | 91 |
keyMenu |
92 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
93 |
||
94 |
"do not manually edit this - the builder may not be able to |
|
95 |
handle the specification if its corrupted." |
|
96 |
||
97 |
" |
|
98 |
MenuEditor new openOnClass:UIHelpTool andSelector:#keyMenu |
|
99 |
(Menu new fromLiteralArrayEncoding:(UIHelpTool keyMenu)) startUp |
|
100 |
" |
|
101 |
||
102 |
<resource: #menu> |
|
103 |
||
104 |
^ |
|
105 |
||
106 |
#(#Menu |
|
107 |
||
108 |
#( |
|
109 |
#(#MenuItem |
|
110 |
#'label:' 'new key ...' |
|
111 |
#'value:' #newKey |
|
112 |
) |
|
113 |
#(#MenuItem |
|
114 |
#'label:' '-' |
|
115 |
) |
|
116 |
#(#MenuItem |
|
117 |
#'label:' 'remove' |
|
118 |
#'value:' #removeKey |
|
119 |
) |
|
120 |
) nil |
|
121 |
nil |
|
122 |
) |
|
123 |
||
124 |
"Created: / 27.10.1997 / 00:55:20 / cg" |
|
125 |
! |
|
126 |
||
286 | 127 |
menuPanelStandAlone |
128 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
129 |
||
130 |
"do not manually edit this - the builder may not be able to |
|
131 |
handle the specification if its corrupted." |
|
132 |
||
133 |
" |
|
134 |
MenuEditor new openOnClass:UIHelpTool andSelector:#menuPanelStandAlone |
|
135 |
(Menu new fromLiteralArrayEncoding:(UIHelpTool menuPanelStandAlone)) startUp |
|
136 |
" |
|
137 |
||
138 |
<resource: #menu> |
|
139 |
||
140 |
^ |
|
141 |
||
142 |
#(#Menu |
|
143 |
||
144 |
#( |
|
145 |
#(#MenuItem |
|
146 |
#'label:' 'file' |
|
147 |
#'submenu:' |
|
148 |
#(#Menu |
|
149 |
||
150 |
#( |
|
151 |
#(#MenuItem |
|
152 |
#'label:' 'reload' |
|
153 |
#'value:' #doReload |
|
154 |
) |
|
155 |
#(#MenuItem |
|
156 |
#'label:' '-' |
|
157 |
) |
|
158 |
#(#MenuItem |
|
292 | 159 |
#'label:' 'quit' |
286 | 160 |
#'value:' #closeRequest |
161 |
) |
|
162 |
) nil |
|
163 |
nil |
|
164 |
) |
|
165 |
) |
|
166 |
#(#MenuItem |
|
167 |
#'label:' 'code' |
|
168 |
#'submenu:' |
|
169 |
#(#Menu |
|
170 |
||
171 |
#( |
|
172 |
#(#MenuItem |
|
173 |
#'label:' 'class' |
|
174 |
#'value:' #doFromClass |
|
175 |
) |
|
176 |
#(#MenuItem |
|
177 |
#'label:' '-' |
|
178 |
) |
|
179 |
#(#MenuItem |
|
180 |
#'label:' 'install help spec.' |
|
181 |
#'value:' #doInstallHelpSpec |
|
182 |
) |
|
183 |
) nil |
|
184 |
nil |
|
185 |
) |
|
186 |
) |
|
187 |
) nil |
|
188 |
nil |
|
189 |
) |
|
190 |
! |
|
191 |
||
192 |
standAloneSpec |
|
193 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
194 |
||
195 |
"do not manually edit this - the painter/builder may not be able to |
|
196 |
handle the specification if its corrupted." |
|
197 |
||
198 |
" |
|
199 |
UIPainter new openOnClass:UIHelpTool andSelector:#standAloneSpec |
|
200 |
UIHelpTool new openInterface:#standAloneSpec |
|
201 |
" |
|
202 |
||
203 |
<resource: #canvas> |
|
204 |
||
205 |
^ |
|
206 |
||
207 |
#(#FullSpec |
|
208 |
#'window:' |
|
209 |
#(#WindowSpec |
|
210 |
#'name:' 'HelpTool' |
|
354 | 211 |
#'layout:' #(#LayoutFrame 176 0 150 0 771 0 647 0) |
286 | 212 |
#'label:' 'HelpTool' |
213 |
#'min:' #(#Point 10 10) |
|
214 |
#'max:' #(#Point 1160 870) |
|
354 | 215 |
#'bounds:' #(#Rectangle 176 150 772 648) |
286 | 216 |
) |
217 |
#'component:' |
|
218 |
#(#SpecCollection |
|
219 |
#'collection:' |
|
220 |
#( |
|
221 |
#(#MenuPanelSpec |
|
222 |
#'name:' 'menuPanelStandAlone' |
|
223 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0) |
|
224 |
#'menu:' #menuPanelStandAlone |
|
225 |
) |
|
226 |
#(#VariableHorizontalPanelSpec |
|
227 |
#'name:' 'variableHorizontalPanel1' |
|
228 |
#'layout:' #(#LayoutFrame 0 0.0 25 0.0 0 1.0 0 1.0) |
|
229 |
#'component:' |
|
230 |
#(#SpecCollection |
|
231 |
#'collection:' |
|
232 |
#( |
|
233 |
#(#TextEditorSpec |
|
234 |
#'name:' 'textView' |
|
235 |
#'hasHorizontalScrollBar:' true |
|
236 |
#'hasVerticalScrollBar:' true |
|
237 |
#'miniScrollerHorizontal:' true |
|
238 |
#'miniScrollerVertical:' true |
|
239 |
) |
|
240 |
#(#SequenceViewSpec |
|
241 |
#'name:' 'selectionList' |
|
339 | 242 |
#'model:' #listModel |
354 | 243 |
#'menu:' #keyMenu |
286 | 244 |
#'hasHorizontalScrollBar:' true |
245 |
#'hasVerticalScrollBar:' true |
|
246 |
#'miniScrollerHorizontal:' true |
|
247 |
#'miniScrollerVertical:' true |
|
339 | 248 |
#'useIndex:' false |
249 |
#'sequenceList:' #listChannel |
|
286 | 250 |
) |
251 |
) |
|
252 |
) |
|
339 | 253 |
#'handles:' #(#Any 0.5 1.0) |
286 | 254 |
) |
255 |
) |
|
256 |
) |
|
257 |
) |
|
354 | 258 |
|
259 |
"Modified: / 27.10.1997 / 00:55:35 / cg" |
|
286 | 260 |
! |
261 |
||
148 | 262 |
windowSpec |
263 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
264 |
||
265 |
"do not manually edit this - the painter/builder may not be able to |
|
266 |
handle the specification if its corrupted." |
|
267 |
||
268 |
" |
|
151 | 269 |
UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec |
270 |
UIHelpTool new openInterface:#windowSpec |
|
148 | 271 |
" |
151 | 272 |
"UIHelpTool open" |
148 | 273 |
|
274 |
<resource: #canvas> |
|
275 |
||
276 |
^ |
|
277 |
||
278 |
#(#FullSpec |
|
279 |
#'window:' |
|
280 |
#(#WindowSpec |
|
286 | 281 |
#'name:' 'HelpTool' |
282 |
#'layout:' #(#LayoutFrame 199 0 167 0 484 0 437 0) |
|
148 | 283 |
#'label:' 'unnamed canvas' |
286 | 284 |
#'min:' #(#Point 10 10) |
285 |
#'max:' #(#Point 1160 870) |
|
286 |
#'bounds:' #(#Rectangle 199 167 485 438) |
|
148 | 287 |
) |
288 |
#'component:' |
|
289 |
#(#SpecCollection |
|
290 |
#'collection:' |
|
291 |
#( |
|
286 | 292 |
#(#LabelSpec |
293 |
#'name:' 'keyLabel' |
|
294 |
#'layout:' #(#AlignmentOrigin 3 0.0 42 0.0 0 1) |
|
295 |
#'label:' 'Key:' |
|
296 |
#'adjust:' #left |
|
297 |
#'resizeForLabel:' true |
|
298 |
) |
|
299 |
#(#ComboBoxSpec |
|
300 |
#'name:' 'comboBox' |
|
301 |
#'layout:' #(#LayoutFrame 48 0 22 0 -3 1.0 44 0) |
|
302 |
#'activeHelpKey:' #activeHelpAccessKey |
|
303 |
#'tabable:' true |
|
304 |
#'model:' #listModel |
|
305 |
#'type:' #symbolOrNil |
|
306 |
#'comboList:' #listChannel |
|
307 |
) |
|
148 | 308 |
#(#TextEditorSpec |
309 |
#'name:' 'textView' |
|
286 | 310 |
#'layout:' #(#LayoutFrame 3 0.0 45 0.0 -3 1.0 -3 1.0) |
148 | 311 |
#'hasHorizontalScrollBar:' true |
312 |
#'hasVerticalScrollBar:' true |
|
313 |
#'miniScrollerHorizontal:' true |
|
314 |
#'miniScrollerVertical:' true |
|
315 |
) |
|
316 |
) |
|
317 |
) |
|
318 |
) |
|
319 |
! ! |
|
320 |
||
321 |
!UIHelpTool methodsFor:'accessing'! |
|
322 |
||
151 | 323 |
dictionary |
324 |
"return the value of the instance variable 'dictionary' (automatically generated)" |
|
325 |
||
326 |
^ dictionary! |
|
327 |
||
328 |
dictionary:aDictionary |
|
329 |
"set the value of the instance variable 'dictionary' (automatically generated)" |
|
330 |
||
286 | 331 |
(dictionary := aDictionary) isNil ifTrue:[ |
204 | 332 |
dictionary := IdentityDictionary new. |
286 | 333 |
]. |
334 |
self updateList |
|
335 |
! |
|
336 |
||
337 |
helpKey |
|
338 |
listSelection size ~~ 0 ifTrue:[ |
|
339 |
^ listSelection asSymbol |
|
151 | 340 |
]. |
286 | 341 |
^ nil |
342 |
! |
|
343 |
||
344 |
helpKey:aKey |
|
345 |
|key| |
|
346 |
||
347 |
aKey size ~~ 0 ifTrue:[ |
|
348 |
key := aKey asString |
|
349 |
]. |
|
350 |
self listModel value:key |
|
151 | 351 |
! |
352 |
||
196 | 353 |
helpSpecFrom:aClass |
354 |
"read help text from an application associated with the class |
|
355 |
" |
|
286 | 356 |
|help| |
357 |
||
335 | 358 |
specClass := self applicationClassAssociatedWith:aClass. |
196 | 359 |
|
286 | 360 |
(specClass respondsTo:#helpSpec) ifTrue:[ |
361 |
help := specClass helpSpec |
|
362 |
] ifFalse:[ |
|
363 |
specClass := nil |
|
196 | 364 |
]. |
365 |
self dictionary:help |
|
366 |
! |
|
367 |
||
286 | 368 |
modifiedHolder:aValueHolder |
369 |
"set the value holder set to true in case of modifying attributes |
|
148 | 370 |
" |
286 | 371 |
modifiedHolder notNil ifTrue:[ |
372 |
modifiedHolder removeDependent:self. |
|
373 |
]. |
|
148 | 374 |
|
286 | 375 |
(modifiedHolder := aValueHolder) notNil ifTrue:[ |
376 |
modifiedHolder addDependent:self. |
|
148 | 377 |
]. |
286 | 378 |
|
379 |
||
148 | 380 |
! |
381 |
||
286 | 382 |
updateList |
383 |
"update list from dictionary |
|
148 | 384 |
" |
286 | 385 |
self listChannel value:(dictionary keys asSortedCollection) |
148 | 386 |
! ! |
387 |
||
354 | 388 |
!UIHelpTool methodsFor:'accessing menu'! |
389 |
||
390 |
keyMenu |
|
391 |
"this window spec was automatically generated by the UI Builder" |
|
392 |
||
393 |
^ self class keyMenu |
|
394 |
||
395 |
"Created: / 27.10.1997 / 00:55:20 / cg" |
|
396 |
! ! |
|
397 |
||
148 | 398 |
!UIHelpTool methodsFor:'actions'! |
399 |
||
400 |
accept |
|
401 |
"accept the text |
|
402 |
" |
|
286 | 403 |
|view key txt list| |
148 | 404 |
|
286 | 405 |
(listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[ |
406 |
txt := view contents asString. |
|
407 |
key := listSelection asSymbol. |
|
408 |
list := self listChannel value. |
|
148 | 409 |
|
410 |
(dictionary at:key ifAbsent:nil) isNil ifTrue:[ |
|
411 |
list add:key. |
|
412 |
]. |
|
286 | 413 |
dictionary at:key put:txt |
148 | 414 |
] |
196 | 415 |
! |
416 |
||
417 |
installHelpSpecInto:aClass |
|
418 |
"install help text |
|
419 |
" |
|
354 | 420 |
|cls src order| |
196 | 421 |
|
335 | 422 |
cls := self applicationClassAssociatedWith:aClass. |
196 | 423 |
|
424 |
cls isNil ifTrue:[ |
|
425 |
^ self information:'no application class defined'. |
|
426 |
]. |
|
427 |
dictionary isEmpty ifTrue:[ |
|
428 |
^ self information:'no help text defined' |
|
429 |
]. |
|
430 |
src := '' writeStream. |
|
431 |
||
432 |
src nextPutAll: |
|
433 |
||
434 |
'helpSpec |
|
435 |
"return a dictionary filled with helpKey -> helptext associations. |
|
292 | 436 |
These are used by the activeHelp tool." |
437 |
||
196 | 438 |
" |
292 | 439 |
UIHelpTool openOnClass:', cls name asString ,' |
440 |
" |
|
441 |
||
196 | 442 |
^ super helpSpec addPairsFrom:#( |
443 |
||
444 |
'. |
|
445 |
||
354 | 446 |
order := dictionary keys asSortedCollection. |
447 |
order do:[:key | |
|
448 |
|txt t| |
|
449 |
||
450 |
txt := dictionary at:key. |
|
196 | 451 |
src nextPutLine:key storeString. |
452 |
||
319
f16aa0e8541e
dont crash with nonexisting bitmaps
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
453 |
t := txt asString replaceAll:(Character cr) with:(Character space). |
286 | 454 |
|
455 |
(t endsWith:Character space) ifTrue:[ |
|
196 | 456 |
t := t copyWithoutLast:1 |
457 |
]. |
|
458 |
src nextPutLine:t storeString; cr. |
|
459 |
]. |
|
460 |
src nextPutLine:')'. |
|
461 |
||
462 |
Compiler compile:(src contents) |
|
463 |
forClass:cls class |
|
464 |
inCategory:'help specs' |
|
465 |
||
354 | 466 |
"Modified: / 26.10.1997 / 23:01:44 / cg" |
148 | 467 |
! ! |
468 |
||
469 |
!UIHelpTool methodsFor:'aspects'! |
|
470 |
||
471 |
listChannel |
|
472 |
"automatically generated by UIPainter ..." |
|
473 |
||
474 |
|holder| |
|
475 |
||
476 |
(holder := builder bindingAt:#listChannel) isNil ifTrue:[ |
|
354 | 477 |
builder aspectAt:#listChannel put:(holder := OrderedCollection new asValue). |
148 | 478 |
]. |
479 |
^ holder |
|
354 | 480 |
|
481 |
"Modified: / 27.10.1997 / 01:50:33 / cg" |
|
148 | 482 |
! |
483 |
||
286 | 484 |
listModel |
148 | 485 |
"automatically generated by UIPainter ..." |
486 |
||
487 |
|holder| |
|
488 |
||
286 | 489 |
(holder := builder bindingAt:#listModel) isNil ifTrue:[ |
490 |
holder := AspectAdaptor new subject:self; forAspect:#listSelection. |
|
491 |
builder aspectAt:#listModel put:holder. |
|
148 | 492 |
]. |
493 |
^ holder |
|
494 |
! ! |
|
495 |
||
496 |
!UIHelpTool methodsFor:'initialization'! |
|
497 |
||
498 |
initialize |
|
499 |
"setup instance attributes |
|
500 |
" |
|
501 |
super initialize. |
|
286 | 502 |
dictionary := IdentityDictionary new. |
503 |
! ! |
|
504 |
||
354 | 505 |
!UIHelpTool methodsFor:'menu actions'! |
506 |
||
507 |
newKey |
|
508 |
|k sym| |
|
509 |
||
510 |
k := Dialog request:'name of new:'. |
|
511 |
k size > 0 ifTrue:[ |
|
512 |
((dictionary includesKey:k) |
|
513 |
or:[(sym := k asSymbolIfInterned) notNil |
|
514 |
and:[dictionary includesKey:sym]]) |
|
515 |
ifTrue:[ |
|
516 |
^ self warn:'key is already present.'. |
|
517 |
]. |
|
518 |
dictionary at:k asSymbol put:''. |
|
519 |
self updateList |
|
520 |
]. |
|
521 |
||
522 |
"Created: / 27.10.1997 / 01:48:48 / cg" |
|
523 |
"Modified: / 27.10.1997 / 02:24:30 / cg" |
|
524 |
! |
|
525 |
||
526 |
removeKey |
|
527 |
|k sym| |
|
528 |
||
529 |
k := Dialog request:'name of key to remove:' initialAnswer:listSelection. |
|
530 |
k size > 0 ifTrue:[ |
|
531 |
((dictionary includesKey:k) |
|
532 |
or:[(sym := k asSymbolIfInterned) notNil |
|
533 |
and:[dictionary includesKey:sym]]) |
|
534 |
ifFalse:[ |
|
535 |
^ self warn:'key is not present.'. |
|
536 |
]. |
|
537 |
sym notNil ifTrue:[ |
|
538 |
dictionary removeKey:sym ifAbsent:nil. |
|
539 |
]. |
|
540 |
dictionary removeKey:k ifAbsent:nil. |
|
541 |
self updateList |
|
542 |
]. |
|
543 |
||
544 |
"Created: / 27.10.1997 / 01:48:48 / cg" |
|
545 |
"Modified: / 27.10.1997 / 02:25:30 / cg" |
|
546 |
! ! |
|
547 |
||
286 | 548 |
!UIHelpTool methodsFor:'private'! |
549 |
||
550 |
editTextView |
|
551 |
"get the editTextView or nil. |
|
552 |
" |
|
553 |
|view| |
|
554 |
||
555 |
(view := builder componentAt:#textView) notNil ifTrue:[ |
|
556 |
view := view scrolledView. |
|
557 |
||
558 |
view acceptAction isNil ifTrue:[ |
|
559 |
view acceptAction:[:aList| self accept ]. |
|
560 |
]. |
|
561 |
||
562 |
view left ~~ 0 ifTrue:[ |
|
563 |
(maxCharsPerLine := view extent x // view font width) < 10 ifTrue:[ |
|
564 |
maxCharsPerLine := nil |
|
565 |
] |
|
566 |
]. |
|
567 |
]. |
|
568 |
^ view |
|
569 |
! ! |
|
570 |
||
335 | 571 |
!UIHelpTool methodsFor:'queries'! |
572 |
||
573 |
applicationClassAssociatedWith:aClass |
|
574 |
"get application class keeping the associated help text or nil |
|
575 |
" |
|
576 |
|cls| |
|
577 |
||
578 |
cls := self resolveName:aClass. |
|
579 |
||
580 |
(cls notNil and:[cls includesBehavior:UISpecification]) ifTrue:[ |
|
581 |
^ UISpecificationTool |
|
582 |
]. |
|
583 |
^ cls |
|
584 |
||
585 |
||
586 |
! ! |
|
587 |
||
286 | 588 |
!UIHelpTool methodsFor:'selection'! |
589 |
||
590 |
listSelection |
|
591 |
"returns current selection |
|
592 |
" |
|
593 |
^ listSelection |
|
594 |
! |
|
595 |
||
596 |
listSelection:aSelection |
|
597 |
"current selection changed |
|
598 |
" |
|
299 | 599 |
|txt view sel| |
286 | 600 |
|
601 |
aSelection isNumber ifTrue:[ |
|
602 |
aSelection ~~ 0 ifTrue:[ |
|
603 |
sel := self listChannel value at:aSelection |
|
604 |
] |
|
605 |
] ifFalse:[ |
|
606 |
aSelection size ~~ 0 ifTrue:[ |
|
607 |
sel := aSelection withoutSeparators. |
|
608 |
sel size == 0 ifTrue:[ |
|
609 |
sel := nil |
|
610 |
] |
|
611 |
] |
|
612 |
]. |
|
613 |
||
299 | 614 |
listSelection = sel ifFalse:[ |
615 |
listSelection := sel. |
|
286 | 616 |
|
299 | 617 |
modifiedHolder notNil ifTrue:[ |
618 |
modifiedHolder value:true. |
|
619 |
]. |
|
286 | 620 |
|
299 | 621 |
(view := self editTextView) notNil ifTrue:[ |
622 |
listSelection notNil ifTrue:[ |
|
623 |
txt := dictionary at:(listSelection asSymbol) ifAbsent:nil. |
|
286 | 624 |
|
299 | 625 |
(txt isNil or:[maxCharsPerLine isNil]) ifFalse:[ |
626 |
txt := UIPainter convertString:(txt asString) maxLineSize:maxCharsPerLine. |
|
286 | 627 |
] |
628 |
]. |
|
299 | 629 |
view contents:txt. |
630 |
] |
|
631 |
] |
|
286 | 632 |
|
633 |
! ! |
|
634 |
||
635 |
!UIHelpTool methodsFor:'user interactions'! |
|
636 |
||
637 |
doFromClass |
|
638 |
"setup new specification from a class accessed through to a dialog |
|
639 |
" |
|
640 |
|cls accepted| |
|
641 |
||
642 |
specClass notNil ifTrue:[cls := specClass name asValue] |
|
643 |
ifFalse:[cls := '' asValue]. |
|
644 |
||
645 |
[true] whileTrue:[ |
|
646 |
accepted := |
|
647 |
(DialogBox new |
|
648 |
addTextLabel:'Classes name:'; |
|
649 |
addInputFieldOn:cls; |
|
650 |
addAbortButton; |
|
651 |
addOkButton; |
|
652 |
open |
|
653 |
) accepted. |
|
654 |
||
655 |
accepted ifFalse:[^ self]. |
|
335 | 656 |
cls := self applicationClassAssociatedWith:cls value. |
286 | 657 |
|
658 |
cls notNil ifTrue:[ |
|
659 |
^ self helpSpecFrom:cls |
|
660 |
]. |
|
661 |
self warn:'no such class'. |
|
662 |
] |
|
663 |
! |
|
664 |
||
665 |
doInstallHelpSpec |
|
666 |
"install help spec |
|
667 |
" |
|
668 |
self installHelpSpecInto:specClass |
|
669 |
! |
|
670 |
||
671 |
doReload |
|
672 |
"reload specification |
|
673 |
" |
|
674 |
|oldSel model| |
|
675 |
||
676 |
model := self listModel. |
|
677 |
oldSel := model value. |
|
678 |
model value:nil. |
|
679 |
self helpSpecFrom:specClass. |
|
680 |
model value:oldSel. |
|
148 | 681 |
! ! |
682 |
||
683 |
!UIHelpTool class methodsFor:'documentation'! |
|
684 |
||
685 |
version |
|
686 |
^ '$Header$' |
|
687 |
! ! |