equal
deleted
inserted
replaced
39 ! |
39 ! |
40 |
40 |
41 documentation |
41 documentation |
42 " |
42 " |
43 The UIHelpTool allows you to define help dictionaries for the widgets in |
43 The UIHelpTool allows you to define help dictionaries for the widgets in |
44 applications. The tool are able to run stand alone or in other master |
44 window applications. The tool are able to run stand alone or in other master |
45 applications like the GUI Painter and the Menu Editor. |
45 applications like the GUI Painter and the Menu Editor. |
46 If the application responds to the selector #showHelp:aHelpText for:aView, |
46 If the application responds to the selector #showHelp:aHelpText for:aView, |
47 this selector is called by the widget's view when the mouse cursor moves over. |
47 this selector is called by the widget's view when the mouse cursor moves over. |
48 If the application does not responds to that selector, and the activeHelp mode |
48 If the application does not responds to that selector, and the activeHelp mode |
49 is enabled, an active help bubble is shown at the widget's view. |
49 is enabled, an active help bubble is shown at the widget's view. |
575 |
575 |
576 buildFromClass:aClass |
576 buildFromClass:aClass |
577 "read the help dictionary from aClass and find remaining classes |
577 "read the help dictionary from aClass and find remaining classes |
578 'between' aClass and ApplicationModel |
578 'between' aClass and ApplicationModel |
579 " |
579 " |
580 |help| |
|
581 |
|
582 modified := false. |
580 modified := false. |
583 specClass notNil |
581 specClass notNil |
584 ifTrue: |
582 ifTrue: |
585 [ |
583 [ |
586 dictionary := Dictionary new. |
584 dictionary := Dictionary new. |
732 ! |
730 ! |
733 |
731 |
734 findHelpSpecForKey: aHelpKey |
732 findHelpSpecForKey: aHelpKey |
735 "find the help spec class including aHelpKey in its help dictionary and make it current |
733 "find the help spec class including aHelpKey in its help dictionary and make it current |
736 " |
734 " |
737 |dictTemp helpSpecClass superHelpSpecKeys helpSpec| |
735 |dictTemp| |
738 |
736 |
739 aHelpKey isNil ifTrue: [^nil]. |
737 aHelpKey isNil ifTrue: [^nil]. |
740 dictTemp := dictionary. |
738 dictTemp := dictionary. |
741 self listOfHelpSpecClasses value do: |
739 self listOfHelpSpecClasses value do: |
742 [:clsName| |
740 [:clsName| |
769 ^cls |
767 ^cls |
770 |
768 |
771 |
769 |
772 ! |
770 ! |
773 |
771 |
|
772 getUnformattedHelpText: aHelpText |
|
773 "unformats aHelpText and returns it" |
|
774 |
|
775 |helpText| |
|
776 helpText := aHelpText asString replaceAll: Character cr with: Character space. |
|
777 (helpText endsWith:Character space) ifTrue:[ |
|
778 helpText := helpText copyWithoutLast:1 |
|
779 ]. |
|
780 ^helpText |
|
781 ! |
|
782 |
774 installHelpSpecOnClass:aClass |
783 installHelpSpecOnClass:aClass |
775 "save the help dicts in aClass which is subclass of ApplicationModel" |
784 "save the help dicts in aClass which is subclass of ApplicationModel" |
776 |
785 |
777 |cls src helpSpec| |
786 |cls src helpSpec| |
778 |
787 |
791 helpSpec := dictionaries |
800 helpSpec := dictionaries |
792 at: cls name |
801 at: cls name |
793 ifAbsent: [specClass notNil |
802 ifAbsent: [specClass notNil |
794 ifTrue: [dictionaries at: aClass put: (self extractHelpSpecForClass: (Smalltalk at: aClass))] |
803 ifTrue: [dictionaries at: aClass put: (self extractHelpSpecForClass: (Smalltalk at: aClass))] |
795 ifFalse: [dictionary size > 0 ifTrue: [dictionary] ifFalse: [Dictionary new]]]. |
804 ifFalse: [dictionary size > 0 ifTrue: [dictionary] ifFalse: [Dictionary new]]]. |
|
805 |
|
806 helpSpec associationsDo: |
|
807 [:h| |
|
808 helpSpec at: h key put: (self getUnformattedHelpText: h value) |
|
809 ]. |
796 |
810 |
797 (cls class implements: specSelector) |
811 (cls class implements: specSelector) |
798 ifTrue: |
812 ifTrue: |
799 [ |
813 [ |
800 |superclassHelpKeys implementedHelpSpec hasChanged| |
814 |superclassHelpKeys implementedHelpSpec hasChanged| |
837 |
851 |
838 ^super ', specSelector, ' addPairsFrom:#( |
852 ^super ', specSelector, ' addPairsFrom:#( |
839 |
853 |
840 '. |
854 '. |
841 |
855 |
842 helpSpec keys asSortedCollection |
856 helpSpec keys asSortedCollection do: |
843 do:[:key | |
857 [:key| |
844 |txt t| |
858 src nextPutLine: key storeString. |
845 |
859 src nextPutLine: (helpSpec at: key) storeString; cr. |
846 txt := helpSpec at:key. |
|
847 src nextPutLine:key storeString. |
|
848 |
|
849 t := txt asString replaceAll:(Character cr) with:(Character space). |
|
850 |
|
851 (t endsWith:Character space) ifTrue:[ |
|
852 t := t copyWithoutLast:1 |
|
853 ]. |
|
854 src nextPutLine:t storeString; cr. |
|
855 ]. |
860 ]. |
856 src nextPutLine:')'. |
861 src nextPutLine:')'. |
857 |
862 |
858 Compiler |
863 Compiler |
859 compile:(src contents) |
864 compile:(src contents) |