UIPainter.st
changeset 366 68b0e0a329a4
parent 365 1610933f0e94
child 368 9e588f397bc9
--- a/UIPainter.st	Wed Oct 29 22:43:13 1997 +0100
+++ b/UIPainter.st	Thu Oct 30 00:12:57 1997 +0100
@@ -10,7 +10,6 @@
  hereby transferred.
 "
 
-
 ApplicationModel subclass:#UIPainter
 	instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
 		specSuperclass aspects layoutCanvas helpCanvas specCanvas
@@ -427,6 +426,112 @@
 
 !UIPainter class methodsFor:'interface specs'!
 
+gridParametersSpec
+    "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:#gridParametersSpec
+     UIPainter new openInterface:#gridParametersSpec
+    "
+    "UIPainter open"
+
+    <resource: #canvas>
+
+    ^
+
+       #(#FullSpec
+          #'window:' 
+           #(#WindowSpec
+              #'name:' 'Grid Parameters:'
+              #'layout:' #(#LayoutFrame 219 0 193 0 484 0 366 0)
+              #'label:' 'Grid Parameters:'
+              #'min:' #(#Point 10 10)
+              #'max:' #(#Point 1280 1024)
+              #'bounds:' #(#Rectangle 219 193 485 367)
+          )
+          #'component:' 
+           #(#SpecCollection
+              #'collection:' 
+               #(
+                 #(#LabelSpec
+                    #'name:' 'gridParameters'
+                    #'layout:' #(#LayoutOrigin 0 0 0 0)
+                    #'label:' 'Grid Parameters:'
+                    #'adjust:' #left
+                    #'resizeForLabel:' true
+                )
+                 #(#CheckBoxSpec
+                    #'name:' 'show'
+                    #'layout:' #(#Point 30 31)
+                    #'model:' #showGrid
+                    #'label:' 'show grid'
+                )
+                 #(#CheckBoxSpec
+                    #'name:' 'align'
+                    #'layout:' #(#Point 30 57)
+                    #'model:' #alignToGrid
+                    #'label:' 'align to grid'
+                )
+                 #(#LabelSpec
+                    #'name:' 'hrzLabel'
+                    #'layout:' #(#Point 90 94)
+                    #'label:' 'pixels horizontal'
+                    #'resizeForLabel:' true
+                )
+                 #(#InputFieldSpec
+                    #'name:' 'hrzField'
+                    #'layout:' #(#LayoutFrame 33 0 91 0 86 0 113 0)
+                    #'model:' #hspace
+                    #'type:' #numberOrNil
+                )
+                 #(#LabelSpec
+                    #'name:' 'vrtLabel'
+                    #'layout:' #(#Point 90 118)
+                    #'label:' 'pixels vertical'
+                    #'resizeForLabel:' true
+                )
+                 #(#InputFieldSpec
+                    #'name:' 'vrtField'
+                    #'layout:' #(#LayoutFrame 33 0 115 0 86 0 137 0)
+                    #'model:' #vspace
+                    #'type:' #numberOrNil
+                )
+                 #(#HorizontalPanelViewSpec
+                    #'name:' 'horizontalPanelView1'
+                    #'layout:' #(#LayoutFrame 0 0.0 -30 1.0 0 1.0 0 1.0)
+                    #'component:' 
+                     #(#SpecCollection
+                        #'collection:' 
+                         #(
+                           #(#ActionButtonSpec
+                              #'name:' 'cancel'
+                              #'label:' 'cancel'
+                              #'model:' #cancel
+                              #'extent:' #(#Point 128 24)
+                          )
+                           #(#ActionButtonSpec
+                              #'name:' 'accept'
+                              #'label:' 'accept'
+                              #'model:' #accept
+                              #'extent:' #(#Point 129 24)
+                          )
+                        )
+                    )
+                    #'horizontalLayout:' #fitSpace
+                    #'verticalLayout:' #fitSpace
+                    #'horizontalSpace:' 3
+                    #'verticalSpace:' 3
+                )
+              )
+          )
+      )
+
+
+!
+
 nameAndSelectorSpec
     "this window spec was automatically generated by the ST/X UIPainter"
 
@@ -913,6 +1018,7 @@
                 #'label:' 'undo'
                 #'nameKey:' #undo
                 #'enabled:' #hasUndoHistory
+                #'shortcutKeyCharacter:' #Cmdu
                 #'value:' #undoLast
             )
              #(#MenuItem
@@ -1222,6 +1328,13 @@
                                     #'label:' 'align'
                                     #'indication:' #'gridAlign:'
                                 )
+                                 #(#MenuItem
+                                    #'label:' '-'
+                                )
+                                 #(#MenuItem
+                                    #'label:' 'menu'
+                                    #'value:' #gridMenu
+                                )
                               ) nil
                               nil
                           )
@@ -2104,6 +2217,7 @@
 
     treeView model removeDependent:self.
     self painter release.
+    ColorMenu releaseResources.
 
     selectionPanel notNil ifTrue:[
         selectionPanel masterApplication:nil.
@@ -2365,6 +2479,41 @@
     ] doWhile:[again].
 
     self specClass:specClass.
+!
+
+gridMenu
+    "open a dialog for grip parameters configuration
+    "
+    |hspace vspace bindings painter gridPara|
+
+    painter  := self painter.
+    bindings := IdentityDictionary new.
+    gridPara := painter gridParameters copy.
+
+    bindings at:#showGrid    put:(painter gridShown asValue).
+    bindings at:#alignToGrid put:(painter gridAlign asValue).
+    bindings at:#hspace      put:((gridPara at:1) asValue).
+    bindings at:#vspace      put:((gridPara at:2) asValue).
+
+    (self openDialogInterface:#gridParametersSpec withBindings:bindings) ifFalse:[
+        ^ self
+    ].
+
+    hspace := (bindings at:#hspace) value ? 5.
+    vspace := (bindings at:#vspace) value ? 5.
+
+    gridPara at:1 put:hspace.
+    gridPara at:2 put:vspace.
+    gridPara at:5 put:hspace.
+    gridPara at:6 put:vspace.
+
+    painter gridShown:false.
+    painter gridAlign:false.
+    painter gridParameters:gridPara.
+    painter gridAlign:(bindings at:#alignToGrid) value.
+    painter gridShown:(bindings at:#showGrid) value.
+
+
 ! !
 
 !UIPainter methodsFor:'user interaction - move'!