equal
deleted
inserted
replaced
11 " |
11 " |
12 |
12 |
13 |
13 |
14 |
14 |
15 ApplicationModel subclass:#UIHelpTool |
15 ApplicationModel subclass:#UIHelpTool |
16 instanceVariableNames:'specClass dictionary listSelection maxCharsPerLine modifiedHolder' |
16 instanceVariableNames:'isModified specClass dictionary listSelection maxCharsPerLine |
|
17 modifiedHolder' |
17 classVariableNames:'' |
18 classVariableNames:'' |
18 poolDictionaries:'' |
19 poolDictionaries:'' |
19 category:'Interface-UIPainter' |
20 category:'Interface-UIPainter' |
20 ! |
21 ! |
21 |
22 |
105 |
106 |
106 #(#Menu |
107 #(#Menu |
107 |
108 |
108 #( |
109 #( |
109 #(#MenuItem |
110 #(#MenuItem |
110 #'label:' 'new key ...' |
111 #'label:' 'save as ...' |
111 #'value:' #newKey |
112 #'value:' #saveAs |
112 ) |
113 ) |
113 #(#MenuItem |
114 #(#MenuItem |
114 #'label:' '-' |
115 #'label:' '-' |
115 ) |
116 ) |
116 #(#MenuItem |
117 #(#MenuItem |
206 |
207 |
207 #(#FullSpec |
208 #(#FullSpec |
208 #'window:' |
209 #'window:' |
209 #(#WindowSpec |
210 #(#WindowSpec |
210 #'name:' 'HelpTool' |
211 #'name:' 'HelpTool' |
211 #'layout:' #(#LayoutFrame 176 0 150 0 771 0 647 0) |
212 #'layout:' #(#LayoutFrame 219 0 193 0 814 0 690 0) |
212 #'label:' 'HelpTool' |
213 #'label:' 'HelpTool' |
213 #'min:' #(#Point 10 10) |
214 #'min:' #(#Point 10 10) |
214 #'max:' #(#Point 1160 870) |
215 #'max:' #(#Point 1160 870) |
215 #'bounds:' #(#Rectangle 176 150 772 648) |
216 #'bounds:' #(#Rectangle 219 193 815 691) |
|
217 #'usePreferredExtent:' false |
216 ) |
218 ) |
217 #'component:' |
219 #'component:' |
218 #(#SpecCollection |
220 #(#SpecCollection |
219 #'collection:' |
221 #'collection:' |
220 #( |
222 #( |
248 #'useIndex:' false |
250 #'useIndex:' false |
249 #'sequenceList:' #listChannel |
251 #'sequenceList:' #listChannel |
250 ) |
252 ) |
251 ) |
253 ) |
252 ) |
254 ) |
253 #'handles:' #(#Any 0.5 1.0) |
255 #'handles:' #(#Any 0.647651 1.0) |
254 ) |
256 ) |
255 ) |
257 ) |
256 ) |
258 ) |
257 ) |
259 ) |
258 |
|
259 "Modified: / 27.10.1997 / 00:55:35 / cg" |
|
260 ! |
260 ! |
261 |
261 |
262 windowSpec |
262 windowSpec |
263 "this window spec was automatically generated by the ST/X UIPainter" |
263 "this window spec was automatically generated by the ST/X UIPainter" |
264 |
264 |
353 helpSpecFrom:aClass |
353 helpSpecFrom:aClass |
354 "read help text from an application associated with the class |
354 "read help text from an application associated with the class |
355 " |
355 " |
356 |help| |
356 |help| |
357 |
357 |
358 specClass := self applicationClassAssociatedWith:aClass. |
358 specClass := self applicationClassAssociatedWith:aClass. |
|
359 isModified := false. |
359 |
360 |
360 (specClass respondsTo:#helpSpec) ifTrue:[ |
361 (specClass respondsTo:#helpSpec) ifTrue:[ |
361 help := specClass helpSpec |
362 help := specClass helpSpec |
362 ] ifFalse:[ |
363 ] ifFalse:[ |
363 specClass := nil |
364 specClass := nil |
408 list := self listChannel value. |
409 list := self listChannel value. |
409 |
410 |
410 (dictionary at:key ifAbsent:nil) isNil ifTrue:[ |
411 (dictionary at:key ifAbsent:nil) isNil ifTrue:[ |
411 list add:key. |
412 list add:key. |
412 ]. |
413 ]. |
413 dictionary at:key put:txt |
414 dictionary at:key put:txt. |
|
415 isModified := true. |
414 ] |
416 ] |
415 ! |
417 ! |
416 |
418 |
417 installHelpSpecInto:aClass |
419 installHelpSpecInto:aClass |
418 "install help text |
420 "install help text |
459 ]. |
461 ]. |
460 src nextPutLine:')'. |
462 src nextPutLine:')'. |
461 |
463 |
462 Compiler compile:(src contents) |
464 Compiler compile:(src contents) |
463 forClass:cls class |
465 forClass:cls class |
464 inCategory:'help specs' |
466 inCategory:'help specs'. |
465 |
467 |
466 "Modified: / 26.10.1997 / 23:01:44 / cg" |
468 isModified := false. |
|
469 |
467 ! ! |
470 ! ! |
468 |
471 |
469 !UIHelpTool methodsFor:'aspects'! |
472 !UIHelpTool methodsFor:'aspects'! |
470 |
473 |
471 listChannel |
474 listChannel |
498 initialize |
501 initialize |
499 "setup instance attributes |
502 "setup instance attributes |
500 " |
503 " |
501 super initialize. |
504 super initialize. |
502 dictionary := IdentityDictionary new. |
505 dictionary := IdentityDictionary new. |
|
506 isModified := false. |
|
507 |
503 ! ! |
508 ! ! |
504 |
509 |
505 !UIHelpTool methodsFor:'menu actions'! |
510 !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 |
511 |
526 removeKey |
512 removeKey |
527 |k sym| |
513 |k sym| |
528 |
514 |
529 k := Dialog request:'name of key to remove:' initialAnswer:listSelection. |
515 k := Dialog request:'name of key to remove:' initialAnswer:listSelection. |
536 ]. |
522 ]. |
537 sym notNil ifTrue:[ |
523 sym notNil ifTrue:[ |
538 dictionary removeKey:sym ifAbsent:nil. |
524 dictionary removeKey:sym ifAbsent:nil. |
539 ]. |
525 ]. |
540 dictionary removeKey:k ifAbsent:nil. |
526 dictionary removeKey:k ifAbsent:nil. |
|
527 isModified := true. |
541 self updateList |
528 self updateList |
542 ]. |
529 ]. |
543 |
530 |
544 "Created: / 27.10.1997 / 01:48:48 / cg" |
531 "Created: / 27.10.1997 / 01:48:48 / cg" |
545 "Modified: / 27.10.1997 / 02:25:30 / cg" |
532 "Modified: / 27.10.1997 / 02:25:30 / cg" |
|
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 ]. |
546 ! ! |
553 ! ! |
547 |
554 |
548 !UIHelpTool methodsFor:'private'! |
555 !UIHelpTool methodsFor:'private'! |
549 |
556 |
550 editTextView |
557 editTextView |
581 ^ UISpecificationTool |
588 ^ UISpecificationTool |
582 ]. |
589 ]. |
583 ^ cls |
590 ^ cls |
584 |
591 |
585 |
592 |
|
593 ! |
|
594 |
|
595 isModified |
|
596 ^ isModified |
586 ! ! |
597 ! ! |
587 |
598 |
588 !UIHelpTool methodsFor:'selection'! |
599 !UIHelpTool methodsFor:'selection'! |
589 |
600 |
590 listSelection |
601 listSelection |
621 (view := self editTextView) notNil ifTrue:[ |
632 (view := self editTextView) notNil ifTrue:[ |
622 listSelection notNil ifTrue:[ |
633 listSelection notNil ifTrue:[ |
623 txt := dictionary at:(listSelection asSymbol) ifAbsent:nil. |
634 txt := dictionary at:(listSelection asSymbol) ifAbsent:nil. |
624 |
635 |
625 (txt isNil or:[maxCharsPerLine isNil]) ifFalse:[ |
636 (txt isNil or:[maxCharsPerLine isNil]) ifFalse:[ |
626 txt := UIPainter convertString:(txt asString) maxLineSize:maxCharsPerLine. |
637 txt := UIPainter convertString:(txt asString) maxLineSize:maxCharsPerLine skipLineFeed:false. |
627 ] |
638 ] |
628 ]. |
639 ]. |
629 view contents:txt. |
640 view contents:txt. |
630 ] |
641 ] |
631 ] |
642 ] |
632 |
643 |
|
644 ! ! |
|
645 |
|
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. |
633 ! ! |
656 ! ! |
634 |
657 |
635 !UIHelpTool methodsFor:'user interactions'! |
658 !UIHelpTool methodsFor:'user interactions'! |
636 |
659 |
637 doFromClass |
660 doFromClass |
676 model := self listModel. |
699 model := self listModel. |
677 oldSel := model value. |
700 oldSel := model value. |
678 model value:nil. |
701 model value:nil. |
679 self helpSpecFrom:specClass. |
702 self helpSpecFrom:specClass. |
680 model value:oldSel. |
703 model value:oldSel. |
|
704 isModified := false. |
|
705 |
681 ! ! |
706 ! ! |
682 |
707 |
683 !UIHelpTool class methodsFor:'documentation'! |
708 !UIHelpTool class methodsFor:'documentation'! |
684 |
709 |
685 version |
710 version |