HelpTool is seperated like LayoutTool
authorca
Wed, 20 Aug 1997 17:57:49 +0200
changeset 287 1ecabfd468dc
parent 286 23712b1d3f3d
child 288 675327dd4d7d
HelpTool is seperated like LayoutTool
MenuEditor.st
UIPainter.st
--- a/MenuEditor.st	Wed Aug 20 17:55:38 1997 +0200
+++ b/MenuEditor.st	Wed Aug 20 17:57:49 1997 +0200
@@ -13,7 +13,8 @@
 
 
 ApplicationModel subclass:#MenuEditor
-	instanceVariableNames:'specClass tabSelection aspects slices activeHelpTool didInstall'
+	instanceVariableNames:'specClass specCanvas helpCanvas tabSelection aspects slices
+		didInstall'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-UIPainter'
@@ -124,7 +125,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'ClassAndMethodSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'Painter'
               #'bounds:' #(#Rectangle 0 0 391 170)
@@ -220,7 +221,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'ClassDefineSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'Painter'
               #'bounds:' #(#Rectangle 0 0 383 128)
@@ -532,12 +533,12 @@
                        #(#MenuItem
                           #'label:' 'from class ...'
                           #'value:' #doFromClass
-                          #'enabled:' #isOwnerOfHelpTool
+                          #'enabled:' #isStandAlone
                       )
                        #(#MenuItem
                           #'label:' 'pick a menu'
                           #'value:' #doPickAMenu
-                          #'enabled:' #isOwnerOfHelpTool
+                          #'enabled:' #isStandAlone
                       )
                        #(#MenuItem
                           #'label:' '='
@@ -596,7 +597,7 @@
                        #(#MenuItem
                           #'label:' 'class'
                           #'value:' #doDefineClass
-                          #'enabled:' #isOwnerOfHelpTool
+                          #'enabled:' #isStandAlone
                       )
                        #(#MenuItem
                           #'label:' '-'
@@ -608,7 +609,7 @@
                        #(#MenuItem
                           #'label:' 'install help spec.'
                           #'value:' #doInstallHelp
-                          #'enabled:' #isOwnerOfHelpTool
+                          #'enabled:' #isStandAlone
                       )
                        #(#MenuItem
                           #'label:' '='
@@ -651,7 +652,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'MenuEditor'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'Menu Builder'
               #'bounds:' #(#Rectangle 0 0 580 384)
@@ -677,7 +678,7 @@
                     #'model:' #tabModel
                     #'tabWidget:' #Window
                     #'useIndex:' true
-                    #'canvas:' #tabCanvas
+                    #'canvas:' #noteBookView
                 )
                  #(#HorizontalPanelViewSpec
                     #'name:' 'confirmationPanel'
@@ -731,7 +732,6 @@
             (Basics     basicsItemSpec)
             (Details    detailsEditSpec)
             (Misc       miscEditSpec)
-            (Help       help)
       )
 
 !
@@ -741,7 +741,6 @@
             (Basics     basicsLinkSpec)
             (Details    detailsEditSpec)
             (Misc       miscEditSpec)
-            (Help       help)
       )
 
 !
@@ -751,7 +750,6 @@
             (Basics     basicsMenuSpec)
             (Details    detailsEditSpec)
             (Misc       miscEditSpec)
-            (Help       help)
       )
 
 !
@@ -790,7 +788,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'BasicsItemSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'unnamed canvas'
               #'bounds:' #(#Rectangle 0 0 267 319)
@@ -879,7 +877,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'BasicsLinkSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'unnamed canvas'
               #'bounds:' #(#Rectangle 0 0 267 319)
@@ -952,7 +950,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'BasicsMenuSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'unnamed canvas'
               #'bounds:' #(#Rectangle 0 0 267 319)
@@ -1013,7 +1011,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'BasicsRootSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'unnamed canvas'
               #'bounds:' #(#Rectangle 0 0 267 319)
@@ -1060,7 +1058,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'BasicsSeparatorSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'unnamed canvas'
               #'bounds:' #(#Rectangle 0 0 267 319)
@@ -1107,7 +1105,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'DetailsEditSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'unnamed canvas'
               #'bounds:' #(#Rectangle 0 0 259 288)
@@ -1183,7 +1181,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'MiscEditSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'unnamed canvas'
               #'bounds:' #(#Rectangle 0 0 245 142)
@@ -1281,6 +1279,13 @@
         anItem enabled:true.
     ].
   ^ menu
