inputFields use modified & acceptChannels
authorClaus Gittinger <cg@exept.de>
Fri, 19 Mar 1999 15:12:25 +0100
changeset 1063 9e710dbc7c92
parent 1062 15184a3a00e1
child 1064 1a9bbca19e25
inputFields use modified & acceptChannels
UILayoutTool.st
UIPainter.st
UISpecificationTool.st
--- a/UILayoutTool.st	Fri Mar 19 13:24:33 1999 +0100
+++ b/UILayoutTool.st	Fri Mar 19 15:12:25 1999 +0100
@@ -225,6 +225,8 @@
                               #model: #leftFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#ActionButtonSpec
                               #name: 'actionRelativeLeft'
@@ -240,6 +242,8 @@
                               #model: #leftOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#ActionButtonSpec
                               #name: 'actionAbsoluteLeft'
@@ -260,6 +264,8 @@
                               #model: #topFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#ActionButtonSpec
                               #name: 'actionRelativeTop'
@@ -275,6 +281,8 @@
                               #model: #topOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#ActionButtonSpec
                               #name: 'actionAbsoluteTop'
@@ -345,6 +353,8 @@
                               #model: #leftOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#LabelSpec
                               #name: 'labelOriginX'
@@ -359,6 +369,8 @@
                               #model: #topOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                         )
                     )
@@ -435,6 +447,12 @@
 
 !UILayoutTool methodsFor:'accessing'!
 
+acceptChannel
+    "return the value of the instance variable 'acceptChannel' (automatically generated)"
+
+    ^ masterApplication acceptChannel
+!
+
 layout
     "returns configued layout or nil
     "
@@ -875,6 +893,8 @@
                               #model: #leftAlignmentFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#InputFieldSpec
                               #name: 'topAlignmentFractionField'
@@ -884,6 +904,8 @@
                               #model: #topAlignmentFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#DividerSpec
                               #name: 'separator1'
@@ -1186,6 +1208,8 @@
                               #model: #leftOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#LabelSpec
                               #name: 'labelHeight'
@@ -1201,6 +1225,8 @@
                               #model: #rightOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                         )
                     )
@@ -1341,6 +1367,8 @@
                               #model: #rightFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#ActionButtonSpec
                               #name: 'actionRelativeRight'
@@ -1355,6 +1383,8 @@
                               #model: #rightOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#ActionButtonSpec
                               #name: 'actionAbsoluteRight'
@@ -1374,6 +1404,8 @@
                               #model: #bottomFraction
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#ActionButtonSpec
                               #name: 'actionRelativeBottom'
@@ -1388,6 +1420,8 @@
                               #model: #bottomOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#ActionButtonSpec
                               #name: 'actionAbsoluteBottom'
@@ -1652,6 +1686,8 @@
                               #model: #rightOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                            #(#LabelSpec
                               #name: 'labelCornerX'
@@ -1667,6 +1703,8 @@
                               #model: #bottomOffset
                               #group: #inputGroup
                               #type: #numberOrNil
+                    #acceptChannel: #acceptChannel
+                    #modifiedChannel: #modifiedChannel
                           )
                         )
                     )
--- a/UIPainter.st	Fri Mar 19 13:24:33 1999 +0100
+++ b/UIPainter.st	Fri Mar 19 15:12:25 1999 +0100
@@ -1865,37 +1865,37 @@
 noteBookView
     "returns the notebook view; initialize the tools embedded in the notebook"
 
-    |noteBook channel helpTool layoutTool specTool|
+    |noteBook modifiedChannel acceptChannel helpTool layoutTool specTool|
 
     (noteBook := builder bindingAt:#noteBookView) isNil ifTrue:[
-	noteBook   := View new.
-	layoutTool := UILayoutTool new.
-	helpTool   := UIHelpTool   new.
-	helpTool buildFromClass:specClass.
-	specTool   := UISpecificationTool new.
-	channel    := self modifiedChannel.
-
-	layoutTool masterApplication:self.
-	specTool   masterApplication:self.
-	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   := View new.
+        layoutTool := UILayoutTool new.
+        helpTool   := UIHelpTool   new.
+        helpTool buildFromClass:specClass.
+        specTool   := UISpecificationTool new.
+        modifiedChannel    := self modifiedChannel.
+
+        layoutTool masterApplication:self.
+        specTool   masterApplication:self.
+        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:modifiedChannel.
+        helpTool   modifiedHolder:modifiedChannel.
+        specTool   modifiedHolder:modifiedChannel.
+
+        builder aspectAt:#noteBookView put:noteBook.
     ].
     ^ noteBook
 !
