UIPainterView.st
changeset 223 203460df426e
parent 219 7b38043ae232
child 231 75de472d579f
--- a/UIPainterView.st	Sun Jul 20 12:22:43 1997 +0200
+++ b/UIPainterView.st	Sun Jul 20 12:23:35 1997 +0200
@@ -11,19 +11,12 @@
 "
 
 UIObjectView subclass:#UIPainterView
-	instanceVariableNames:'listHolder superclassName className methodName categoryName'
+	instanceVariableNames:'claus listHolder superclassName className methodName categoryName'
 	classVariableNames:'HandCursor'
 	poolDictionaries:''
 	category:'Interface-UIPainter'
 !
 
-MultiSelectionInList subclass:#ListHolder
-	instanceVariableNames:'painter propertyList masterElement disabledChanged'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:UIPainterView
-!
-
 Object subclass:#ViewProperty
 	instanceVariableNames:'view spec identifier'
 	classVariableNames:'Identifier'
@@ -72,263 +65,6 @@
 
 ! !
 
-!UIPainterView class methodsFor:'menu specs'!
-
-menu
-    "this window spec was automatically generated by the ST/X MenuEditor"
-
-    "do not manually edit this - the builder may not be able to
-     handle the specification if its corrupted."
-
-    "
-     MenuEditor new openOnClass:UIPainterView andSelector:#menu
-     (Menu new fromLiteralArrayEncoding:(UIPainterView menu)) startUp
-    "
-
-    <resource: #menu>
-
-    ^
-     
-       #(#Menu
-          
-           #(
-             #(#MenuItem
-                #'label:' 'copy'
-                #'value:' #copySelection
-                #'shortcutKeyCharacter:' #Copy
-            )
-             #(#MenuItem
-                #'label:' 'cut'
-                #'value:' #deleteSelection
-                #'shortcutKeyCharacter:' #Cut
-            )
-             #(#MenuItem
-                #'label:' 'paste'
-                #'nameKey:' #paste
-                #'value:' #paste
-                #'submenu:' 
-                 #(#Menu
-                    
-                     #(
-                       #(#MenuItem
-                          #'label:' 'paste'
-                          #'value:' #pasteBuffer
-                          #'activeHelpKey:' #pasteBuffer
-                          #'shortcutKeyCharacter:' #Paste
-                      )
-                       #(#MenuItem
-                          #'label:' 'keep layout'
-                          #'value:' #pasteWithLayout
-                          #'activeHelpKey:' #pasteWithLayout
-                      )
-                    ) nil
-                    nil
-                )
-            )
-             #(#MenuItem
-                #'label:' '-'
-            )
-             #(#MenuItem
-                #'label:' 'undo'
-                #'nameKey:' #undo
-                #'value:' #undoLast
-            )
-             #(#MenuItem
-                #'label:' '-'
-            )
-             #(#MenuItem
-                #'label:' 'arrange'
-                #'value:' #arrange
-                #'submenu:' 
-                 #(#Menu
-                    
-                     #(
-                       #(#MenuItem
-                          #'label:' 'to front'
-                          #'value:' #raiseSelection
-                      )
-                       #(#MenuItem
-                          #'label:' 'to back'
-                          #'value:' #lowerSelection
-                      )
-                    ) nil
-                    nil
-                )
-            )
-             #(#MenuItem
-                #'label:' 'dimension'
-                #'value:' #dimension
-                #'submenu:' 
-                 #(#Menu
-                    
-                     #(
-                       #(#MenuItem
-                          #'label:' 'default extent'
-                          #'value:' #setToDefaultExtent
-                          #'activeHelpKey:' #setToDefaultExtent
-                      )
-                       #(#MenuItem
-                          #'label:' 'default width'
-                          #'value:' #setToDefaultWidth
-                          #'activeHelpKey:' #setToDefaultWidth
-                      )
-                       #(#MenuItem
-                          #'label:' 'default height'
-                          #'value:' #setToDefaultHeight
-                          #'activeHelpKey:' #setToDefaultHeight
-                      )
-                       #(#MenuItem
-                          #'label:' 'copy extent'
-                          #'value:' #copyExtent
-                          #'activeHelpKey:' #copyExtent
-                      )
-                       #(#MenuItem
-                          #'label:' 'paste extent'
-                          #'value:' #pasteExtent
-                          #'activeHelpKey:' #pasteExtent
-                      )
-                       #(#MenuItem
-                          #'label:' 'paste width'
-                          #'value:' #pasteWidth
-                          #'activeHelpKey:' #pasteWidth
-                      )
-                       #(#MenuItem
-                          #'label:' 'paste height'
-                          #'value:' #pasteHeight
-                          #'activeHelpKey:' #pasteHeight
-                      )
-                       #(#MenuItem
-                          #'label:' 'copy  layout'
-                          #'value:' #copyLayout
-                          #'activeHelpKey:' #copyLayout
-                      )
-                       #(#MenuItem
-                          #'label:' 'paste layout'
-                          #'value:' #pasteLayout
-                          #'activeHelpKey:' #pasteLayout
-                      )
-                    )
-                    #(3 1 3)
-                    nil
-                )
-            )
-             #(#MenuItem
-                #'label:' 'align'
-                #'value:' #align
-                #'submenu:' 
-                 #(#Menu
-                    
-                     #(
-                       #(#MenuItem
-                          #'label:' 'align left'
-                          #'value:' #alignSelectionLeft
-                          #'activeHelpKey:' #alignSelectionLeft
-                          #'labelImage:' 
-                           #(#ResourceRetriever
-                              #UIPainter #iconAlignL
-                              'align left'
-                          )
-                      )
-                       #(#MenuItem
-                          #'label:' 'align right'
-                          #'value:' #alignSelectionRight
-                          #'activeHelpKey:' #alignSelectionRight
-                          #'labelImage:' 
-                           #(#ResourceRetriever
-                              #UIPainter #iconAlignR
-                              'align right'
-                          )
-                      )
-                       #(#MenuItem
-                          #'label:' 'align left & right'
-                          #'value:' #alignSelectionLeftAndRight
-                          #'activeHelpKey:' #alignSelectionLeftAndRight
-                          #'labelImage:' 
-                           #(#ResourceRetriever
-                              #UIPainter #iconAlignLR
-                              'align left & right'
-                          )
-                      )
-                       #(#MenuItem
-                          #'label:' 'align top'
-                          #'value:' #alignSelectionTop
-                          #'activeHelpKey:' #alignSelectionTop
-                          #'labelImage:' 
-                           #(#ResourceRetriever
-                              #UIPainter #iconAlignT
-                              'align top'
-                          )
-                      )
-                       #(#MenuItem
-                          #'label:' 'align bottom'
-                          #'value:' #alignSelectionBottom
-                          #'activeHelpKey:' #alignSelectionBottom
-                          #'labelImage:' 
-                           #(#ResourceRetriever
-                              #UIPainter #iconAlignB
-                              'align bottom'
-                          )
-                      )
-                       #(#MenuItem
-                          #'label:' 'align top & bottom'
-                          #'value:' #alignSelectionTopAndBottom
-                          #'activeHelpKey:' #alignSelectionTopAndBottom
-                          #'labelImage:' 
-                           #(#ResourceRetriever
-                              #UIPainter #iconAlignTB
-                              'align top & bottom'
-                          )
-                      )
-                       #(#MenuItem
-                          #'label:' 'align centered horizontal'
-                          #'value:' #alignSelectionCenterHor
-                          #'activeHelpKey:' #alignSelectionCenterHor
-                          #'labelImage:' 
-                           #(#ResourceRetriever
-                              #UIPainter #iconAlignCenterH
-                              'align centered horizontal'
-                          )
-                      )
-                       #(#MenuItem
-                          #'label:' 'align centered vertical'
-                          #'value:' #alignSelectionCenterVer
-                          #'activeHelpKey:' #alignSelectionCenterVer
-                          #'labelImage:' 
-                           #(#ResourceRetriever
-                              #UIPainter #iconAlignCenterV
-                              'align centered vertical'
-                          )
-                      )
-                       #(#MenuItem
-                          #'label:' 'spread horizontal'
-                          #'value:' #spreadSelectionHor
-                          #'activeHelpKey:' #spreadSelectionHor
-                      )
-                       #(#MenuItem
-                          #'label:' 'spread vertical'
-                          #'value:' #spreadSelectionVer
-                          #'activeHelpKey:' #spreadSelectionVer
-                      )
-                       #(#MenuItem
-                          #'label:' 'center horizontal in frame'
-                          #'value:' #centerSelectionHor
-                          #'activeHelpKey:' #centerSelectionHor
-                      )
-                       #(#MenuItem
-                          #'label:' 'center vertical in frame'
-                          #'value:' #centerSelectionVer
-                          #'activeHelpKey:' #centerSelectionVer
-                      )
-                    )
-                    #(8 2)
-                    nil
-                )
-            )
-          ) nil
-          nil
-      )
-! !
-
 !UIPainterView methodsFor:'accessing'!
 
 application
