UILayoutTool.st
changeset 1072 84ae04e0af72
parent 1070 1735e40c6825
child 1074 49ef9991d1d5
--- a/UILayoutTool.st	Sat Mar 20 16:23:19 1999 +0100
+++ b/UILayoutTool.st	Sat Mar 20 16:23:42 1999 +0100
@@ -14,7 +14,7 @@
 
 
 ApplicationModel subclass:#UILayoutTool
-	instanceVariableNames:'modifiedHolder aspects selection layoutView tabList'
+	instanceVariableNames:'modifiedHolder aspects selection layoutView tabList layoutSpec'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-UIPainter'
@@ -481,18 +481,13 @@
     ^ layoutView
 !
 
-layoutView:aView
-    "change current edited view
-    "
-    self layoutView:aView type:nil
-!
-
-layoutView:aView type:aTypeOrNil
+layoutView:aView type:aTypeOrNil spec:aSpec
     "change current edited view
     "
     |type name list|
 
     layoutView := aView.
+    layoutSpec := aSpec.
 
     aTypeOrNil notNil ifTrue:[
         self class slices findFirst:[:e|
@@ -539,9 +534,9 @@
     |view appl|
 
     selection notNil ifTrue:[
-        (view := self layoutView) notNil ifTrue:[
+        (view := layoutView) notNil ifTrue:[
             (appl := self noteBookView application) notNil ifTrue:[
-                appl fetch:view
+                appl fetch:view spec:layoutSpec
             ]
         ]
     ].
@@ -558,6 +553,17 @@
 
 !
 
+notUsingDefaultExtent
+    |holder|
+
+    (holder := builder bindingAt:#notUsingDefaultExtent) isNil ifTrue:[
+        holder := BlockValue forLogicalNot:(self aspectFor:#useDefaultExtent).
+        builder aspectAt:#notUsingDefaultExtent put:holder.
+    ].
+    ^ holder
+
+!
+
 noteBookList
     "returns list of tab labels
     "
@@ -707,6 +713,7 @@
         topFraction             topOffset
         rightFraction           rightOffset
         leftAlignmentFraction   topAlignmentFraction
+        useDefaultExtent
     )
 
     do:[:aKey||holder|
@@ -892,6 +899,7 @@
                               #model: #leftAlignmentFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                              #acceptOnLostFocus: true
                     #acceptChannel: #acceptChannel
                     #modifiedChannel: #modifiedChannel
                           )
@@ -903,6 +911,7 @@
                               #model: #topAlignmentFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                              #acceptOnLostFocus: true
                     #acceptChannel: #acceptChannel
                     #modifiedChannel: #modifiedChannel
                           )
@@ -992,7 +1001,7 @@
 
 !UILayoutTool::AlignmentOrigin methodsFor:'accessing'!
 
-fetch:aView
+fetch:aView spec:aSpec
     "fetch alignmentOrigin
     "
     |layout type|
@@ -1172,15 +1181,19 @@
     ^
      
        #(#FullSpec
+          #name: #windowSpec
           #window: 
            #(#WindowSpec
               #name: 'UILayoutTool-Extent'
-              #layout: #(#LayoutFrame 291 0 130 0 616 0 278 0)
+              #layout: #(#LayoutFrame 20 0 61 0 345 0 209 0)
+              #level: 0
               #label: 'UILayoutTool-Extent'
               #min: #(#Point 10 10)
               #max: #(#Point 1152 900)
-              #bounds: #(#Rectangle 291 130 617 279)
+              #bounds: #(#Rectangle 20 61 346 210)
               #usePreferredExtent: false
+              #returnIsOKInDialog: true
+              #escapeIsCancelInDialog: true
           )
           #component: 
            #(#SpecCollection
@@ -1188,7 +1201,7 @@
                #(
                  #(#FramedBoxSpec
                     #name: 'FramedBox'
-                    #layout: #(#LayoutFrame 0 0.0 6 0.0 0 1.0 100 0)
+                    #layout: #(#LayoutFrame 0 0.0 6 0.0 0 1.0 137 0)
                     #component: 
                      #(#SpecCollection
                         #collection: 
@@ -1203,12 +1216,14 @@
                               #name: 'fieldLeftOffset'
                               #layout: #(#LayoutFrame 90 0 13 0 140 0 35 0)
                               #activeHelpKey: #hrzExtent
+                              #enableChannel: #notUsingDefaultExtent
                               #tabable: true
                               #model: #leftOffset
                               #group: #inputGroup
                               #type: #numberOrNil
-                    #acceptChannel: #acceptChannel
-                    #modifiedChannel: #modifiedChannel
+                              #acceptOnLostFocus: true
+                              #acceptChannel: #acceptChannel
+                              #modifiedChannel: #modifiedChannel
                           )
                            #(#LabelSpec
                               #name: 'labelHeight'