+!
+
+useHelpDictionary:aDictionary
+    |tool|
+
+    self noteBookView.
+    self helpTool dictionary:aDictionary.
 ! !
 
 !MenuEditor methodsFor:'accessing menu'!
@@ -1313,21 +1318,22 @@
 
     node notNil ifTrue:[
         self isHelpToolSelected ifTrue:[
-            self activeHelpTool accept
-        ].
-        cont := node contents buildFromAspects:aspects.
-        painter selectedNodeChanged
+            self helpTool accept.
+            node contents activeHelpKey:(self helpTool helpKey)
+        ] ifFalse:[
+            cont := node contents buildFromAspects:aspects.
+            painter selectedNodeChanged
+        ]
     ].
     self modifiedChannel value:false.
     didInstall := true
-
-    "Modified: 31.7.1997 / 14:25:34 / cg"
 !
 
 cancel
     |node|
 
     (node := self painter selectedNode) notNil ifTrue:[
+        self helpTool helpKey:(self helpKey).
         aspects do:[:anAspect| anAspect value:nil ].
         node contents toAspects:aspects.
     ].
@@ -1335,33 +1341,6 @@
 
 ! !
 
-!MenuEditor methodsFor:'active help'!
-
-activeHelpTool
-    "access current active help editor
-    "
-    activeHelpTool isNil ifTrue:[
-        self activeHelpTool:(UIHelpTool new)
-    ].
-  ^ activeHelpTool
-!
-
-activeHelpTool:anApplication
-    "change current active help editor
-    "
-    activeHelpTool := anApplication.
-
-    activeHelpTool masterApplication isNil ifTrue:[
-        activeHelpTool masterApplication:self.
-    ].
-!
-
-isOwnerOfHelpTool
-    "returns true in case of owner of the helptool
-    "
-  ^ self activeHelpTool masterApplication == self
-! !
-
 !MenuEditor methodsFor:'aspects'!
 
 aspectFor:aKey
@@ -1408,17 +1387,6 @@
     "Modified: 28.7.1997 / 12:52:13 / cg"
 !
 
-menuPullDown
-    |menu|
-
-    menu := Menu new.
-    menu fromLiteralArrayEncoding:(self class menuPullDown).
-    menu receiver:self.
-  ^ menu
-
-
-!
-
 modifiedChannel
     "automatically generated by UIPainter ..."
 
@@ -1427,15 +1395,26 @@
     "Modified: 28.7.1997 / 12:52:14 / cg"
 !
 
-tabCanvas
+noteBookView
     "automatically generated by UIPainter ..."
 
