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