help
authorca
Mon, 16 Jun 1997 18:56:52 +0200
changeset 152 2261aa2fa21d
parent 151 8768bf518383
child 153 4be1d6d20a35
help
UIPainter.st
--- a/UIPainter.st	Mon Jun 16 18:54:03 1997 +0200
+++ b/UIPainter.st	Mon Jun 16 18:56:52 1997 +0200
@@ -99,183 +99,6 @@
 
 !UIPainter class methodsFor:'interface specs'!
 
-XXwindowSpec
-    "this window spec was automatically generated by the ST/X UIPainter"
-
-    "do not manually edit this - the painter/builder may not be able to
-     handle the specification if its corrupted."
-
-    "
-     UIPainter new openOnClass:UIPainter andSelector:#windowSpec
-     UIPainter new openInterface:#windowSpec
-    "
-    "UIPainter open"
-
-    <resource: #canvas>
-
-    ^
-     
-       #(#FullSpec
-          #'window:' 
-           #(#WindowSpec
-              #'name:' 'uIPainterView'
-              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
-              #'label:' 'Tree-View'
-              #'bounds:' #(#Rectangle 0 0 478 429)
-          )
-          #'component:' 
-           #(#SpecCollection
-              #'collection:' 
-               #(
-                 #(#MenuPanelSpec
-                    #'name:' 'menuPullDown'
-                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 24 0)
-                    #'tabable:' true
-                    #'menu:' #menuPullDown
-                )
-                 #(#MenuPanelSpec
-                    #'name:' 'menuAlignment'
-                    #'layout:' #(#LayoutFrame 0 0.0 29 0 233 0 54 0)
-                    #'tabable:' true
-                    #'menu:' #menuAlignment
-                    #'showSeparatingLines:' true
-                )
-                 #(#PanelViewSpec
-                    #'name:' 'panelViewButtons'
-                    #'layout:' #(#LayoutFrame -125 1.0 25 0.0 0 1.0 57 0.0)
-                    #'component:' 
-                     #(#SpecCollection
-                        #'collection:' 
-                         #(
-                           #(#ActionButtonSpec
-                              #'name:' 'moveLeft'
-                              #'label:' ''
-                              #'translateLabel:' true
-                              #'labelChannel:' #'LABELb_moveLeft.xbm'
-                              #'tabable:' true
-                              #'defaultable:' true
-                              #'model:' #moveSelectionLeft
-                              #'isTriggerOnDown:' true
-                              #'enableChannel:' #enableChannel
-                              #'autoRepeat:' false
-                              #'extent:' #(#Point 26 24)
-                          )
-                           #(#ActionButtonSpec
-                              #'name:' 'moveRight'
-                              #'label:' ''
-                              #'translateLabel:' true
-                              #'labelChannel:' #'LABELb_moveRight.xbm'
-                              #'tabable:' true
-                              #'defaultable:' true
-                              #'model:' #moveSelectionRight
-                              #'isTriggerOnDown:' true
-                              #'enableChannel:' #enableChannel
-                              #'autoRepeat:' false
-                              #'extent:' #(#Point 26 24)
-                          )
-                           #(#ActionButtonSpec
-                              #'name:' 'moveUp'
-                              #'label:' ''
-                              #'translateLabel:' true
-                              #'labelChannel:' #'LABELb_moveUp.xbm'
-                              #'tabable:' true
-                              #'defaultable:' true
-                              #'model:' #moveSelectionUp
-                              #'isTriggerOnDown:' true
-                              #'enableChannel:' #enableChannel
-                              #'autoRepeat:' false
-                              #'extent:' #(#Point 26 24)
-                          )
-                           #(#ActionButtonSpec
-                              #'name:' 'moveDown'
-                              #'label:' ''
-                              #'translateLabel:' true
-                              #'labelChannel:' #'LABELb_moveDown.xbm'
-                              #'tabable:' true
-                              #'defaultable:' true
-                              #'model:' #moveSelectionDown
-                              #'isTriggerOnDown:' true
-                              #'enableChannel:' #enableChannel
-                              #'autoRepeat:' false
-                              #'extent:' #(#Point 26 24)
-                          )
-                        )
-                    )
-                    #'level:' 1
-                    #'horizontalLayout:' #fitSpace
-                    #'verticalLayout:' #fitSpace
-                    #'horizontalSpace:' 4
-                    #'verticalSpace:' 4
-                )
-                 #(#SequenceViewSpec
-                    #'name:' 'objectTree'
-                    #'layout:' #(#LayoutFrame 0 0.0 59 0.0 0 0.35 0 1.0)
-                    #'enableChannel:' #enableChannel
-                    #'tabable:' true
-                    #'menu:' #objectListMenu
-                    #'model:' #objectList
-                    #'hasHorizontalScrollBar:' true
-                    #'hasVerticalScrollBar:' true
-                    #'miniScrollerHorizontal:' true
-                    #'isMultiSelect:' true
-                    #'doubleClickSelector:' #doubleClick
-                    #'useIndex:' true
-                )
-                 #(#NoteBookViewSpec
-                    #'name:' 'noteBook'
-                    #'layout:' #(#LayoutFrame 0 0.35 59 0.0 0 1.0 -30 1.0)
-                    #'enableChannel:' #enableChannel
-                    #'tabable:' true
-                    #'menu:' #tabList
-                    #'style:' 
-                     #(#FontDescription
-                        #helvetica #medium
-                        #roman #'10'
-                    )
-                    #'model:' #tabModel
-                    #'tabWidget:' #Window
-                    #'canvas:' #noteBookView
-                )
-                 #(#HorizontalPanelViewSpec
-                    #'name:' 'modifyPanel'
-                    #'layout:' #(#LayoutFrame 0 0.35 -30 1.0 0 1.0 0 1.0)
-                    #'component:' 
-                     #(#SpecCollection
-                        #'collection:' 
-                         #(
-                           #(#ActionButtonSpec
-                              #'name:' 'cancelButton'
-                              #'label:' 'cancel'
-                              #'tabable:' true
-                              #'model:' #cancel
-                              #'isTriggerOnDown:' false
-                              #'enableChannel:' #modifiedChannel
-                              #'autoRepeat:' false
-                              #'extent:' #(#Point 151 24)
-                          )
-                           #(#ActionButtonSpec
-                              #'name:' 'acceptButton'
-                              #'label:' 'ok'
-                              #'tabable:' true
-                              #'model:' #accept
-                              #'isTriggerOnDown:' false
-                              #'enableChannel:' #modifiedChannel
-                              #'autoRepeat:' false
-                              #'extent:' #(#Point 151 24)
-                          )
-                        )
-                    )
-                    #'level:' 0
-                    #'horizontalLayout:' #fitSpace
-                    #'verticalLayout:' #fitSpace
-                    #'horizontalSpace:' 3
-                    #'verticalSpace:' 3
-                )
-              )
-          )
-      )
-!
-
 menuAlignment
     ^ #(#Menu #(
                 #(#MenuItem