-    |holder|
-
-    (holder := builder bindingAt:#tabCanvas) isNil ifTrue:[
-        builder aspectAt:#tabCanvas put:(holder :=  SubCanvas new).
+    |noteBook helpTool|
+
+    (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
+        noteBook := View new.
+        helpTool := UIHelpTool new.
+
+        helpTool masterApplication:self.
+        helpCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
+        specCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
+
+        helpCanvas client:helpTool.
+        helpTool   masterApplication:self.
+        helpTool   modifiedHolder:(self modifiedChannel).
+
+        builder aspectAt:#noteBookView put:noteBook.
     ].
-    ^ holder
+    ^ noteBook
 !
 
 tabList
@@ -1517,6 +1496,155 @@
 
 ! !
 
+!MenuEditor methodsFor:'interface specs'!
+
+menuPullDown
+    "this window spec was automatically generated by the ST/X MenuEditor"
+
+    "do not manually edit this - the builder may not be able to
+     handle the specification if its corrupted."
+
+    "
+     MenuEditor new openOnClass:MenuEditor andSelector:#menuPullDown
+     (Menu new fromLiteralArrayEncoding:(MenuEditor menuPullDown)) startUp
+    "
+
+    <resource: #menu>
+
+    ^
+     
+       #(#Menu
+          
+           #(
+             #(#MenuItem
+                #'label:' 'file'
+                #'value:' #file
+                #'submenu:' 
+                 #(#Menu
+                    
+                     #(
+                       #(#MenuItem
+                          #'label:' 'new'
+                          #'value:' #doNew
+                      )
+                       #(#MenuItem
+                          #'label:' 'from class ...'
+                          #'value:' #doFromClass
+                          #'enabled:' #isStandAlone
+                      )
+                       #(#MenuItem
+                          #'label:' 'pick a menu'
+                          #'value:' #doPickAMenu
+                          #'enabled:' #isStandAlone
+                      )
+                       #(#MenuItem
+                          #'label:' '='
+                      )
+                       #(#MenuItem
+                          #'label:' 'quit'
+                          #'value:' #closeRequest
+                      )
+                    ) nil
+                    nil
+                )
+            )
+             #(#MenuItem
+                #'label:' 'edit'
+                #'submenu:' 
+                 #(#Menu
+                    
+                     #(
+                       #(#MenuItem
+                          #'label:' 'cut'
+                          #'value:' #doCut
+                      )
+                       #(#MenuItem
+                          #'label:' '='
+                      )
+                       #(#MenuItem
+                          #'label:' 'create submenu static'
+                          #'value:' #doCreateMenu
+                      )
+                       #(#MenuItem
+                          #'label:' 'create summenu dynamic'
+                          #'value:' #doCreateLink
+                      )
+                       #(#MenuItem
+                          #'label:' '-'
+                      )
+                       #(#MenuItem
+                          #'label:' 'create item'
+                          #'value:' #doCreateItem
+                      )
+                       #(#MenuItem
+                          #'label:' 'create separator'
+                          #'value:' #doCreateSep
+                      )
+                    ) nil
+                    nil
+                )
+            )
+             #(#MenuItem
+                #'label:' 'code'
+                #'value:' #code
+                #'submenu:' 
+                 #(#Menu
+                    
+                     #(
+                       #(#MenuItem
+                          #'label:' 'class'
+                          #'value:' #doDefineClass
+                          #'enabled:' #isStandAlone
+                      )
+                       #(#MenuItem
+                          #'label:' '-'
+                      )
+                       #(#MenuItem
+                          #'label:' 'install menu spec.'
+                          #'value:' #doInstallSpec
+                      )
+                       #(#MenuItem
+                          #'label:' 'install help spec.'
+                          #'value:' #doInstallHelp
+                          #'enabled:' #isStandAlone
+                      )
+                       #(#MenuItem
+                          #'label:' '='
+                      )
+                       #(#MenuItem
+                          #'label:' 'browse application'
+                          #'value:' #doBrowseAppClass
+                      )
+                    ) nil
+                    nil
+                )
+            )
+             #(#MenuItem
+                #'label:' 'test'
+                #'submenuChannel:' #submenuTest
+            )
+          ) nil
+          nil
+      )
+
+    "Modified: 28.7.1997 / 18:12:10 / cg"
+! !
+
+!MenuEditor methodsFor:'private'!
+
+helpKey
+    |node|
+
+    (node := self painter selectedNode) notNil ifTrue:[
+        ^ node contents activeHelpKey
+    ].
+    ^ nil
+!
+
+helpTool
+    ^ helpCanvas application
+! !
+
 !MenuEditor methodsFor:'queries'!
 
 didInstall
@@ -1531,16 +1659,22 @@
 isHelpToolSelected
     "returns true if current selection is help tool
     "
-    (slices notNil and:[tabSelection notNil]) ifTrue:[
-        ^ (slices at:tabSelection) last == #help
+    slices notNil ifTrue:[
+        ^ (slices at:tabSelection) first = UIHelpTool label
     ].
-  ^ false
+    ^ false
+!
+
+isStandAlone
+    "returns true in case of owner of the helptool
+    "
+    ^ self masterApplication isNil
 ! !
 
 !MenuEditor methodsFor:'selection'!
 
 menuChanged
-    |node item slc sel|
+    |node item slc sel old|
 
     (node := self painter selectedNode) notNil ifTrue:[
         aspects do:[:anAspect| anAspect value:nil ].
@@ -1555,24 +1689,31 @@
                     item submenuChannel isNil ifTrue:[slc := #slicesItem]
                                              ifFalse:[slc := #slicesLink]
                 ].
+                slc := (self class perform:slc) copyWith:#( 'Help' #dummy ).
             ] ifTrue:[
-                slc := #slicesRootMenu
-            ]
+                slc := self class perform:#slicesRootMenu
+            ].
         ] ifTrue:[
-            slc := #slicesSeparatorMenu
-        ].
-        slc := self class perform:slc.
+            slc := self class perform:#slicesSeparatorMenu.
+        ]
     ].