@@ -2220,18 +2220,18 @@
     treeView notNil
     ifTrue:
     [
-	treeSelection := treeView selection.
-	"/ the top-node cannot be cut, copied or pasted.
-	canCutOrCopy := treeSelection size >= 1 and:[treeSelection first ~~ 1].
-	clipboard := self getSelection.
-
-	clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
-			      ifFalse:[sel := clipboard].
-
-	canPaste := (sel isKindOf:UISpecification) and: 
-		    [treeSelection size  = 1 
-		    and:[treeSelection first == 1 
-		    or: [self canPasteInto: treeView selectedNode contents view]]]
+        treeSelection := treeView selection.
+        "/ the top-node cannot be cut, copied or pasted.
+        canCutOrCopy := treeSelection size >= 1 and:[treeSelection first ~~ 1].
+        clipboard := self getSelection.
+
+        clipboard isCollection ifTrue:[clipboard notEmpty ifTrue:[sel := clipboard first]]
+                              ifFalse:[sel := clipboard].
+
+        canPaste := (sel isKindOf:UISpecification) and: 
+                    [treeSelection size  = 1 
+                    and:[treeSelection first == 1 
+                    or: [self canPasteInto: treeView selectedNode contents view]]]
     ].
 
     self valueOfCanCut value: canCutOrCopy.
@@ -2239,6 +2239,8 @@
     self valueOfCanPaste value: canPaste.            
     self valueOfCanPasteWithKeepingLayout value: (canPaste "&  self canKeepLayoutInSelection").
 
+"/    self modifiedChannel value: false.
+
     "Modified: / 16.7.1998 / 19:13:30 / cg"
 ! !
 
@@ -2929,33 +2931,36 @@
 
     |painter layout spec prop key layoutTool|
 
+    self acceptChannel value:true.      "/ force editFields to accept
+    self acceptChannel value:false.
+
     self modifiedChannel value:false.
     modified := true.
 
     painter := self painter.
 
     self isLayoutToolSelected ifTrue:[
-	layoutTool := self layoutTool.
-
-	(layout := layoutTool layout) notNil ifTrue:[
-	    layoutTool layoutType == #Extent ifTrue:[
-		layoutTool layoutView == painter topView ifTrue:[
-		    layoutTool layoutView extent:layout
-		] ifFalse:[
-		    painter setExtent:layout
-		]
-	    ] ifFalse:[
-		painter setLayout:layout
-	    ]
-	]
+        layoutTool := self layoutTool.
+
+        (layout := layoutTool layout) notNil ifTrue:[
+            layoutTool layoutType == #Extent ifTrue:[
+                layoutTool layoutView == painter topView ifTrue:[
+                    layoutTool layoutView extent:layout
+                ] ifFalse:[
+                    painter setExtent:layout
+                ]
+            ] ifFalse:[
+                painter setLayout:layout
+            ]
+        ]
     ] ifFalse:[
-	spec := self specTool specification.
-
-	self isHelpToolSelected ifTrue:[
-	    self helpTool accept.      
-	    spec activeHelpKey:self helpTool helpKey.
-	].      
-	painter updateFromSpec:spec
+        spec := self specTool specification.
+
+        self isHelpToolSelected ifTrue:[
+            self helpTool accept.      
+            spec activeHelpKey:self helpTool helpKey.
+        ].      
+        painter updateFromSpec:spec
     ]             
 
 
--- a/UISpecificationTool.st	Fri Mar 19 13:24:33 1999 +0100
+++ b/UISpecificationTool.st	Fri Mar 19 15:12:25 1999 +0100
@@ -15,7 +15,7 @@
 
 ApplicationModel subclass:#UISpecificationTool
 	instanceVariableNames:'modifiedHolder aspects specification selection specChannel
-		scrolledView windowFrame'
+		scrolledView windowFrame acceptChannel'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-UIPainter'
@@ -546,6 +546,12 @@
 
 !UISpecificationTool methodsFor:'accessing'!
 
+acceptChannel
+    "return the value of the instance variable 'acceptChannel' (automatically generated)"
+
+    ^ masterApplication acceptChannel
+!
+
 specification
     "gets current edit specification
     "
@@ -587,6 +593,8 @@
 
         aspects        := UISpecification newBindingsDictionary.
         aspects builder:builder.
+        aspects at:#modifiedChannel put:modifiedHolder.
+        aspects at:#acceptChannel put:self acceptChannel.
 
         specChannel    := specification asValue.
         specification class addBindingsTo:aspects for:specification channel:specChannel.