--- a/UIPainter.st Wed Aug 13 15:16:57 1997 +0200
+++ b/UIPainter.st Fri Aug 15 17:36:02 1997 +0200
@@ -1603,6 +1603,43 @@
!UIPainter methodsFor:'selection'!
+canvasSelected
+ |spec|
+
+ self hasValidSelection value:false.
+ self canStepIn value:false.
+ self canStepOut value:false.
+ self hasSingleSelection value:false.
+
+ spec := treeView canvasSpec.
+ (builder componentAt:#noteBook) setSelection:nil.
+ self setupSlicesFrom:spec hasLayout:false.
+ tabSelection := nil.
+
+ layoutTool layoutView:nil.
+ specTool specification:spec.
+ self modifiedChannel value:false.
+ self tabSelection:(self tabList value first).
+ specTool selection:tabSelection.
+ (self noteBookView subViews at:2) raise.
+ (builder componentAt:#noteBook) setSelection:1.
+ self modifiedChannel value:false.
+
+!
+
+setupSlicesFrom:aSpec hasLayout:hasLayout
+
+ |slices list|
+
+ slices := aSpec class slices.
+ list := slices collect:[:aSlice| aSlice first asString].
+
+ hasLayout ifTrue:[
+ list add:(layoutTool class label)
+ ].
+ self tabList value:list.
+!
+
tabSelection
"returns current name of section
"
@@ -1646,7 +1683,10 @@
self accept
]
].
-
+ treeView isCanvasSelected ifTrue:[
+ ^ self canvasSelected
+ ].
+
props := treeView propertySelected.
oldSelection := tabSelection.
tabSelection := nil.
@@ -1661,15 +1701,10 @@
spec := props spec copy.
layoutTool layoutView == view ifFalse:[
- slices := spec class slices.
- size := slices size + 1.
- list := Array new:size.
- slices keysAndValuesDo:[:i :s|list at:i put:(s first asString)].
- list at:size put:(layoutTool class label).
- (self tabList) value:list.
- ] ifTrue:[
- list := self tabList value
+ self setupSlicesFrom:spec hasLayout:true.
].
+ list := self tabList value.
+
(list findFirst:[:n| n = oldSelection ]) ~~ 0 ifTrue:[
tabSelection := oldSelection
] ifFalse:[
@@ -2287,6 +2322,32 @@
model root expand.
self enableChannel:(aCanvas enableChannel).
+!
+
+canvasName:aName
+ "change id of canvas
+ "
+ |name|
+
+ ( aName size ~~ 0
+ and:[(name := aName string withoutSeparators) size ~~ 0
+ and:[(self propertyDetect:[:p| p name = name]) isNil
+ and:[(listOfNodes at:1) name ~= name]]]
+ ) ifTrue:[
+ (listOfNodes at:1) name:name.
+ self redrawLine:1.
+ ]
+!
+
+canvasSpec
+ "returns spec assigned to canvas
+ "
+ |spec|
+
+ spec := WindowSpec new.
+ spec fromView:(self canvas topView) callBack:nil.
+ spec name:(listOfNodes at:1) name.
+ ^ spec
! !
!UIPainter::TreeView methodsFor:'accessing property'!
@@ -2478,6 +2539,23 @@
!UIPainter::TreeView methodsFor:'change & update'!
+canvasNameChanged:aName
+ "called if identification name assigned to window (canvas) changed
+ "
+ |name node|
+
+ node := listOfNodes at:1.
+
+ ( aName size ~~ 0
+ and:[(name := aName string withoutSeparators) size ~~ 0
+ and:[(self propertyDetect:[:p| p name = name]) isNil
+ and:[node name ~= name]]]
+ ) ifTrue:[
+ node name:name.
+ self redrawLine:1.
+ ].
+!
+
layoutChanged
"layout of any component changed; in case of single selection, the
application will be informed to update its layout
@@ -2712,6 +2790,13 @@
]
].
^ true
+!
+
+isCanvasSelected
+ "returns true in case of a single selection and the
+ selection is the canvas (index 1)
+ "
+ ^ (selection size == 1 and:[self isInSelection:1])
! !
!UIPainter::TreeView methodsFor:'user interactions'!