@@ -360,8 +96,19 @@
 
 !
 
-listHolder
-    ^ listHolder
+findInputViewIn:aSuperView
+    "returns index of input view into superview or nil
+    "
+    |subviews|
+
+    aSuperView == self ifTrue:[
+        ^ self subViews findFirst:[:v| v == inputView ]
+    ].
+  ^ 0
+!
+
+inputView
+    ^ inputView
 !
 
 methodName
@@ -405,66 +152,8 @@
 
 !UIPainterView methodsFor:'change & update'!
 
-changed:aParameter
-    aParameter == #layout ifTrue:[
-        listHolder removeDependent:self.
-        listHolder changed:aParameter.
-        listHolder addDependent:self.
-    ] ifFalse:[
-        super changed:aParameter
-    ]
-!
-
-selectionChanged
-    "selection has changed
-    "
-    |newSel|
-
-    self selectionDo:[:aView||p|
-        (p := self propertyOfView:aView) notNil ifTrue:[
-            newSel isNil ifTrue:[
-                newSel := OrderedCollection new
-            ].
-            newSel add:(listHolder indexOfName:(p name))
-        ]
-    ].
-    listHolder removeDependent:self.
-    listHolder selectionIndex:newSel.
-    listHolder addDependent:self.
-!
-
-update:what with:aParm from:aSender
-    |loIdx newSel|
-
-    (what == #selectionIndex and:[aSender == listHolder]) ifFalse:[
-        ^ self
-    ].
-    loIdx := listHolder selectionIndex.
-
-    loIdx size ~~ 0 ifTrue:[
-        newSel := loIdx collect:[:i|(listHolder propertyAt:i) view]
-    ].
-    self updateSelectionFrom:newSel.
-!
-
-updateSelectionFrom:aSel
-    "update selection from a new selection
-    "
-    |csel|
-
-    selectionHiddenLevel == 0 ifTrue:[
-        aSel isCollection ifTrue:[
-            self selectionDo:[:el|
-                (aSel includes:el) ifFalse:[self showUnselected:el]
-            ]
-        ] ifFalse:[
-            self selectionDo:[:el|
-                aSel == el ifFalse:[self showUnselected:el]
-            ]
-        ]
-    ].
-    self setSelection:aSel withRedraw:false.
-    self showSelection
+layoutChanged
+    claus layoutChanged
 ! !
 
 !UIPainterView methodsFor:'copy & cut & paste'!
