UIPainter.st
changeset 1192 f3f5c92930c9
parent 1188 4805027d9d33
child 1193 ada18c876301
--- a/UIPainter.st	Tue Jul 13 18:57:31 1999 +0200
+++ b/UIPainter.st	Tue Jul 13 20:51:52 1999 +0200
@@ -2802,24 +2802,24 @@
     aspects := IdentityDictionary new.
 
     aspects at:#classNameChannel put:(
-	(specClass notNil ifTrue:[specClass]
-			 ifFalse:['NewApplication']) asValue
+        (specClass notNil ifTrue:[specClass]
+                         ifFalse:['NewApplication']) asValue
     ).
     specSuperclass isNil ifTrue:[
-	specClass notNil ifTrue:[
-	    (cls := self resolveName:specClass) notNil ifTrue:[
-		specSuperclass := cls superclass name.
-	    ]
-	]
+        specClass notNil ifTrue:[
+            (cls := self resolveName:specClass) notNil ifTrue:[
+                specSuperclass := cls superclass name.
+            ]
+        ]
     ].
     aspects at:#superclassNameChannel put:(
-	(specSuperclass notNil ifTrue:[specSuperclass]
-			 ifFalse:['ApplicationModel']) asValue
+        (specSuperclass notNil ifTrue:[specSuperclass]
+                         ifFalse:['ApplicationModel']) asValue
     ).
     aspects at:#superclassNameDefaults put:#('ApplicationModel' 'SimpleDialog') asValue.
     aspects at:#methodNameChannel put:(
-	(specSelector notNil ifTrue:[specSelector asValue]
-			    ifFalse:[#windowSpec]) asValue
+        (specSelector notNil ifTrue:[specSelector asValue]
+                            ifFalse:[#windowSpec]) asValue
     ).
 
     "/ the canvas ...
@@ -2839,7 +2839,6 @@
 
     super openInterface:aSymbol.
 
-
     topView := self window.
     topView label:'GUI Painter'.
 
@@ -2866,6 +2865,9 @@
 
     selectionPanel window iconLabel:'GUI Gallery'.
     selectionPanel window icon:(Image fromFile:'bitmaps/UIPainter.xbm' resolution:100).
+
+    painterView topView raise.
+
 !
 
 openOnClass:aClass
@@ -2893,17 +2895,17 @@
     "Modified: / 21.8.1998 / 20:59:15 / cg"
 !
 
-postOpenWith: aBuilder
+postBuildWith: aBuilder
     "sets the root of the tree view as first selection;
      sets the grid parameters, if defined"
 
     |painter settings gridPara hspace vspace cls sel|
 
-    super postOpenWith:aBuilder.
+    super postBuildWith:aBuilder.
 
     cls := specClass.
     cls isString ifTrue:[
-	cls := Smalltalk at:(cls string asSymbol)
+        cls := Smalltalk at:(cls string asSymbol)
     ].
     sel := specSelector.
     specSelector := nil.
@@ -2918,17 +2920,53 @@
     painter gridParameters:gridPara.
     painter gridShown: (settings at: #GridShown ifAbsent:false).
     painter gridAlign: (settings at: #GridAlign ifAbsent:false).
-    painter clear.
+    painter shown ifTrue:[painter clear].
 
     cls notNil ifTrue:[
-	self setClass:cls selector:sel.
-
-	(cls respondsTo:sel) ifTrue:[  
-	    painter setupFromSpec:(cls perform:sel).
-	]
+        self setClass:cls selector:sel.
+
+        (cls respondsTo:sel) ifTrue:[  
+            painter setupFromSpec:(cls perform:sel).
+        ]
     ].
+
+    "Modified: / 22.8.1998 / 17:41:34 / cg"
+!
+
+postOpenWith: aBuilder
+    "sets the initial selection"
+
+    |myWindow canvasWindow canvasOrg galleryWindow myOrg myCorner|
+
+    super postOpenWith: aBuilder.
     treeView selection: #(1).
 
+    "/ try to lay out things non-overlapping
+
+    myWindow := self window.
+    canvasWindow := self painter topView.
+    galleryWindow := selectionPanel window.
+
+    myOrg := myWindow origin.
+    myCorner := myWindow corner.
+
+    myCorner x + canvasWindow width <= device width ifTrue:[
+        canvasOrg := (myCorner x + canvasWindow width) @ myOrg y.
+    ] ifFalse:[
+        canvasOrg := 0@0.
+        myOrg := (device width - myWindow width - 20) @ 0.
+        myWindow origin:myOrg.
+    ].
+
+    galleryWindow raise.
+    canvasWindow raise.
+    canvasWindow origin:canvasOrg.
+
+    galleryWindow 
+        origin:((myOrg corner:myCorner) topCenter x - (galleryWindow width // 2)) rounded
+               @
+               (device height - galleryWindow height - 20).
+
     "Modified: / 22.8.1998 / 17:41:34 / cg"
 ! !