--- a/UIPainterTreeView.st Fri Feb 28 10:20:51 1997 +0100
+++ b/UIPainterTreeView.st Fri Feb 28 10:22:30 1997 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:3.1.4 on 25-feb-1997 at 2:17:28 pm' !
-
SelectionInListView subclass:#UIPainterTreeView
instanceVariableNames:'builderView'
classVariableNames:''
@@ -79,41 +77,13 @@
!UIPainterTreeView methodsFor:'event handling'!
-selectionChanged
- "selection has changed
+builderViewChanged:what
+ "something changed in the builder view
"
- |sel|
-
- selection notNil ifTrue:[
- selection size == 1 ifTrue:[
- sel := (list at:(selection first)) string withoutSeparators
- ] ifFalse:[
- sel := OrderedCollection new.
- selection do:[:aNumber|
- aNumber ~~ 1 ifTrue:[
- sel add:((list at:aNumber) string withoutSeparators)
- ]
- ]
- ]
- ].
- builderView selectNames:sel
-
-!
-
-selectionChangedFrom:oldSelection
- "redraw master
- "
- self disableMaster:oldSelection.
- super selectionChangedFrom:oldSelection
-
-!
-
-update:something
-
- (something == #tree or:[something == #widgetName]) ifTrue:[
+ (what == #tree or:[what == #widgetName]) ifTrue:[
self updateTree
] ifFalse:[
- something ~~ #selection ifTrue:[
+ what ~~ #selection ifTrue:[
^ self
].
self disableMaster:selection.
@@ -142,6 +112,35 @@
selection isNil ifTrue:[
self setSelection:1
]
+!
+
+selectionChanged
+ "selection has changed
+ "
+ |sel|
+
+ selection notNil ifTrue:[
+ selection size == 1 ifTrue:[
+ sel := (list at:(selection first)) string withoutSeparators
+ ] ifFalse:[
+ sel := OrderedCollection new.
+ selection do:[:aNumber|
+ aNumber ~~ 1 ifTrue:[
+ sel add:((list at:aNumber) string withoutSeparators)
+ ]
+ ]
+ ]
+ ].
+ builderView selectNames:sel
+
+!
+
+selectionChangedFrom:oldSelection
+ "redraw master
+ "
+ self disableMaster:oldSelection.
+ super selectionChangedFrom:oldSelection
+
! !
!UIPainterTreeView methodsFor:'initialization'!
@@ -172,40 +171,27 @@
!
menu
- |menu noSel|
-
- noSel := builderView numberOfSelections.
+ |menu|
- menu := PopUpMenu labels:(
- resources array:#(
- 'cut'
- 'undo'
+ (menu := builderView menu) notNil ifTrue:[
+ menu addLabels:(
+ resources array:#(
'-'
- 'misc'
- )
- )
- selectors:#(
- #cut
- #undo
+ 'treeMisc'
+ )
+ )
+ selectors:#(
nil
- #misc
- )
- receiver:self.
-
- noSel == 1 ifTrue:[ menu subMenuAt:#misc put:(self menuMisc)]
- ifFalse:[ menu disable:#misc].
+ #treeMisc
+ ).
- noSel == 0 ifTrue:[ menu disable:#cut]
- ifFalse:[ menu actionAt:#cut put:[builderView deleteSelection]].
-
- builderView hasUndos ifFalse:[ menu disable:#undo]
- ifTrue:[ menu actionAt:#undo put:[builderView undoLast]].
-
-
-
- ^ menu
-
-
+ (builderView numberOfSelections) == 1 ifTrue:[
+ menu subMenuAt:#treeMisc put:(self menuMisc)
+ ] ifFalse:[
+ menu disable:#treeMisc
+ ]
+ ].
+ ^ menu
!
menuMisc
@@ -270,15 +256,15 @@
index := index - 1
].
(spView changeSequenceOrderFor:view to:index) ifTrue:[
- self update:#tree
+ self builderViewChanged:#tree
]
!
removeLayout
- builderView selectionHiddenDo:[
+ builderView withSelectionHiddenDo:[
builderView selectionDo:[:aView|
aView geometryLayout:nil.
- aView superView sizeChanged:nil
+ builderView elementChangedSize:aView.
]
].
! !