UIHelpTool.st
changeset 761 91e524583390
parent 750 9b705e31d38e
child 779 2ffa22f97d5d
--- a/UIHelpTool.st	Wed Apr 01 16:46:35 1998 +0200
+++ b/UIHelpTool.st	Wed Apr 01 16:50:37 1998 +0200
@@ -41,7 +41,7 @@
 documentation
 "
     The UIHelpTool allows you to define help dictionaries for the widgets in
-    applications. The tool are able to run stand alone or in other master 
+    window applications. The tool are able to run stand alone or in other master 
     applications like the GUI Painter and the Menu Editor.
     If the application responds to the selector #showHelp:aHelpText for:aView,
     this selector is called by the widget's view when the mouse cursor moves over. 
@@ -577,8 +577,6 @@
     "read the help dictionary from aClass and find remaining classes 
      'between' aClass and ApplicationModel 
     "
-    |help|
-
     modified := false.
     specClass notNil
     ifTrue:
@@ -734,7 +732,7 @@
 findHelpSpecForKey: aHelpKey
     "find the help spec class including aHelpKey in its help dictionary and make it current
     "
-    |dictTemp helpSpecClass superHelpSpecKeys helpSpec|
+    |dictTemp|
 
     aHelpKey isNil ifTrue: [^nil].
     dictTemp := dictionary.
@@ -771,6 +769,17 @@
 
 !
 
+getUnformattedHelpText: aHelpText
+    "unformats aHelpText and returns it"
+
+    |helpText|
+    helpText := aHelpText asString replaceAll: Character cr with: Character space.
+    (helpText endsWith:Character space) ifTrue:[
+        helpText := helpText copyWithoutLast:1
+    ].
+    ^helpText
+!
+
 installHelpSpecOnClass:aClass
     "save the help dicts in aClass which is subclass of ApplicationModel"
 
@@ -794,6 +803,11 @@
             ifTrue:  [dictionaries at: aClass put: (self extractHelpSpecForClass: (Smalltalk at: aClass))]
             ifFalse: [dictionary size > 0 ifTrue: [dictionary] ifFalse: [Dictionary new]]].
 
+    helpSpec associationsDo:
+    [:h|
+        helpSpec at: h key put: (self getUnformattedHelpText: h value)
+    ].
+
     (cls class implements: specSelector) 
     ifTrue: 
     [
@@ -839,19 +853,10 @@
 
 '.
 
-    helpSpec keys asSortedCollection
-    do:[:key |
-        |txt t|
-
-        txt := helpSpec at:key.
-        src nextPutLine:key storeString.
-
-        t := txt asString replaceAll:(Character cr) with:(Character space).
-
-        (t endsWith:Character space) ifTrue:[
-            t := t copyWithoutLast:1
-        ].
-        src nextPutLine:t storeString; cr.
+    helpSpec keys asSortedCollection do:
+    [:key|
+        src nextPutLine: key storeString.
+        src nextPutLine: (helpSpec at: key) storeString; cr.
     ].
     src nextPutLine:')'.