avoid selection problems
authortz
Sun, 19 Apr 1998 18:45:16 +0200
changeset 785 35ad7901368c
parent 784 9ae2b94658e5
child 786 17a84830f0ee
avoid selection problems
UIPainter.st
--- a/UIPainter.st	Sun Apr 19 00:56:50 1998 +0200
+++ b/UIPainter.st	Sun Apr 19 18:45:16 1998 +0200
@@ -388,7 +388,7 @@
     "This resource specification was automatically generated
      by the ImageEditor of ST/X."
 
-    "Do not manually edit this!!!! If it is corrupted,
+    "Do not manually edit this!! If it is corrupted,
      the ImageEditor may not be able to read the specification."
 
     "
@@ -399,7 +399,8 @@
 
     ^Icon
         constantNamed:#'UIPainter iconAlignLR'
-        ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@(@@@B @@(@@@B @@(UUUR I@(_??2 @@(@@@B @@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??2 @@(@@@B E@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??B @@(@@@B @@(@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@A G?? G?? G?? G?? F@A F@A G?? G?? G?? G?? F@A F@A G?? G?? G?; G?? F@A @@@@@@@@') ; yourself); yourself]!
+        ifAbsentPut:[(Depth2Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@(@@@B @@(@@@B @@(UUUR I@(_??2 @@(@@@B @@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??2 @@(@@@B E@(@@@B @@(@@@B @@(@@@B @@(UUUR @@(_??B @@(@@@B @@(@@@B @@@@@@@@E@@@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 127 170 170 170]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@F@A G?? G?? G?? G?? F@A F@A G?? G?? G?? G?? F@A F@A G?? G?? G?; G?? F@A @@@@@@@@') ; yourself); yourself]
+!
 
 iconAlignR
     "This resource specification was automatically generated
@@ -663,11 +664,11 @@
           #window: 
            #(#WindowSpec
               #name: 'GUI Painter'
-              #layout: #(#LayoutFrame 106 0 256 0 625 0 730 0)
+              #layout: #(#LayoutFrame 321 0 265 0 840 0 742 0)
               #label: 'GUI Painter'
               #min: #(#Point 560 460)
               #max: #(#Point 1160 870)
-              #bounds: #(#Rectangle 106 256 626 731)
+              #bounds: #(#Rectangle 321 265 841 743)
               #menu: #menu
               #usePreferredExtent: false
           )
@@ -1079,16 +1080,15 @@
                           #label: 'Layout Tool'
                           #value: #openHTMLDocument:
                           #activeHelpKey: #helpLayoutTool
-                          #argument: 'tools/uipainter/Layout.html'
+                          #argument: 'tools/uipainter/LayoutTool.html'
                       )
                        #(#MenuItem
                           #label: '-'
                       )
                        #(#MenuItem
                           #label: 'Selected Widget'
-                          #value: #openWidgetDocumentation
+                          #value: #doOpenWidgetDocumentation
                           #activeHelpKey: #helpSelectedWidget
-                          #enabled: #hasOneSelectionOtherThanCanvas
                       )
                        #(#MenuItem
                           #label: '-'
@@ -1950,11 +1950,11 @@
         ^ self information:'No application class defined yet!!'
     ].
 
-    selector := self specTool specification listSelector.
+    (selector := self specTool specification listSelector) isArray 
+        ifTrue: [^self warn: 'Cannot open the Tab List Editor on an array!!'].
 
     editor := TabListEditor new.
     editor masterApplication:self.
-    selector isArray ifTrue: [^self warn: 'Cannot open the Tab List Editor on an array!!!!'].
     editor openModalOnClass:specClass andSelector:selector.
 
     editor specSelector ~= selector ifTrue:[
@@ -2535,9 +2535,8 @@
             self setClass: aClass selector: aSelector.    
             (aClass respondsTo:aSelector) 
             ifTrue:
-            [
-                self painter setupFromSpec:(aClass perform:aSelector).
-                treeView selection: #(1). 
+            [   
+                self painter setupFromSpec:(aClass perform:aSelector)
             ]
         ]
     ]
@@ -2592,34 +2591,30 @@
 
     topView label:'GUI Painter'.
 
-    "take care for those who do close very quickly after launching"
-    Object errorSignal handle: [:ex|] do: 
-    [
-        painterView openInGroup:(topView windowGroup).
-        painterView open.
-        painterView application:self.     
-
-        painterView application:self.
-        selectionPanel := UISelectionPanel new.
-        selectionPanel allButOpenInterface:#windowSpec.
-        selectionPanel window openInGroup:(topView windowGroup).
-
-        selectionPanel openWindow.
-        selectionPanel masterApplication:self.
-
-        topView iconLabel:'GUI Painter'.
-        topView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
-
-        painterView iconLabel:'GUI Painter'.
-        painterView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
-
-        topView bePartner.
-        painterView bePartner.
-        selectionPanel window bePartner.
-
-        selectionPanel window iconLabel:'GUI Painter'.
-        selectionPanel window icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
-    ]
+    painterView openInGroup:(topView windowGroup).
+    painterView open.
+    painterView application:self.     
+
+    painterView application:self.
+    selectionPanel := UISelectionPanel new.
+    selectionPanel allButOpenInterface:#windowSpec.
+    selectionPanel window openInGroup:(topView windowGroup).
+
+    selectionPanel openWindow.
+    selectionPanel masterApplication:self.
+
+    topView iconLabel:'GUI Painter'.
+    topView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
+
+    painterView iconLabel:'GUI Painter'.
+    painterView icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
+
+    topView bePartner.
+    painterView bePartner.
+    selectionPanel window bePartner.
+
+    selectionPanel window iconLabel:'GUI Painter'.
+    selectionPanel window icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
 !
 
 openOnClass:aClass
@@ -2640,16 +2635,11 @@
 
     self openInterface.
 
-    "take care for those who do close very quickly after launching"
-    Object errorSignal handle: [:ex|] do: 
-    [
-        aClass notNil ifTrue:[
-            painter := self painter.
-            self setClass:aClass selector:aSelector.
-            (aClass respondsTo:aSelector) ifTrue:[
-                painter setupFromSpec:(aClass perform:aSelector).
-                treeView selection: #(1)
-            ]
+    aClass notNil ifTrue:[
+        painter := self painter.
+        self setClass:aClass selector:aSelector.
+        (aClass respondsTo:aSelector) ifTrue:[  
+            painter setupFromSpec:(aClass perform:aSelector).
         ]
     ]
 !
@@ -2662,22 +2652,18 @@
 
     super postOpenWith: aBuilder.
 
-    "take care for those who do close very quickly after launching"
-    Object errorSignal handle: [:ex|] do: 
-    [
-        treeView selection: (Array with: 1).
-
-        painter  := self painter.
-        settings := self class settings.
-        gridPara := painter gridParameters copy.
-        hspace   := settings at: #HGridSpace ifAbsent: [10].
-        vspace   := settings at: #VGridSpace ifAbsent: [10].
-        gridPara at:1 put:hspace; at:2 put:vspace; at:5 put:hspace; at:6 put:vspace.
-        painter gridParameters:gridPara.
-        painter gridShown: (settings at: #GridShown ifAbsent: [false]).
-        painter gridAlign: (settings at: #GridAlign ifAbsent: [false]).
-        painter clear.
-    ]
+    treeView selection: #(1).
+
+    painter  := self painter.
+    settings := self class settings.
+    gridPara := painter gridParameters copy.
+    hspace   := settings at: #HGridSpace ifAbsent: [10].
+    vspace   := settings at: #VGridSpace ifAbsent: [10].
+    gridPara at:1 put:hspace; at:2 put:vspace; at:5 put:hspace; at:6 put:vspace.
+    painter gridParameters:gridPara.
+    painter gridShown: (settings at: #GridShown ifAbsent: [false]).
+    painter gridAlign: (settings at: #GridAlign ifAbsent: [false]).
+    painter clear.
 
 ! !
 
@@ -3005,7 +2991,9 @@
     treeView canvas topView name:  UIPainter defaultNameOfCanvas.
     treeView canvas topView label: UIPainter defaultNameOfCanvas.
     self helpTool doNew.
-    treeView selection:#(1).
+    self treeSelection.
+    treeView selectedNode changed.
+    self tabModel value: self tabList value first.
     self updateInfoLabel.
 !
 
@@ -3022,7 +3010,7 @@
     spec notNil ifTrue:[
         document := 'tools/uipainter/', spec userFriendlyName,'.html'
     ] ifFalse: [
-        document := 'tools/uipainter/TOP.html#THEWIDGETSANDHOWDOTHEYWORK'
+        document := 'tools/uipainter/WindowSpec.html'
     ].
     HTMLDocumentView openFullOnDocumentationFile: document 
 
@@ -3371,7 +3359,9 @@
     "sets a window spec from aWindowSpec"
 
     windowSpec := WindowSpec new copyValuesFromSpec:aWindowSpec.
-    self canvasNameChanged:aWindowSpec name.
+    self canvasNameChanged:aWindowSpec name.           
+    self application treeSelection.
+
 
 ! !
 
@@ -3465,7 +3455,7 @@
      and:[node name ~= name]]]
     ) ifTrue:[
         node name: name asBoldText.
-        node changed.
+        node changed.   
     ].
 !
 
@@ -3496,7 +3486,7 @@
             (end := self lastLineShown) > listOfNodes size ifTrue:[
                 end := listOfNodes size
             ].                          
-            item changed.
+            item changed.   
 
             [idx <= end] whileTrue:[
                 (listOfNodes at:idx) == item ifTrue:[
@@ -3644,10 +3634,10 @@
             self redrawLine: lastDrawnMaster. 
             self redrawLine: (lastDrawnMaster := selection first)
         ]
-    ]
+    ]         
     ifFalse: [
         lastDrawnMaster := nil
-    ]
+    ] 
 ! !
 
 !UIPainter::TreeView methodsFor:'queries'!