@@ -1220,12 +1235,21 @@
                               #name: 'fieldRightOffset'
                               #layout: #(#LayoutFrame 90 0 38 0 140 0 60 0)
                               #activeHelpKey: #vrtExtent
+                              #enableChannel: #notUsingDefaultExtent
                               #tabable: true
                               #model: #rightOffset
                               #group: #inputGroup
                               #type: #numberOrNil
-                    #acceptChannel: #acceptChannel
-                    #modifiedChannel: #modifiedChannel
+                              #acceptOnLostFocus: true
+                              #acceptChannel: #acceptChannel
+                              #modifiedChannel: #modifiedChannel
+                          )
+                           #(#CheckBoxSpec
+                              #name: 'useDefaultExtentCheckBox'
+                              #layout: #(#LayoutFrame -1 0 75 0 135 0 97 0)
+                              #model: #useDefaultExtent
+                              #label: 'Use Widgets Default Extent'
+                              #translateLabel: true
                           )
                         )
                     )
@@ -1235,13 +1259,11 @@
               )
           )
       )
-
-    "Modified: / 13.8.1998 / 19:58:04 / cg"
 ! !
 
 !UILayoutTool::Extent methodsFor:'accessing'!
 
-fetch:aView
+fetch:aView spec:aSpec
     "fetch extent
     "
     |extent|
@@ -1251,7 +1273,7 @@
     (self aspectFor:#leftOffset)  value:(extent x).
     (self aspectFor:#rightOffset) value:(extent y).
 
-
+    (self aspectFor:#useDefaultExtent) value:aSpec useDefaultExtent 
 !
 
 layout
@@ -1529,6 +1551,7 @@
                               #model: #rightFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                              #acceptOnLostFocus: true
                               #acceptChannel: #acceptChannel
                               #modifiedChannel: #modifiedChannel
                           )
@@ -1545,6 +1568,7 @@
                               #model: #rightOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                              #acceptOnLostFocus: true
                               #acceptChannel: #acceptChannel
                               #modifiedChannel: #modifiedChannel
                           )
@@ -1566,6 +1590,7 @@
                               #model: #bottomFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                              #acceptOnLostFocus: true
                               #acceptChannel: #acceptChannel
                               #modifiedChannel: #modifiedChannel
                           )
@@ -1582,6 +1607,7 @@
                               #model: #bottomOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                              #acceptOnLostFocus: true
                               #acceptChannel: #acceptChannel
                               #modifiedChannel: #modifiedChannel
                           )
@@ -1707,7 +1733,7 @@
 
 !UILayoutTool::LayoutFrame methodsFor:'accessing'!
 
-fetch:aView
+fetch:aView spec:aSpec
     |layout|
 
     layout  := UIPainterView asLayoutFrameFromView:aView.
@@ -1868,7 +1894,7 @@
 
 !UILayoutTool::LayoutOrigin methodsFor:'accessing'!
 
-fetch:aView
+fetch:aView spec:aSpec
     "fetch layoutOrigin
     "
     |layout|
@@ -1946,7 +1972,7 @@
 
 !UILayoutTool::Point methodsFor:'accessing'!
 
-fetch:aView
+fetch:aView spec:aSpec
     "fetch point
     "
     |origin|
@@ -2028,6 +2054,7 @@
                               #model: #rightOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                              #acceptOnLostFocus: true
                     #acceptChannel: #acceptChannel
                     #modifiedChannel: #modifiedChannel
                           )
@@ -2045,6 +2072,7 @@
                               #model: #bottomOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                              #acceptOnLostFocus: true
                     #acceptChannel: #acceptChannel
                     #modifiedChannel: #modifiedChannel
                           )
@@ -2062,7 +2090,7 @@
 
 !UILayoutTool::Rectangle methodsFor:'accessing'!
 
-fetch:aView
+fetch:aView spec:aSpec
     "fetch rectangle
     "
     |origin corner|