author | tz |
Sat, 17 Jan 1998 13:43:56 +0100 | |
changeset 418 | f47e99ae91bc |
parent 393 | a824a3a9b834 |
child 454 | 8b016ffd83ce |
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 |
" |
|
393 | 404 |
|view key txt list listChgd| |
148 | 405 |
|
286 | 406 |
(listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[ |
393 | 407 |
txt := view contents asString. |
408 |
key := listSelection asSymbol. |
|
409 |
list := self listChannel value. |
|
148 | 410 |
|
393 | 411 |
(listChgd := (dictionary at:key ifAbsent:nil) isNil) ifTrue:[ |
148 | 412 |
list add:key. |
413 |
]. |
|
369 | 414 |
dictionary at:key put:txt. |
415 |
isModified := true. |
|
393 | 416 |
|
417 |
listChgd ifTrue:[ |
|
418 |
self updateList |
|
419 |
] |
|
148 | 420 |
] |
196 | 421 |
! |
422 |
||
423 |
installHelpSpecInto:aClass |
|
424 |
"install help text |
|
425 |
" |
|
354 | 426 |
|cls src order| |
196 | 427 |
|
335 | 428 |
cls := self applicationClassAssociatedWith:aClass. |
196 | 429 |
|
430 |
cls isNil ifTrue:[ |
|
431 |
^ self information:'no application class defined'. |
|
432 |
]. |
|
433 |
dictionary isEmpty ifTrue:[ |
|
434 |
^ self information:'no help text defined' |
|
435 |
]. |
|
436 |
src := '' writeStream. |
|
437 |
||
438 |
src nextPutAll: |
|
439 |
||
440 |
'helpSpec |
|
441 |
"return a dictionary filled with helpKey -> helptext associations. |
|
292 | 442 |
These are used by the activeHelp tool." |
443 |
||
196 | 444 |
" |
292 | 445 |
UIHelpTool openOnClass:', cls name asString ,' |
446 |
" |
|
447 |
||
196 | 448 |
^ super helpSpec addPairsFrom:#( |
449 |
||
450 |
'. |
|
451 |
||
354 | 452 |
order := dictionary keys asSortedCollection. |
453 |
order do:[:key | |
|
454 |
|txt t| |
|
455 |
||
456 |
txt := dictionary at:key. |
|
196 | 457 |
src nextPutLine:key storeString. |
458 |
||
319
f16aa0e8541e
dont crash with nonexisting bitmaps
Claus Gittinger <cg@exept.de>
parents:
299
diff
changeset
|
459 |
t := txt asString replaceAll:(Character cr) with:(Character space). |
286 | 460 |
|
461 |
(t endsWith:Character space) ifTrue:[ |
|
196 | 462 |
t := t copyWithoutLast:1 |
463 |
]. |
|
464 |
src nextPutLine:t storeString; cr. |
|
465 |
]. |
|
466 |
src nextPutLine:')'. |
|
467 |
||
468 |
Compiler compile:(src contents) |
|
469 |
forClass:cls class |
|
369 | 470 |
inCategory:'help specs'. |
196 | 471 |
|
369 | 472 |
isModified := false. |
473 |
||
148 | 474 |
! ! |
475 |
||
476 |
!UIHelpTool methodsFor:'aspects'! |
|
477 |
||
478 |
listChannel |
|
479 |
"automatically generated by UIPainter ..." |
|
480 |
||
481 |
|holder| |
|
482 |
||
483 |
(holder := builder bindingAt:#listChannel) isNil ifTrue:[ |
|
354 | 484 |
builder aspectAt:#listChannel put:(holder := OrderedCollection new asValue). |
148 | 485 |
]. |
486 |
^ holder |
|
354 | 487 |
|
488 |
"Modified: / 27.10.1997 / 01:50:33 / cg" |
|
148 | 489 |
! |
490 |
||
286 | 491 |
listModel |
148 | 492 |
"automatically generated by UIPainter ..." |
493 |
||
494 |
|holder| |
|
495 |
||
286 | 496 |
(holder := builder bindingAt:#listModel) isNil ifTrue:[ |
497 |
holder := AspectAdaptor new subject:self; forAspect:#listSelection. |
|
498 |
builder aspectAt:#listModel put:holder. |
|
148 | 499 |
]. |
500 |
^ holder |
|
501 |
! ! |
|
502 |
||
503 |
!UIHelpTool methodsFor:'initialization'! |
|
504 |
||
505 |
initialize |
|
506 |
"setup instance attributes |
|
507 |
" |
|
508 |
super initialize. |
|
286 | 509 |
dictionary := IdentityDictionary new. |
369 | 510 |
isModified := false. |
511 |
||
286 | 512 |
! ! |
513 |
||
354 | 514 |
!UIHelpTool methodsFor:'menu actions'! |
515 |
||
516 |
removeKey |
|
517 |
|k sym| |
|
518 |
||
519 |
k := Dialog request:'name of key to remove:' initialAnswer:listSelection. |
|
520 |
k size > 0 ifTrue:[ |
|
521 |
((dictionary includesKey:k) |
|
522 |
or:[(sym := k asSymbolIfInterned) notNil |
|
523 |
and:[dictionary includesKey:sym]]) |
|
524 |
ifFalse:[ |
|
525 |
^ self warn:'key is not present.'. |
|
526 |
]. |
|
527 |
sym notNil ifTrue:[ |
|
528 |
dictionary removeKey:sym ifAbsent:nil. |
|
529 |
]. |
|
530 |
dictionary removeKey:k ifAbsent:nil. |
|
369 | 531 |
isModified := true. |
354 | 532 |
self updateList |
533 |
]. |
|
534 |
||
535 |
"Created: / 27.10.1997 / 01:48:48 / cg" |
|
536 |
"Modified: / 27.10.1997 / 02:25:30 / cg" |
|
369 | 537 |
! |
538 |
||
539 |
saveAs |
|
540 |
|key new| |
|
541 |
||
542 |
key := Dialog request:'save under key:' initialAnswer:(listSelection ? ''). |
|
543 |
key := key withoutSeparators. |
|
544 |
||
545 |
key size ~~ 0 ifTrue:[ |
|
546 |
key := key asSymbol. |
|
547 |
new := (dictionary at:key ifAbsent:nil) isNil. |
|
548 |
||
549 |
dictionary at:key put:(self editTextView contents asString). |
|
550 |
||
551 |
new ifTrue:[ |
|
552 |
self updateList |
|
553 |
]. |
|
554 |
isModified := true. |
|
555 |
self listModel value:key. |
|
556 |
]. |
|
354 | 557 |
! ! |
558 |
||
286 | 559 |
!UIHelpTool methodsFor:'private'! |
560 |
||
561 |
editTextView |
|
562 |
"get the editTextView or nil. |
|
563 |
" |
|
564 |
|view| |
|
565 |
||
566 |
(view := builder componentAt:#textView) notNil ifTrue:[ |
|
567 |
view := view scrolledView. |
|
568 |
||
569 |
view acceptAction isNil ifTrue:[ |
|
570 |
view acceptAction:[:aList| self accept ]. |
|
571 |
]. |
|
572 |
||
573 |
view left ~~ 0 ifTrue:[ |
|
574 |
(maxCharsPerLine := view extent x // view font width) < 10 ifTrue:[ |
|
575 |
maxCharsPerLine := nil |
|
576 |
] |
|
577 |
]. |
|
578 |
]. |
|
579 |
^ view |
|
580 |
! ! |
|
581 |
||
335 | 582 |
!UIHelpTool methodsFor:'queries'! |
583 |
||
584 |
applicationClassAssociatedWith:aClass |
|
585 |
"get application class keeping the associated help text or nil |
|
586 |
" |
|
587 |
|cls| |
|
588 |
||
589 |
cls := self resolveName:aClass. |
|
590 |
||
591 |
(cls notNil and:[cls includesBehavior:UISpecification]) ifTrue:[ |
|
592 |
^ UISpecificationTool |
|
593 |
]. |
|
594 |
^ cls |
|
595 |
||
596 |
||
369 | 597 |
! |
598 |
||
599 |
isModified |
|
600 |
^ isModified |
|
335 | 601 |
! ! |
602 |
||
286 | 603 |
!UIHelpTool methodsFor:'selection'! |
604 |
||
605 |
listSelection |
|
606 |
"returns current selection |
|
607 |
" |
|
608 |
^ listSelection |
|
609 |
! |
|
610 |
||
611 |
listSelection:aSelection |
|
612 |
"current selection changed |
|
613 |
" |
|
299 | 614 |
|txt view sel| |
286 | 615 |
|
616 |
aSelection isNumber ifTrue:[ |
|
617 |
aSelection ~~ 0 ifTrue:[ |
|
618 |
sel := self listChannel value at:aSelection |
|
619 |
] |
|
620 |
] ifFalse:[ |
|
621 |
aSelection size ~~ 0 ifTrue:[ |
|
622 |
sel := aSelection withoutSeparators. |
|
623 |
sel size == 0 ifTrue:[ |
|
624 |
sel := nil |
|
625 |
] |
|
626 |
] |
|
627 |
]. |
|
628 |
||
299 | 629 |
listSelection = sel ifFalse:[ |
630 |
listSelection := sel. |
|
286 | 631 |
|
299 | 632 |
modifiedHolder notNil ifTrue:[ |
633 |
modifiedHolder value:true. |
|
634 |
]. |
|
286 | 635 |
|
299 | 636 |
(view := self editTextView) notNil ifTrue:[ |
637 |
listSelection notNil ifTrue:[ |
|
638 |
txt := dictionary at:(listSelection asSymbol) ifAbsent:nil. |
|
286 | 639 |
|
299 | 640 |
(txt isNil or:[maxCharsPerLine isNil]) ifFalse:[ |
369 | 641 |
txt := UIPainter convertString:(txt asString) maxLineSize:maxCharsPerLine skipLineFeed:false. |
286 | 642 |
] |
643 |
]. |
|
299 | 644 |
view contents:txt. |
645 |
] |
|
646 |
] |
|
286 | 647 |
|
648 |
! ! |
|
649 |
||
369 | 650 |
!UIHelpTool methodsFor:'startup / release'! |
651 |
||
652 |
closeRequest |
|
653 |
||
654 |
(isModified and:[self masterApplication isNil]) ifTrue:[ |
|
655 |
(self confirm:'quit without without saving your modifications ?') ifFalse:[ |
|
656 |
^ self |
|
657 |
] |
|
658 |
]. |
|
659 |
^ super closeRequest. |
|
660 |
! ! |
|
661 |
||
286 | 662 |
!UIHelpTool methodsFor:'user interactions'! |
663 |
||
664 |
doFromClass |
|
665 |
"setup new specification from a class accessed through to a dialog |
|
666 |
" |
|
667 |
|cls accepted| |
|
668 |
||
669 |
specClass notNil ifTrue:[cls := specClass name asValue] |
|
670 |
ifFalse:[cls := '' asValue]. |
|
671 |
||
672 |
[true] whileTrue:[ |
|
673 |
accepted := |
|
674 |
(DialogBox new |
|
675 |
addTextLabel:'Classes name:'; |
|
676 |
addInputFieldOn:cls; |
|
677 |
addAbortButton; |
|
678 |
addOkButton; |
|
679 |
open |
|
680 |
) accepted. |
|
681 |
||
682 |
accepted ifFalse:[^ self]. |
|
335 | 683 |
cls := self applicationClassAssociatedWith:cls value. |
286 | 684 |
|
685 |
cls notNil ifTrue:[ |
|
686 |
^ self helpSpecFrom:cls |
|
687 |
]. |
|
688 |
self warn:'no such class'. |
|
689 |
] |
|
690 |
! |
|
691 |
||
692 |
doInstallHelpSpec |
|
693 |
"install help spec |
|
694 |
" |
|
695 |
self installHelpSpecInto:specClass |
|
696 |
! |
|
697 |
||
698 |
doReload |
|
699 |
"reload specification |
|
700 |
" |
|
701 |
|oldSel model| |
|
702 |
||
703 |
model := self listModel. |
|
704 |
oldSel := model value. |
|
705 |
model value:nil. |
|
706 |
self helpSpecFrom:specClass. |
|
707 |
model value:oldSel. |
|
369 | 708 |
isModified := false. |
709 |
||
148 | 710 |
! ! |
711 |
||
712 |
!UIHelpTool class methodsFor:'documentation'! |
|
713 |
||
714 |
version |
|
715 |
^ '$Header$' |
|
716 |
! ! |