@@ -421,6 +244,10 @@
                                         #'value:' #doInstallSpec
                                   )
                                  #(#MenuItem
+                                        #'label:' 'install help spec'
+                                        #'value:' #doInstallHelp
+                                  )
+                                 #(#MenuItem
                                         #'label:' 'install aspects'
                                         #'value:' #doInstallAspects
                                   )
@@ -437,7 +264,7 @@
                                         #'value:' #doStartApplication
                                  )
                                 )
-                                #( 1 2 1)
+                                #( 1 3 1)
                                 nil
                           )
          )
@@ -773,8 +600,22 @@
 activeHelpTool
     "automatically generated by UIPainter ..."
 
+    |cls|
+
     activeHelpTool isNil ifTrue:[
-        activeHelpTool := UIHelpTool new
+        activeHelpTool := UIHelpTool new.
+
+        specClass notNil ifTrue:[
+            specClass isBehavior ifFalse:[
+                cls := Smalltalk at:specClass asSymbol
+            ] ifTrue:[
+                cls := specClass
+            ].
+
+            (cls respondsTo:#helpSpec) ifTrue:[
+                activeHelpTool dictionary:(cls helpSpec).
+           ]
+        ].
     ].
     ^ activeHelpTool
 !
@@ -789,8 +630,9 @@
     |l|
 
     (l := self builder componentAt:#helpInfo) notNil ifTrue:[
+        aHelpText replaceAll:(Character cr) by:(Character space).
         l label:aHelpText.
-        ^ true.
+      ^ true.
     ].
     ^ false
 
@@ -853,6 +695,8 @@
         layoutTool := UIPropertyView for:#Dimension     in:noteBook.
         specView   := UIPropertyView for:#Specification in:noteBook.
         channel    := self modifiedChannel.
+        layoutTool masterApplication:self.
+        specView   masterApplication:self.
         layoutTool modifiedHolder:channel.
         specView   modifiedHolder:channel.
         builder aspectAt:#noteBookView put:noteBook.
@@ -1356,6 +1200,49 @@
 
 !
 
+doInstallHelp
+    |dict cls src|
+
+    specClass isNil ifTrue:[
+        ^ self information:'no class defined'
+    ].
+    specClass isBehavior ifFalse:[
+        cls := Smalltalk at:specClass asSymbol
+    ] ifTrue:[
+        cls := specClass
+    ].
+
+    cls isNil ifTrue:[
+        ^ self information:'no class yet'.
+    ].
+
+    activeHelpTool isNil ifTrue:[
+        ^ self information:'no help text defined'
+    ].    
+    dict := activeHelpTool dictionary.
+
+    src := '' writeStream.
+    src nextPutAll:'helpSpec
+    "return a dictionary filled with helpKey -> helptext associations.
+     These are used by the activeHelp tool."
+
+    |dict|
+
+    dict := super helpSpec.
+'.
+
+    dict keysAndValuesDo:[:key :txt |
+        |t|
+
+        t := txt asString.
+        (t endsWith:Character cr) ifTrue:[t := t copyWithoutLast:1].
+        src nextPutLine:'    dict at:' , key storeString , ' put:' , t storeString , '.'.
+    ].
+    src nextPutLine:'    ^ dict'.
+    src := src contents.
+    Compiler compile:src forClass:cls class inCategory:'help specs'
+!
+
 doInstallSpec
     |code|