+    self helpTool helpKey:(self helpKey).
     self modifiedChannel value:false.
 
     slc ~= slices  ifTrue:[
+        tabSelection notNil ifTrue:[
+            old := (slices at:tabSelection) first
+        ].
+
         (slices := slc) notNil ifTrue:[
-            tabSelection notNil ifTrue:[sel := tabSelection min:(slices size)]
-                               ifFalse:[sel := 1].
-
-            self tabList value:(slices collect:[:s| s first]).
-            self tabModel setValue:nil.
-            self tabModel value:sel.
+            sel := slices collect:[:s| s first].
+            tabSelection := nil.
+            self tabList value:sel.
+
+            (old notNil and:[(sel := sel findFirst:[:n|n = old]) ~~ 0]) ifFalse:[
+                sel := 1
+            ].
+            self tabModel value:sel
         ] ifFalse:[
             self tabList value:nil.
             self tabSelection:nil.
@@ -1588,19 +1729,26 @@
 tabSelection:aSelection
     |tool sel|
 
-    tabSelection == aSelection ifTrue:[
+    tabSelection = aSelection ifTrue:[
         ^ self
     ].
 
     (tabSelection := aSelection) isNil ifTrue:[
-      ^ self tabCanvas client:nil
+        slices isNil ifTrue:[
+            specCanvas client:nil.
+            ^ specCanvas raise.
+        ].
+        tabSelection == 1 ifTrue:[^ self].
+        tabSelection := 1
     ].
+
     self isHelpToolSelected ifTrue:[
-        self tabCanvas client:(tool := self activeHelpTool).
-        tool model:(self aspectFor:#activeHelpKey)
+        self helpTool helpKey:(self helpKey).
+        helpCanvas raise.
     ] ifFalse:[
         sel := (slices at:tabSelection) last.
-        self tabCanvas client:self spec:(self class perform:sel) builder:builder
+        specCanvas client:self spec:(self class perform:sel) builder:builder.
+        specCanvas raise.
     ]    
 ! !
 
@@ -1613,8 +1761,8 @@
     self specClass:aClass.
     newClass := self specClass.
 
-    (self isOwnerOfHelpTool and:[oldClass ~= newClass]) ifTrue:[
-        self activeHelpTool helpSpecFrom:newClass
+    (self isStandAlone and:[oldClass ~= newClass]) ifTrue:[
+        self helpTool helpSpecFrom:newClass
     ].
     self painter buildFrom:newClass andSelector:aSelector.
 !
@@ -1631,7 +1779,6 @@
         label
         accessCharaterPos
         submenuChannel
-        activeHelpKey
         enabled
         value
         nameKey
@@ -1742,7 +1889,9 @@
 doInstallHelp
     "install help text
     "
-    self activeHelpTool installHelpSpecInto:(self specClass)
+    self isStandAlone ifTrue:[
+        self helpTool installHelpSpecInto:(self specClass)
+    ]
 !
 
 doInstallSpec
@@ -1914,6 +2063,14 @@
 
 !MenuEditor::Item methodsFor:'accessing'!
 
+activeHelpKey
+    ^ activeHelpKey
+!
+
+activeHelpKey:aKey
+    activeHelpKey := aKey
+!
+
 label
     "return the value of the instance variable 'label' (automatically generated)"
 
@@ -1997,7 +2154,6 @@
             (aspects at:#label) value:(label := name)
         ].
 
-        activeHelpKey       := (aspects at:#activeHelpKey) value.
         enabled             := (aspects at:#enabled) value.
         value               := (aspects at:#value) value.
         nameKey             := (aspects at:#nameKey) value.
@@ -2057,7 +2213,6 @@
         (aspects at:#seperatorSelection) selectionIndex:type.
     ] ifFalse:[
         (aspects at:#label)                 value:label.
-        (aspects at:#activeHelpKey)         value:activeHelpKey.
         (aspects at:#enabled)               value:enabled.
         (aspects at:#value)                 value:value.
         (aspects at:#nameKey)               value:nameKey.
--- a/UIPainter.st	Wed Aug 20 17:55:38 1997 +0200
+++ b/UIPainter.st	Wed Aug 20 17:57:49 1997 +0200
@@ -12,8 +12,8 @@
 
 
 ApplicationModel subclass:#UIPainter
-	instanceVariableNames:'activeHelpTool layoutTool specTool treeView selectionPanel
-		tabSelection specClass specSelector specSuperclass aspects'
+	instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
+		specSuperclass aspects layoutCanvas helpCanvas specCanvas'
 	classVariableNames:'IconStepUp IconStepOut IconStepIn IconStepDown'
 	poolDictionaries:''
 	category:'Interface-UIPainter'
@@ -106,115 +106,106 @@
     "
   ^ super helpSpec addPairsFrom:#(
 
-#alignSelectionCenterVer
-'align selected widgets vertical'
-
-#alignSelectionLeft
-'align selected widgets to the left edge of the dominant widget ( underlined )'
-
-#alignSelectionRight
-'align selected widgets to the right edge of the dominant widget ( underlined )'
-
-#alignSelectionLeftAndRight
-'align selected widgets to the right and left edge of the dominant widget ( underlined )'
-
-#alignSelectionTop
-'align selected widgets to the top edge of the dominant widget ( underlined )'
-
-#alignSelectionBottom
-'align selected widgets to the bottom edge of the dominant widget ( underlined )'
-
-#alignSelectionTopAndBottom
-'align selected widgets to the top and bottom edge of the dominant widget ( underlined )'
-
-#alignSelectionCenterVer
-'align selected widgets horizontal to the center of the dominant widget ( underlined )'
-
-#alignSelectionCenterHor
-'align selected widgets vertical to the center of the dominant widget ( underlined )'
-
-#spreadSelectionVer
-'vertical spacing between selected widgets is made the same'
-
-#spreadSelectionHor
-'horizontal spacing between selected widgets is made the same'
-
-#centerSelectionHor
-'center widgets horizontal to their top widget'
-
-#centerSelectionVer
-'center vertical horizontal in contained view'
-
-#setToDefaultExtent
-'set selected widgets to their default extent'
+#moveSelectionLeft
+'move selected widgets left while pressing the button'
 
 #setToDefaultWidth
 'set selected widgets to their default width'
 
-#setToDefaultHeight
-'set selected widgets to their default height'
-
-#copyExtent
-'copy extent of the selected widget'
-
-#pasteExtent
-'change extent of all selected widgets to the last copied extent'
-
-#pasteWidth
-'change width of all selected widgets to the last copied extent width'
-
-#pasteHeight
-'change height of all selected widgets to the last copied extent height'
-
-#copyLayout
-'copy layout of the selected widget'
-
-#pasteLayout
-'change layout of all selected widgets to the last copied layout'
-
 #pasteBuffer
 'paste widgets at current mouse position'
 
-#pasteWithLayout
-'paste widgets without changing their layouts'
-
-#accept
-'write back changes'
-
-#cancel
-'reread specification and layout'
-
 #galleryShown
 'show or hide gallery view'
 
-#painterShown
-'show or hide painter view'
-
-#moveSelectionLeft
-'move selected widgets left while pressing the button'
-
-#moveSelectionRight
-'move selected widgets right while pressing the button'
-
 #moveSelectionDown
 'move selected widgets down while pressing the button'
 
 #moveSelectionUp
 'move selected widgets up while pressing the button'
 
+#spreadSelectionVer
+'vertical spacing between selected widgets is made the same'
+
 #menuChangeHierarchy
 'change hierarchy of the selected widget'
 
+#copyExtent
+'copy extent of the selected widget'
+
+#moveSelectionRight
+'move selected widgets right while pressing the button'
+
+#cancel
+'reread specification and layout'
+
+#pasteWithLayout
+'paste widgets without changing their layouts'
+
+#alignSelectionRight
+'align selected widgets to the right edge of the dominant widget'
+
+#alignSelectionLeftAndRight
+'align selected widgets to the right and left edge of the dominant widget'
+
+#pasteWidth
+'change width of all selected widgets to the last copied extent width'
+
+#alignSelectionTopAndBottom
+'align selected widgets to the top and bottom edge of the dominant widget'
+
+#copyLayout
+'copy layout of the selected widget'
+
+#painterShown
+'show or hide painter view'
+
+#pasteExtent
+'change extent of all selected widgets to the last copied extent'
+
+#pasteHeight
+'change height of all selected widgets to the last copied extent height'
+
+#accept
+'write back changes'
+
+#centerSelectionVer
+'center vertical horizontal in contained view'
+
+#centerSelectionHor
+'center widgets horizontal to their top widget'
+
 #menuAlignment
 'provides a set of alignment operation on the current selected widgets'
 
-
+#alignSelectionCenterVer
+'align selected widgets horizontal to the center of the dominant widget'
+
+#pasteLayout
+'change layout of all selected widgets to the last copied layout'
+
+#alignSelectionLeft
+'align selected widgets to the left edge of the dominant widget'
+
+#spreadSelectionHor
+'horizontal spacing between selected widgets is made the same'
+
+#alignSelectionBottom
+'align selected widgets to the bottom edge of the dominant widget'
+
+#setToDefaultExtent
+'set selected widgets to their default extent'
+
+#alignSelectionCenterHor
+'align selected widgets vertical to the center of the dominant widget'
+
+#alignSelectionTop
+'align selected widgets to the top edge of the dominant widget'
+
+#setToDefaultHeight
+'set selected widgets to their default height'
 
 )
-
-
-
-
 ! !
 
 !UIPainter class methodsFor:'icons'!
@@ -340,7 +331,7 @@
        #(#FullSpec
           #'window:' 
            #(#WindowSpec
-              #'name:' 'uIPainterView'
+              #'name:' 'NameAndSelectorSpec'
               #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
               #'label:' 'Painter'
               #'bounds:' #(#Rectangle 0 0 391 170)
@@ -474,11 +465,6 @@
                     #'enableChannel:' #enableChannel
                     #'tabable:' true
                     #'menu:' #tabList
-                    #'style:' 
-                     #(#FontDescription
-                        #helvetica #medium
-                        #roman #'10'
-                    )
                     #'model:' #tabModel
                     #'tabWidget:' #Window
                     #'canvas:' #noteBookView
@@ -664,6 +650,7 @@
              #(#MenuItem
                 #'label:' 'align left'
                 #'value:' #alignSelectionLeft
+                #'activeHelpKey:' #alignSelectionLeft
                 #'labelImage:' 
                  #(#ResourceRetriever
                     nil #iconAlignL
@@ -1242,9 +1229,11 @@
      specification will change immediately dependant on the attributes derived
      from the specification.
     "
-    |layout|
+    |layout spec prop key layoutTool|
 
     self isLayoutToolSelected ifTrue:[
+        layoutTool := self layoutTool.
+
         (layout := layoutTool layout) notNil ifTrue:[
             layoutTool layoutType == #Extent ifTrue:[
                 layoutTool layoutView == self painter topView ifTrue:[
@@ -1257,22 +1246,37 @@
             ]
         ]
     ] ifFalse:[
+        spec := self specTool specification.
+
         self isHelpToolSelected ifTrue:[
-            activeHelpTool accept
-        ].
-        self painter updateFromSpec:(specTool specification).
+            self helpTool accept.
+            key  := self helpTool helpKey.
+            prop := treeView propertySelected.
+
+            prop notNil ifTrue:[
+                prop spec activeHelpKey:key
+            ].
+            spec activeHelpKey:key.
+        ] ifFalse:[
+            self painter updateFromSpec:spec.
+        ]
     ].
     self modifiedChannel value:false.
-
 !
 
 cancel
     "cancel all changes done to the specification; reread attributes from the
      assigned component
     "
+    |spec key|
+
     self isModified ifTrue:[
-        specTool specification:(self painter specForSelection).
-        self setViewInLayoutTool:(layoutTool layoutView).
+        (spec := self painter specForSelection) notNil ifTrue:[
+            key := spec activeHelpKey.
+        ].
+        self helpTool helpKey:key.
+        self specTool specification:spec.
+        self setViewInLayoutTool:(self layoutTool layoutView).
         self modifiedChannel value:false.
     ]
 !
@@ -1305,6 +1309,8 @@
 !
 
 openEditMenu
+    "opens a menu editor on current widget
+    "
     |cls aspect editor|
 
     specClass isNil ifTrue:[
@@ -1318,7 +1324,7 @@
     ].
 
     cls notNil ifTrue:[
-        (aspect := specTool specification menu) notNil ifTrue:[
+        (aspect := self specTool specification menu) notNil ifTrue:[
             aspect := aspect asSymbol
         ] ifFalse:[
             "/ cg: q&d hack ...
@@ -1331,21 +1337,17 @@
                     aspect := aspect view asMenu.
                 ]
             ].
-
-"/            aspect isNil ifTrue:[
-"/                self warn:'first enter (and confirm) the menus selector.'.
-"/                ^ self.
-"/            ].
         ].
         
         editor := MenuEditor new.
         editor masterApplication:self.
-        editor activeHelpTool:(self activeHelpTool).
+        editor useHelpDictionary:(self helpTool dictionary).
         editor openModalOnClass:cls andSelector:aspect.
+        self helpTool updateList.
 
         editor selectorName ~= aspect ifTrue:[
             editor didInstall ifTrue:[
-                specTool specification menu:editor selectorName asSymbol.
+                self specTool specification menu:editor selectorName asSymbol.
                 self modifiedChannel value:true.
                 self accept
             ]
@@ -1357,17 +1359,6 @@
 
 !UIPainter methodsFor:'active help'!
 
-activeHelpTool
-    "setup help tool
-    "
-    activeHelpTool isNil ifTrue:[
-        activeHelpTool := UIHelpTool new.
-        activeHelpTool helpSpecFrom:specClass.
-        activeHelpTool masterApplication:self.
-    ].
-    ^ activeHelpTool
-!
-
 showHelp:aHelpText for:view
     "hook to allow an application to display active help
      texts in its own info area.
@@ -1448,27 +1439,36 @@
 noteBookView
     "returns the notebook view; initialize components within the notebook
     "
-    |noteBook channel n1 n2|
+    |noteBook channel helpTool layoutTool specTool|
 
     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
         noteBook   := View new.
         layoutTool := UILayoutTool new.
+        helpTool   := UIHelpTool   new.
+        helpTool helpSpecFrom:specClass.
         specTool   := UISpecificationTool new.
         channel    := self modifiedChannel.
 
         layoutTool masterApplication:self.
         specTool   masterApplication:self.
-
-        n1 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
-        n2 := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
-
-        n1 client:layoutTool.
-        specTool builder:(n2 client:specTool).
+        helpTool   masterApplication:self.
+
+        layoutCanvas := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
+        helpCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
+        specCanvas   := SubCanvas origin:0.0@0.0 corner:1.0@1.0 in:noteBook.
+
+        layoutCanvas client:layoutTool.
+        helpCanvas   client:helpTool.
+        specTool builder:(specCanvas client:specTool).
 
         layoutTool masterApplication:self.
         specTool   masterApplication:self.
+        helpTool   masterApplication:self.
+
         layoutTool modifiedHolder:channel.
+        helpTool   modifiedHolder:channel.
         specTool   modifiedHolder:channel.
+
         builder aspectAt:#noteBookView put:noteBook.
     ].
     ^ noteBook
@@ -1532,7 +1532,7 @@
      widget changed
     "
     self isModified ifFalse:[
-        layoutTool update.
+        self layoutTool update.
         self modifiedChannel value:false
     ]
 !
@@ -1544,11 +1544,11 @@
     |p|
 
     (p := treeView propertySelected) notNil ifTrue:[
-        specTool specification:(p spec copy).
+        self specTool specification:(p spec copy).
         self setViewInLayoutTool:(p view).
         self modifiedChannel value:false
     ] ifFalse:[
-        layoutTool layoutView notNil ifTrue:[
+        self layoutTool layoutView notNil ifTrue:[
             self modifiedChannel value:false.
             self treeSelection
         ]
@@ -1638,10 +1638,18 @@
     aView unmap.
 !
 
-painter
-    "returns the painter/canvas view
-    "
-    ^ treeView canvas
+raiseTabView
+
+    self isLayoutToolSelected ifTrue:[
+        layoutCanvas raise
+    ] ifFalse:[
+        self isHelpToolSelected ifTrue:[
+            helpCanvas raise
+        ] ifFalse:[
+            self specTool selection:tabSelection.
+            specCanvas raise
+        ]
+    ]
 !
 
 raiseUIView:aView
@@ -1669,7 +1677,7 @@
             superclassName:superClassName
             selector:(selector ? '').
 
-    specClass := clsName.
+    self specClass:clsName.
     specSelector := (selector ? '').
     specSuperclass := superClassName.
 
@@ -1679,13 +1687,53 @@
 setViewInLayoutTool:aView
     "set view for layout tool
     "
-    self painter topView ~~ aView ifTrue:[
-        layoutTool layoutView:aView type:nil
-    ] ifFalse:[
-        layoutTool layoutView:aView type:#Extent
+    |type|
+
+    self painter topView == aView ifTrue:[
+        type := #Extent
+    ].
+    self layoutTool layoutView:aView type:type
+
+!
+
+specClass:aClass
+    specClass := aClass.
+    self helpTool helpSpecFrom:specClass.
+! !
+
+!UIPainter methodsFor:'private tools'!
+
+helpTool
+    "returns the help tool
+    "
+    helpCanvas isNil ifTrue:[
+        self noteBookView
     ].
-
-
+    ^ helpCanvas application
+!
+
+layoutTool
+    "returns the layout tool
+    "
+    layoutCanvas isNil ifTrue:[
+        self noteBookView
+    ].
+    ^ layoutCanvas application
+!
+
+painter
+    "returns the painter/canvas view
+    "
+    ^ treeView canvas
+!
+
+specTool
+    "returns the spec tool
+    "
+    specCanvas isNil ifTrue:[
+        self noteBookView
+    ].
+    ^ specCanvas application
 ! !
 
 !UIPainter methodsFor:'queries'!
@@ -1713,14 +1761,15 @@
     "returns true if current selected tab in the noteBook is assigned
      to the 'Help' tool
     "
-    ^ tabSelection = 'Help'
+    ^ tabSelection = UIHelpTool label
+
 !
 
 isLayoutToolSelected
     "returns true if current selected tab in the noteBook is assigned
      to the 'Layout' tool
     "
-    ^ tabSelection = layoutTool class label
+    ^ tabSelection = UILayoutTool label
 !
 
 isModified
@@ -1746,8 +1795,6 @@
 tabSelection:something
     "the tab selection of the notebook changed
     "
-    |raiseViewIdx|
-
     (something isNil or:[tabSelection = something]) ifTrue:[
         ^ self
     ].
@@ -1759,14 +1806,8 @@
         self accept
     ].
 
-    raiseViewIdx := 1.
     tabSelection := something.
-
-    self isLayoutToolSelected ifFalse:[
-        specTool selection:tabSelection.
-        raiseViewIdx := 2
-    ].
-    (self noteBookView subViews at:raiseViewIdx) raise.
+    self raiseTabView.
     self cancel.
 !
 
@@ -1796,11 +1837,13 @@
     ].
     tabComponent := builder componentAt:#noteBook.
     self setViewInLayoutTool:view.
-    specTool specification:spec.
+    self specTool specification:spec.
 
     spec notNil ifTrue:[
+        self helpTool helpKey:(spec activeHelpKey).
         list := spec class slices collect:[:aSlice| aSlice first asString].
-        view notNil ifTrue:[list add:(layoutTool class label)].
+        list add:(UIHelpTool   label).
+        list add:(UILayoutTool label).
         self tabList value:list.
         self showHelp:(spec class name) for:nil.
         tabComponent enabled:true.
@@ -1808,18 +1851,13 @@
         (tabSelection := tabComponent selection) isNil ifTrue:[
             tabComponent setSelection:(tabSelection := list first)
         ].
-        self isLayoutToolSelected ifTrue:[
-            (self noteBookView subViews at:1) raise
-        ] ifFalse:[
-            specTool selection:tabSelection.
-            (self noteBookView subViews at:2) raise
-        ]
+        self raiseTabView
     ] ifFalse:[
+        self helpTool helpKey:nil.
         tabComponent enabled:false.
         self showHelp:'' for:nil.
     ].
     self modifiedChannel value:false.
-
 ! !
 
 !UIPainter methodsFor:'startup / release'!
@@ -1841,9 +1879,7 @@
         selectionPanel closeRequest
     ].
     selectionPanel := nil.
-    layoutTool     := nil.
     treeView       := nil.
-    activeHelpTool := nil.
 
     super closeRequest.
 
@@ -2078,7 +2114,7 @@
 
         (self openDialogInterface:#nameAndSelectorSpec) ifTrue:[
 
-            specClass := (self aspectFor:#classNameChannel) value.
+            specClass    := (self aspectFor:#classNameChannel) value.
             specSelector := (self aspectFor:#methodNameChannel) value.
             specSelector notNil ifTrue:[specSelector := specSelector asSymbol].
             specSuperclass := (self aspectFor:#superclassNameChannel) value.
@@ -2090,9 +2126,9 @@
             ]
         ]
 
-    ] doWhile:[again]
-
-    "Modified: 17.6.1997 / 14:42:02 / cg"
+    ] doWhile:[again].
+
+    self specClass:specClass.
 ! !
 
 !UIPainter methodsFor:'user interaction - move'!
@@ -2246,11 +2282,7 @@
 doInstallHelp
     "install help text
     "
-    activeHelpTool notNil ifTrue:[
-        activeHelpTool installHelpSpecInto:specClass
-    ] ifFalse:[
-        self information:'no help text defined'
-    ]    
+    self helpTool installHelpSpecInto:specClass
 !
 
 doInstallSpec