@@ -494,7 +183,7 @@
     coll := self minSetOfSuperViews:(self selection).
 
     coll notNil ifTrue:[
-        listHolder disableNotificationsWhileEvaluating:[
+        claus cvsEventsDisabledDo:[
             self select:nil.
             specs := coll collect:[:aView| self fullSpecFor:aView ].
 
@@ -512,27 +201,32 @@
 pasteBuffer
     "add the objects in the paste-buffer to the object view
     "
-    self pasteSpecifications:(self getSelection) keepLayout:false
+    |sel|
+
+    sel := self pasteSpecifications:(self getSelection) keepLayout:false.
+
+    sel notNil ifTrue:[
+        self select:sel.
+    ].
 
 !
 
 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout
-    "add the specs to the object view
+    "add the specs to the object view; returns list of pasted components
     "
     |paste frame pasteOrigin pasteOffset builder newSel|
 
     (self canPaste:aSpecificationOrList) ifFalse:[
-        ^ self
+        ^ nil
     ].
-    listHolder disableNotificationsWhileEvaluating:[
+
+    claus cvsSetupListDo:[
         aSpecificationOrList isCollection ifTrue:[
             paste := aSpecificationOrList
         ] ifFalse:[
             paste := Array with:aSpecificationOrList
         ].
-        frame := self singleSelection.
-
-        (self canPasteInto:frame) ifFalse:[
+        (frame := self singleSelection) isNil ifTrue:[
             frame := self
         ].
         self setSelection:nil withRedraw:true.
@@ -549,23 +243,21 @@
             pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id.
         ].
 
-        listHolder disableNotificationsWhileEvaluating:[
-            paste do:[:aSpec|
-                |view|
+        paste do:[:aSpec|
+            |view|
 
-                view := self addSpec:aSpec builder:builder in:frame.
+            view := self addSpec:aSpec builder:builder in:frame.
 
-                keepLayout ifFalse:[
-                    (frame bounds containsPoint:pasteOrigin) ifFalse:[
-                        self moveObject:view to:pasteOffset.
-                    ] ifTrue:[
-                        self moveObject:view to:pasteOrigin + pasteOffset.
-                    ].
-                    pasteOffset := pasteOffset + 4
+            keepLayout ifFalse:[
+                (frame bounds containsPoint:pasteOrigin) ifFalse:[
+                    self moveObject:view to:pasteOffset.
+                ] ifTrue:[
+                    self moveObject:view to:pasteOrigin + pasteOffset.
                 ].
-                view realize.
-                newSel add:view.
+                pasteOffset := pasteOffset + 4
             ].
+            view realize.
+            newSel add:view.
         ].
 
         self withinTransaction:#paste objects:newSel do:[
@@ -578,44 +270,79 @@
         ].
         self realizeAllSubViews.
         inputView raise.
-        self select:newSel.
         self elementChangedSize:frame.
-    ]
-
-    "Modified: 4.7.1997 / 23:49:14 / cg"
+    ].
+    ^ newSel
 !
 
 pasteWithLayout
     "add the objects in the paste-buffer to the object view; don't change the
      layout
     "
-    self pasteSpecifications:(self getSelection) keepLayout:true
+    |sel|
+
+    sel := self pasteSpecifications:(self getSelection) keepLayout:true.
 
+    sel notNil ifTrue:[
+        self select:sel.
+    ].
 ! !
 
 !UIPainterView methodsFor:'drag & drop'!
 
 canDrop:anObjectOrCollection
+    anObjectOrCollection size == 1 ifTrue:[
+        ^ self canPaste:(anObjectOrCollection first theObject)
+    ].
+    ^ false
+!
+
+canPaste:something
+    "returns true if something could be paste
+    "
+    |el size|
+
+    ((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[
+        ^ false
+    ].
+    something isCollection ifTrue:[something notEmpty ifTrue:[el := something first]]
+                          ifFalse:[el := something].
+
+    (el isKindOf:UISpecification) ifFalse:[
+        ^ false
+    ].
+
+    size == 1 ifTrue:[
+        ^ self canPasteInto:(self singleSelection)
+    ].
+  ^ true
+
+!
+
+canPasteInto:aView
+    "can paste into a view
+    "
     |spec|
 
-    self enabled ifTrue:[
-        anObjectOrCollection size == 1 ifTrue:[
-            spec := (anObjectOrCollection at:1) theObject.
-            ^ (spec isKindOf:UISpecification)
-        ]
+    aView notNil ifTrue:[
+        spec := self specFor:aView.
+
+        spec isNil ifTrue:[^ aView specClass supportsSubComponents]
+                  ifFalse:[^ spec  class     supportsSubComponents]
     ].
     ^ false
 
-    "Modified: 8.4.1997 / 01:01:50 / cg"
 !
 
 drop:anObjectOrCollection at:aPoint
-    |spec|
+    |spec newSel oldSel|
 
+    oldSel := selection copy.
     spec := (anObjectOrCollection at:1) theObject.
-    self pasteSpecifications:spec keepLayout:false.
+    newSel := self pasteSpecifications:spec keepLayout:false.
 
-
+    oldSel isNil ifTrue:[self select:newSel]
+                ifFalse:[self select:oldSel]
 ! !
 
 !UIPainterView methodsFor:'generating output'!
@@ -669,7 +396,7 @@
     ].
     cls := Smalltalk classNamed:className.
 
-    listHolder propertiesDo:[:aProp |
+    claus propertiesDo:[:aProp |
         |modelSelector menuSelector protoSpec thisCode|
 
         protoSpec := aProp spec.
@@ -799,15 +526,6 @@
 
 !UIPainterView methodsFor:'initialization'!
 
-destroy
-    "remove dependencies
-    "
-    listHolder notNil ifTrue:[
-        listHolder removeDependent:self.
-    ].
-    super destroy.
-!
-
 initialize
     "setup attributes
     "
@@ -817,7 +535,6 @@
     className      := 'NewApplication'.
     methodName     := 'windowSpec'.
     categoryName   := 'Applications'.
-    listHolder     := ListHolder for:self.
     HandCursor     := Cursor leftHand.
 
 !
@@ -825,7 +542,7 @@
 setupFromSpec:specOrSpecArray
     |spec builder|
 
-    listHolder disableNotificationsWhileEvaluating:[
+    claus cvsSetupListDo:[
         self removeAll.
         spec    := UISpecification from:specOrSpecArray.
         builder := UIBuilder new.
@@ -834,6 +551,10 @@
         self realizeAllSubViews.
         inputView raise.
     ]
+!
+
+treeView:aTreeView
+    claus := aTreeView
 ! !
 
 !UIPainterView methodsFor:'menus'!
@@ -841,23 +562,18 @@
 showMiddleButtonMenu
     "show the middle button menu; this returns nil
     "
-    |menu canPaste|
+    |menu|
 
-    self enabled ifFalse:[
-        ^ nil
-    ].
-    menu := MenuPanel fromSpec:(self class menu) receiver:self.
-
-    canPaste := self canPaste:(self getSelection).
+    self enabled ifTrue:[
+        menu := MenuPanel fromSpec:(UIPainter menuCanvas) receiver:self.
 
-    self hasSelection ifTrue:[
-        canPaste := (canPaste and:[self canPasteInto:(self selection)])
-    ] ifFalse:[
-        menu disableAll
+        self hasSelection ifFalse:[
+            menu disableAll
+        ].
+        menu enabledAt:#paste put:(self canPaste:(self getSelection)).
+        menu enabledAt:#undo  put:(undoHistory isEmpty not).
+        menu startUp.
     ].
-    menu enabledAt:#paste put:canPaste.
-    menu enabledAt:#undo  put:(undoHistory isEmpty not).
-    menu startUp.
   ^ nil
 
 
@@ -870,17 +586,17 @@
     "remove anObject from the contents do redraw
     "
     anObject notNil ifTrue:[
-        listHolder remove:anObject
+        claus removeView:anObject.
     ]
 !
 
 removeAll
     "remove all objects and properties
     "
-    listHolder disableNotificationsWhileEvaluating:[
-        self select:nil.
-        listHolder removeAll.
-        self removeUndoHistory.
+    claus cvsEventsDisabledDo:[
+        self  select:nil.
+        claus removeAll.
+        self  removeUndoHistory.
     ]
 ! !
 
@@ -936,7 +652,7 @@
     "returns property assigned to unique identifier
     "
     anId notNil ifTrue:[
-        ^ listHolder detectProperty:[:p| p identifier == anId ]
+        ^ claus propertyDetect:[:p| p identifier == anId ]
     ].
     ^ nil
 !
@@ -948,10 +664,7 @@
 
     aString isNil ifFalse:[
         name := aString string withoutSeparators.
-
-        name = 'self' ifFalse:[
-            ^ listHolder detectProperty:[:p| p name = name ].
-        ]
+      ^ claus propertyDetect:[:p| p name = name ].
     ].
     ^ nil
 !
@@ -960,7 +673,7 @@
     "returns property assigned to view
     "
     (aView isNil or:[aView == self]) ifFalse:[
-        ^ listHolder detectProperty:[:p| p view == aView ]
+        ^ claus propertyDetect:[:p| p view == aView ]
     ].
     ^ nil
 !
@@ -982,7 +695,7 @@
     size  := name size + 1.
     next  := 0.
 
-    listHolder propertiesDo:[:p|
+    claus propertiesDo:[:p|
         |n|
         n := p name.
 
@@ -1011,6 +724,76 @@
 
 ! !
 
+!UIPainterView methodsFor:'selection basics'!
+
+addToSelection:anObject
+    "add an object to the selection
+    "
+    (self enabled and:[(self isSelected:anObject) not]) ifTrue:[
+        selection isCollection ifFalse:[
+            selection isNil ifTrue:[
+                selection := anObject
+            ] ifFalse:[
+                selection := OrderedCollection with:selection with:anObject
+            ]
+        ] ifTrue:[
+            selection add:anObject
+        ].
+        self showSelected:anObject.
+        claus cvsSelectionAdd:anObject.
+    ]
+
+
+!
+
+removeFromSelection:anObject
+    "remove an object from the selection
+    "
+    (self isSelected:anObject) ifTrue:[
+        self showUnselected:anObject.
+
+        selection size > 1 ifTrue:[
+            selection remove:anObject ifAbsent:nil.
+            self showSelection.
+        ] ifFalse:[
+            selection := nil
+        ].
+        claus cvsSelectionRemove:anObject.
+    ]
+
+!
+
+select:something
+    "change selection to something
+    "
+    (self enabled and:[something ~= self selection]) ifTrue:[
+        self setSelection:something withRedraw:true.
+        claus cvsSelection:something
+    ]
+
+!
+
+updateSelectionFromModel:aSel
+    "update selection from a new selection
+    "
+    |sel|
+
+    selectionHiddenLevel == 0 ifTrue:[
+        self selectionDo:[:el| (aSel includes:el) ifFalse:[self showUnselected:el] ]
+    ].
+
+    (aSel indexOf:self) ~~ 0 ifTrue:[
+        aSel size > 1 ifTrue:[sel := aSel copyWithout:self]
+    ] ifFalse:[
+        aSel size ~~ 0 ifTrue:[sel := aSel]
+    ].
+
+    self setSelection:sel withRedraw:false.
+    self showSelection
+
+
+! !
+
 !UIPainterView methodsFor:'specification'!
 
 addSpec:aSpecification builder:aBuilder in:aFrame
@@ -1037,7 +820,7 @@
         (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[
             s name:(self uniqueNameFor:s)
         ].
-        listHolder add:p
+        claus addProperty:p.
     ].
 
     ^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame.
@@ -1135,7 +918,7 @@
                     self elementChangedSize:aView.
                 ].
                 props spec:(aSpec copy).
-                listHolder propertyChanged:props.
+                claus propertyChanged:props.
             ]
         ]
     ]
@@ -1248,7 +1031,7 @@
 
     (view := self findViewWithId:(args at:1)) notNil ifTrue:[
         view perform:(args at:2) with:(args at:3).
-        self changed:#layout.
+        self layoutChanged.
     ]
 !
 
@@ -1297,408 +1080,8 @@
             spec setAttributesIn:view with:builder.
             self elementChangedSize:view.
         ].
-        listHolder propertyChanged:props.
-    ]
-
-    "Modified: 4.7.1997 / 23:49:39 / cg"
-! !
-
-!UIPainterView methodsFor:'user actions - arrange'!
-
-lowerSelection
-    "lower all objects in the selection
-    "
-    self hasSelection ifTrue:[
-        self selectionDo:[:aView|
-            aView lower.
-            aView superView changeSequenceOrderFor:aView to:1.
-        ].
-        listHolder recompute.
-    ]
-
-
-!
-
-raiseSelection
-    "raise all objects in the selection
-    "
-    self hasSelection ifTrue:[
-        self selectionDo:[:aView||sv|
-            aView raise.
-            sv := aView superView.
-            sv changeSequenceOrderFor:aView to:(sv subViews size)
-        ].
-        inputView raise.
-        listHolder recompute.
-    ].
-
-
-! !
-
-!UIPainterView::ListHolder class methodsFor:'instance creation'!
-
-for:aPainter
-    ^ self new for:aPainter
-! !
-
-!UIPainterView::ListHolder methodsFor:'accessing'!
-
-painter
-    "returns painter
-    "
-    ^ painter
-!
-
-propertyAt:anIndex
-    "returns property at an index
-    "
-    ^ propertyList at:anIndex
-! !
-
-!UIPainterView::ListHolder methodsFor:'adding & removing'!
-
-add:aProperty
-    "add property and update list
-    "
-    |idx list name last|
-
-    list := self list.
-    idx  := self findParentProperty:aProperty.
-    name := aProperty name.
-
-    idx == 0 ifTrue:[
-        last := list size
-    ] ifFalse:[
-        last := self lastInGroupStartingAt:idx.
-        name := (String new:(4+((list at:idx) leftIndent))), name.
-    ].
-    propertyList add:aProperty afterIndex:last.
-    list         add:name      afterIndex:last.
-    self changed:#size
-
-
-!
-
-remove:aView
-    "remove all view relevant resources
-    "
-    |start|
-
-    aView notNil ifTrue:[
-        start := self findProperty:[:p| p view == aView ].
-
-        start ~~ 0 ifTrue:[
-            self basicRemove:start.
-            self changed:#size.
-        ]
-    ]
-!
-
-removeAll
-    masterElement := nil.
-    self selection:#().
-
-    [propertyList notEmpty] whileTrue:[
-        self basicRemove:1
-    ].
-    self changed:#size.
-
-! !
-
-!UIPainterView::ListHolder methodsFor:'change & update'!
-
-changed:aParameter
-    "notify all dependents that the receiver has changed somehow.
-     Each dependent gets a '#update:'-message with aParameter
-     as argument. In case of disabled no notifications are raised
-    "
-    disabledChanged ifFalse:[
-        super changed:aParameter
+        claus propertyChanged:props.
     ]
-!
-
-disableNotificationsWhileEvaluating:aBlock
-    "perform block without notification; after evaluation of block,
-     a #size changed notification is raised
-    "
-    |oldState|
-
-    oldState := disabledChanged.
-    disabledChanged := true.
-    aBlock value.
-    disabledChanged := oldState.
-    self changed:#size.
-!
-
-propertyChanged:aProperty
-    "property list changed; update list names
-    "
-    |list idx oldName newName wspName view indent mid|
-
-    view := aProperty view.
-    idx  := self findProperty:[:p| p view == view ].
-
-    idx == 0 ifTrue:[
-        ^ self error
-    ].
-
-    list    := self list.
-    oldName := list at:idx.
-    wspName := oldName string withoutSeparators.
-    newName := aProperty name.
-
-    wspName = newName ifFalse:[
-        mid := self masterElement.
-        list at:idx put:((String new:(oldName leftIndent)), newName).
-
-        idx == mid ifTrue:[
-            masterElement := nil.
-            self masterElement:idx
-        ].
-    ].
-    self changed:#property
-
-! !
-
-!UIPainterView::ListHolder methodsFor:'enumerating'!
-
-propertiesDo:aBlock
-    "evaluate a block for each property
-    "
-    propertyList do:aBlock
-! !
-
-!UIPainterView::ListHolder methodsFor:'initialization'!
-
-for:aPainter
-    "initialize for a painter
-    "
-    painter := aPainter.
-    disabledChanged := false.
-    self list:(OrderedCollection new).
-    propertyList := OrderedCollection new.
-    self selection:#().
-    self addDependent:painter.
-
-! !
-
-!UIPainterView::ListHolder methodsFor:'private'!
-
-basicRemove:start
-    "remove all resources assigned to a group starting at start;
-     no notifications are raised
-    "
-    |end view superView|
-
-    end  := self lastInGroupStartingAt:start.
-    view := (propertyList at:start) view.
-
-    view notNil ifTrue:[
-        superView := view superView.
-        view destroy.
-        superView sizeChanged:nil.
-    ].
-
-    propertyList removeFromIndex:start toIndex:end.
-    self list    removeFromIndex:start toIndex:end.
-!
-
-masterElement
-    "returns index of master
-    "
-    ^ self indexOfName:masterElement.
-!
-
-masterElement:newIndex
-    "change master of selection
-    "
-    |name list oldIdx|
-
-    (oldIdx := self masterElement) ~~ newIndex ifTrue:[
-        list := self list.
-        
-        oldIdx ~~ 0 ifTrue:[
-            list at:oldIdx put:masterElement
-        ].
-        newIndex ~~ 0 ifTrue:[
-            masterElement := list at:newIndex.
-            name := Text string:masterElement.
-            name emphasizeFrom:(1+(name leftIndent)) with:#(#bold #underline).
-            list at:newIndex put:name.
-        ] ifFalse:[
-            masterElement := nil
-        ].
-        self changed:#list.
-    ]
-! !
-
-!UIPainterView::ListHolder methodsFor:'recomputing'!
-
-recompute
-    |list prop size osel|
-
-    osel := self selection copy.
-    size := self list size.
-    list := OrderedCollection new:size.
-    prop := OrderedCollection new:size.
-
-    painter allSubViewsDo:[:v|
-        size := self indexOfView:v.
-
-        size ~~ 0 ifTrue:[
-            list add:(self list at:size).
-            prop add:(propertyList at:size)
-        ]
-    ].
-    propertyList := prop.
-    self list:list.
-    self selection:osel.
-! !
-
-!UIPainterView::ListHolder methodsFor:'searching'!
-
-detectProperty:aBlock
-    "find the property, for which evaluation of the argument, aBlock
-     returns true; return the property or nil if none detected
-    "
-    |idx|
-
-    idx := self findProperty:aBlock.
-    idx ~~ 0 ifTrue:[ ^ propertyList at:idx ].
-  ^ nil
-!
-
-findParentProperty:aChildProp
-    "returns index of parent or 0
-    "
-    |view index|
-
-    view := aChildProp view.
-
-    view notNil ifTrue:[
-        [ (view := view superView) notNil ] whileTrue:[
-            index := self findProperty:[:aProp| aProp view == view ].
-            index ~~ 0 ifTrue:[
-                ^ index
-            ]
-        ]
-    ].
-    ^ 0
-
-
-!
-
-findProperty:aBlock
-    "find the first property, for which evaluation of the argument, aBlock
-     returns true; return its index or 0 if none detected
-    "
-    ^ propertyList findFirst:aBlock
-!
-
-indexOfName:aString
-    "returns index assigned to a string or 0
-    "
-    |name list size|
-
-    aString notNil ifTrue:[
-        name := aString string withoutSeparators.
-        size := name size.
-        list := self list.
-
-        list keysAndValuesDo:[:anIndex :aName|
-            |el|
-
-            el := aName string.
-            (el endsWith:name) ifTrue:[
-                (el size - el leftIndent) == name size ifTrue:[
-                    ^ anIndex
-                ]
-            ]
-        ]
-    ].
-    ^ 0
-
-!
-
-indexOfView:aView
-    "returns index assigned to a view or 0
-    "
-    aView notNil ifTrue:[
-        ^ propertyList findFirst:[:p| p view == aView ]
-    ].
-    ^ 0
-
-!
-
-lastInGroupStartingAt:start
-    "returns last index of a group
-    "
-    |end list idt|
-
-    list := self list.
-
-    start < list size ifTrue:[
-        idt := (list at:start) leftIndent.
-        end := list findFirst:[:el|(el leftIndent) <= idt] startingAt:(start+1).
-        end ~~ 0 ifTrue:[
-            ^ end - 1
-        ]
-    ].
-    ^ list size
-! !
-
-!UIPainterView::ListHolder methodsFor:'selection'!
-
-selectGroup
-    "select all elements assigned to master
-    "
-    |start end sel size|
-
-    painter enabled ifTrue:[
-        (start := self masterElement) ~~ 0 ifTrue:[
-            end  := self lastInGroupStartingAt:start.
-            size := end - start + 1.
-            sel  := Array new:size.
-
-            1 to:size do:[:i|
-                sel at:i put:start.
-                start := start + 1
-            ].
-            self selectionIndex:sel.
-        ] ifFalse:[
-            (self selectionIndex) size == 0 ifFalse:[
-                self selectionIndex:#()
-            ].
-        ]
-    ]
-!
-
-selectedProperty
-    "returns current selected instance; in case of multiple selection
-     or no selection nil is returned
-    "
-    |selection|
-    selection := self selectionIndex.
-
-    selection size == 1 ifTrue:[
-        propertyList size ~~ 0 ifTrue:[
-            ^ propertyList at:(selection first)
-        ]
-    ].
-    ^ nil
-!
-
-selectionIndex:aList
-    |masterIndex aSel|
-
-    painter enabled ifTrue:[aSel := aList]
-                   ifFalse:[aSel := nil].
-
-    aSel size ~~ 0 ifTrue:[masterIndex := aSel at:1]
-                  ifFalse:[masterIndex := 0].
-
-    self masterElement:masterIndex.
-    super selectionIndex:aSel
 ! !
 
 !UIPainterView::ViewProperty class methodsFor:'instance creation'!