--- a/UIPainter.st Fri Jul 18 07:24:05 1997 +0200
+++ b/UIPainter.st Sun Jul 20 12:22:43 1997 +0200
@@ -12,13 +12,21 @@
ApplicationModel subclass:#UIPainter
- instanceVariableNames:'activeHelpTool layoutTool specTool objectList selectionPanel
+ instanceVariableNames:'activeHelpTool layoutTool specTool treeView selectionPanel
tabSelection specClass specSelector specSuperclass aspects'
- classVariableNames:''
+ classVariableNames:'IconStepUp IconStepOut IconStepIn IconStepDown'
poolDictionaries:''
category:'Interface-UIPainter'
!
+SelectionInTreeView subclass:#TreeView
+ instanceVariableNames:'lastDrawnMaster cvsEventsDisabled imageMasterParent
+ imageMasterChild'
+ classVariableNames:'ImageMasterParent ImageMasterChild'
+ poolDictionaries:''
+ privateIn:UIPainter
+!
+
!UIPainter class methodsFor:'documentation'!
copyright
@@ -231,10 +239,348 @@
iconAlignTB
^ Image fromFile:'b_alignTB.xbm'
+!
+
+iconStepDown
+ IconStepDown isNil ifTrue:[
+ IconStepDown := self iconStepUp flipHorizontal
+ ].
+ ^ IconStepDown
+
+!
+
+iconStepIn
+ IconStepIn isNil ifTrue:[
+ IconStepIn := ((Image fromFile:'stepIn.xpm') rotated:90) flipHorizontal
+ ].
+ ^ IconStepIn
+
+!
+
+iconStepOut
+ IconStepOut isNil ifTrue:[
+ IconStepOut := ((Image fromFile:'stepOut.xpm') rotated:90) flipHorizontal
+ ].
+ ^ IconStepOut
+!
+
+iconStepUp
+ IconStepUp isNil ifTrue:[
+ IconStepUp := ((Image fromFile:'stepOver.xpm') rotated:90) flipHorizontal flipVertical
+ ].
+ ^ IconStepUp
+
! !
!UIPainter class methodsFor:'interface specs'!
+nameAndSelectorSpec
+ "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:#nameAndSelectorSpec
+ UIPainter new openInterface:#nameAndSelectorSpec
+ "
+
+ <resource: #canvas>
+
+ ^
+
+ #(#FullSpec
+ #'window:'
+ #(#WindowSpec
+ #'name:' 'uIPainterView'
+ #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+ #'label:' 'Painter'
+ #'bounds:' #(#Rectangle 0 0 391 170)
+ )
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#LabelSpec
+ #'name:' 'classLabel'
+ #'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5)
+ #'label:' 'class:'
+ #'adjust:' #right
+ #'resizeForLabel:' true
+ )
+ #(#LabelSpec
+ #'name:' 'superClassLabel'
+ #'layout:' #(#AlignmentOrigin 45 0.11 77 0 1 0.5)
+ #'label:' 'superclass:'
+ #'adjust:' #right
+ #'resizeForLabel:' true
+ )
+ #(#LabelSpec
+ #'name:' 'selectorLabel'
+ #'layout:' #(#AlignmentOrigin 45 0.11 105 0 1 0.5)
+ #'label:' 'selector:'
+ #'adjust:' #right
+ #'resizeForLabel:' true
+ )
+ #(#InputFieldSpec
+ #'name:' 'methodNameField'
+ #'layout:' #(#LayoutFrame 47 0.11 95 0 -5 1.0 117 0)
+ #'tabable:' true
+ #'model:' #methodNameChannel
+ )
+ #(#LabelSpec
+ #'name:' 'boxLabel'
+ #'layout:' #(#Point 5 10)
+ #'label:' 'class & selector for code:'
+ #'adjust:' #left
+ #'resizeForLabel:' true
+ )
+ #(#InputFieldSpec
+ #'name:' 'classNameField'
+ #'layout:' #(#LayoutFrame 47 0.11 39 0 -5 1.0 61 0)
+ #'tabable:' true
+ #'model:' #classNameChannel
+ )
+ #(#ComboBoxSpec
+ #'name:' 'comboBox1'
+ #'layout:' #(#LayoutFrame 47 0.11 67 0 -5 1.0 89 0)
+ #'tabable:' true
+ #'model:' #superclassNameChannel
+ #'comboList:' #superclassNameDefaults
+ )
+ #(#HorizontalPanelViewSpec
+ #'name:' 'commitPanel'
+ #'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0)
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#ActionButtonSpec
+ #'name:' 'button1'
+ #'label:' 'cancel'
+ #'tabable:' true
+ #'model:' #cancel
+ #'extent:' #(#Point 191 24)
+ )
+ #(#ActionButtonSpec
+ #'name:' 'button2'
+ #'label:' 'ok'
+ #'tabable:' true
+ #'isDefault:' true
+ #'model:' #accept
+ #'extent:' #(#Point 191 24)
+ )
+ )
+ )
+ #'horizontalLayout:' #fitSpace
+ #'verticalLayout:' #fit
+ #'horizontalSpace:' 3
+ #'verticalSpace:' 3
+ )
+ )
+ )
+ )
+
+ "Modified: 24.6.1997 / 18:50:14 / cg"
+!
+
+windowSpec
+ "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:#windowSpec
+ UIPainter new openInterface:#windowSpec
+ "
+ "UIPainter open"
+
+ <resource: #canvas>
+
+ ^
+
+ #(#FullSpec
+ #'window:'
+ #(#WindowSpec
+ #'name:' 'uIPainterView'
+ #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+ #'label:' 'Tree-View'
+ #'bounds:' #(#Rectangle 0 0 561 450)
+ )
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#MenuPanelSpec
+ #'name:' 'menuPullDown'
+ #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0)
+ #'tabable:' true
+ #'menu:' #menuPullDown
+ )
+ #(#NoteBookViewSpec
+ #'name:' 'noteBook'
+ #'layout:' #(#LayoutFrame 0 0.4 59 0.0 0 1.0 -55 1.0)
+ #'enableChannel:' #enableChannel
+ #'tabable:' true
+ #'menu:' #tabList
+ #'style:'
+ #(#FontDescription
+ #helvetica #medium
+ #roman #'10'
+ )
+ #'model:' #tabModel
+ #'tabWidget:' #Window
+ #'canvas:' #noteBookView
+ )
+ #(#HorizontalPanelViewSpec
+ #'name:' 'modifyPanel'
+ #'layout:' #(#LayoutFrame 0 0.4 -55 1.0 0 1.0 -25 1.0)
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#ActionButtonSpec
+ #'name:' 'cancelButton'
+ #'label:' 'cancel'
+ #'tabable:' true
+ #'model:' #cancel
+ #'enableChannel:' #modifiedChannel
+ #'extent:' #(#Point 164 24)
+ )
+ #(#ActionButtonSpec
+ #'name:' 'acceptButton'
+ #'label:' 'ok'
+ #'tabable:' true
+ #'model:' #accept
+ #'enableChannel:' #modifiedChannel
+ #'extent:' #(#Point 164 24)
+ )
+ )
+ )
+ #'level:' 0
+ #'horizontalLayout:' #fitSpace
+ #'verticalLayout:' #fitSpace
+ #'horizontalSpace:' 3
+ #'verticalSpace:' 3
+ )
+ #(#LabelSpec
+ #'name:' 'helpInfo'
+ #'layout:' #(#LayoutFrame 2 0.0 -25 1.0 -2 1.0 -2 1.0)
+ #'level:' -1
+ #'adjust:' #left
+ )
+ #(#ToggleSpec
+ #'name:' 'galleryLabel'
+ #'layout:' #(#LayoutFrame -162 1.0 1 0 -82 1.0 23 0)
+ #'label:' 'Gallery'
+ #'model:' #galleryShown
+ #'isTriggerOnDown:' true
+ #'showLamp:' true
+ #'lampColor:' #(#Color 100.0 100.0 0.0)
+ )
+ #(#ToggleSpec
+ #'name:' 'painterLabel'
+ #'layout:' #(#LayoutFrame -81 1.0 1 0 -1 1.0 23 0)
+ #'label:' 'Painter'
+ #'model:' #painterShown
+ #'isTriggerOnDown:' true
+ #'showLamp:' true
+ #'lampColor:' #(#Color 100.0 100.0 0.0)
+ )
+ #(#ArbitraryComponentSpec
+ #'name:' 'treeView'
+ #'layout:' #(#LayoutFrame 0 0.0 59 0 0 0.4 -25 1.0)
+ #'menu:' #menuCanvas
+ #'hasHorizontalScrollBar:' true
+ #'hasVerticalScrollBar:' true
+ #'miniScrollerHorizontal:' true
+ #'miniScrollerVertical:' true
+ #'component:' #treeView
+ #'hasBorder:' false
+ )
+ #(#HorizontalPanelViewSpec
+ #'name:' 'menuContainer'
+ #'layout:' #(#LayoutFrame 0 0.0 26 0 0 1.0 58 0)
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#MenuPanelSpec
+ #'name:' 'menuMove'
+ #'menu:' #menuMove
+ #'showSeparatingLines:' true
+ #'extent:' #(#Point 123 32)
+ )
+ #(#MenuPanelSpec
+ #'name:' 'menuAlignment'
+ #'tabable:' true
+ #'menu:' #menuAlignment
+ #'showSeparatingLines:' true
+ #'extent:' #(#Point 233 32)
+ )
+ #(#HorizontalPanelViewSpec
+ #'name:' 'panelViewButtons'
+ #'component:'
+ #(#SpecCollection
+ #'collection:'
+ #(
+ #(#ArrowButtonSpec
+ #'name:' 'moveLeft'
+ #'tabable:' true
+ #'model:' #moveSelectionLeft
+ #'isTriggerOnDown:' true
+ #'enableChannel:' #hasValidSelection
+ #'direction:' #left
+ #'extent:' #(#Point 25 24)
+ )
+ #(#ArrowButtonSpec
+ #'name:' 'moveRight'
+ #'model:' #moveSelectionRight
+ #'isTriggerOnDown:' true
+ #'enableChannel:' #hasValidSelection
+ #'direction:' #right
+ #'extent:' #(#Point 26 24)
+ )
+ #(#ArrowButtonSpec
+ #'name:' 'moveDown'
+ #'model:' #moveSelectionDown
+ #'isTriggerOnDown:' true
+ #'enableChannel:' #hasValidSelection
+ #'direction:' #down
+ #'extent:' #(#Point 26 24)
+ )
+ #(#ArrowButtonSpec
+ #'name:' 'moveUp'
+ #'model:' #moveSelectionUp
+ #'isTriggerOnDown:' true
+ #'enableChannel:' #hasValidSelection
+ #'direction:' #up
+ #'extent:' #(#Point 22 24)
+ )
+ )
+ )
+ #'level:' 1
+ #'horizontalLayout:' #spreadSpace
+ #'verticalLayout:' #fitSpace
+ #'horizontalSpace:' 4
+ #'verticalSpace:' 4
+ #'extent:' #(#Point 125 32)
+ )
+ )
+ )
+ #'horizontalLayout:' #spread
+ #'verticalLayout:' #fit
+ #'horizontalSpace:' 3
+ #'verticalSpace:' 3
+ )
+ )
+ )
+ )
+! !
+
+!UIPainter class methodsFor:'menu specs'!
+
menuAlignment
"this window spec was automatically generated by the ST/X MenuEditor"
@@ -256,7 +602,7 @@
#(#MenuItem
#'label:' 'align left'
#'value:' #alignSelectionLeft
- #'enabled:' #enableChannel
+ #'enabled:' #hasValidSelection
#'activeHelpKey:' #alignSelectionLeft
#'labelImage:'
#(#ResourceRetriever
@@ -266,7 +612,7 @@
#(#MenuItem
#'label:' 'align right'
#'value:' #alignSelectionRight
- #'enabled:' #enableChannel
+ #'enabled:' #hasValidSelection
#'activeHelpKey:' #alignSelectionRight
#'labelImage:'
#(#ResourceRetriever
@@ -276,7 +622,7 @@
#(#MenuItem
#'label:' 'align left & right'
#'value:' #alignSelectionLeftAndRight
- #'enabled:' #enableChannel
+ #'enabled:' #hasValidSelection
#'activeHelpKey:' #alignSelectionLeftAndRight
#'labelImage:'
#(#ResourceRetriever
@@ -286,7 +632,7 @@
#(#MenuItem
#'label:' 'align top'
#'value:' #alignSelectionTop
- #'enabled:' #enableChannel
+ #'enabled:' #hasValidSelection
#'activeHelpKey:' #alignSelectionTop
#'labelImage:'
#(#ResourceRetriever
@@ -296,7 +642,7 @@
#(#MenuItem
#'label:' 'align bottom'
#'value:' #alignSelectionBottom
- #'enabled:' #enableChannel
+ #'enabled:' #hasValidSelection
#'activeHelpKey:' #alignSelectionBottom
#'labelImage:'
#(#ResourceRetriever
@@ -306,7 +652,7 @@
#(#MenuItem
#'label:' 'align top & bottom'
#'value:' #alignSelectionTopAndBottom
- #'enabled:' #enableChannel
+ #'enabled:' #hasValidSelection
#'activeHelpKey:' #alignSelectionTopAndBottom
#'labelImage:'
#(#ResourceRetriever
@@ -316,7 +662,7 @@
#(#MenuItem
#'label:' 'align centered horizontal'
#'value:' #alignSelectionCenterHor
- #'enabled:' #enableChannel
+ #'enabled:' #hasValidSelection
#'activeHelpKey:' #alignSelectionCenterHor
#'labelImage:'
#(#ResourceRetriever
@@ -326,7 +672,7 @@
#(#MenuItem
#'label:' 'align centered vertical'
#'value:' #alignSelectionCenterVer
- #'enabled:' #enableChannel
+ #'enabled:' #hasValidSelection
#'activeHelpKey:' #alignSelectionCenterVer
#'labelImage:'
#(#ResourceRetriever
@@ -339,6 +685,306 @@
)
!
+menuCanvas
+ "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:UIPainter andSelector:#menuCanvas
+ (Menu new fromLiteralArrayEncoding:(UIPainter menuCanvas)) 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:' '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
+ )
+
+
+!
+
+menuMove
+ "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:UIPainter andSelector:#menuMove
+ (Menu new fromLiteralArrayEncoding:(UIPainter menuMove)) startUp
+ "
+
+ <resource: #menu>
+
+ ^
+
+ #(#Menu
+
+ #(
+ #(#MenuItem
+ #'label:' 'stepUp'
+ #'value:' #doStepUp
+ #'enabled:' #hasSingleSelection
+ #'labelImage:'
+ #(#ResourceRetriever
+ #UIPainter #iconStepUp
+ )
+ )
+ #(#MenuItem
+ #'label:' 'stepDown'
+ #'value:' #doStepDown
+ #'enabled:' #hasSingleSelection
+ #'labelImage:'
+ #(#ResourceRetriever
+ #UIPainter #iconStepDown
+ )
+ )
+ #(#MenuItem
+ #'label:' ''
+ )
+ #(#MenuItem
+ #'label:' 'stepIn'
+ #'value:' #doStepIn
+ #'enabled:' #canStepIn
+ #'labelImage:'
+ #(#ResourceRetriever
+ #UIPainter #iconStepIn
+ )
+ )
+ #(#MenuItem
+ #'label:' 'stepOut'
+ #'value:' #doStepOut
+ #'enabled:' #canStepOut
+ #'labelImage:'
+ #(#ResourceRetriever
+ #UIPainter #iconStepOut
+ )
+ )
+ ) nil
+ nil
+ )
+!
+
menuPullDown
"this window spec was automatically generated by the ST/X MenuEditor"
@@ -381,13 +1027,6 @@
#'label:' '-'
)
#(#MenuItem
- #'label:' 'raise'
- #'value:' #doRaise
- )
- #(#MenuItem
- #'label:' '='
- )
- #(#MenuItem
#'label:' 'quit'
#'value:' #closeRequest
)
@@ -528,327 +1167,28 @@
) nil
nil
)
-!
-
-nameAndSelectorSpec
- "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:#nameAndSelectorSpec
- UIPainter new openInterface:#nameAndSelectorSpec
- "
-
- <resource: #canvas>
-
- ^
-
- #(#FullSpec
- #'window:'
- #(#WindowSpec
- #'name:' 'uIPainterView'
- #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
- #'label:' 'Painter'
- #'bounds:' #(#Rectangle 0 0 391 170)
- )
- #'component:'
- #(#SpecCollection
- #'collection:'
- #(
- #(#LabelSpec
- #'name:' 'classLabel'
- #'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5)
- #'label:' 'class:'
- #'adjust:' #right
- #'resizeForLabel:' true
- )
- #(#LabelSpec
- #'name:' 'superClassLabel'
- #'layout:' #(#AlignmentOrigin 45 0.11 77 0 1 0.5)
- #'label:' 'superclass:'
- #'adjust:' #right
- #'resizeForLabel:' true
- )
- #(#LabelSpec
- #'name:' 'selectorLabel'
- #'layout:' #(#AlignmentOrigin 45 0.11 105 0 1 0.5)
- #'label:' 'selector:'
- #'adjust:' #right
- #'resizeForLabel:' true
- )
- #(#InputFieldSpec
- #'name:' 'methodNameField'
- #'layout:' #(#LayoutFrame 47 0.11 95 0 -5 1.0 117 0)
- #'tabable:' true
- #'model:' #methodNameChannel
- )
- #(#LabelSpec
- #'name:' 'boxLabel'
- #'layout:' #(#Point 5 10)
- #'label:' 'class & selector for code:'
- #'adjust:' #left
- #'resizeForLabel:' true
- )
- #(#InputFieldSpec
- #'name:' 'classNameField'
- #'layout:' #(#LayoutFrame 47 0.11 39 0 -5 1.0 61 0)
- #'tabable:' true
- #'model:' #classNameChannel
- )
- #(#ComboBoxSpec
- #'name:' 'comboBox1'
- #'layout:' #(#LayoutFrame 47 0.11 67 0 -5 1.0 89 0)
- #'tabable:' true
- #'model:' #superclassNameChannel
- #'comboList:' #superclassNameDefaults
- )
- #(#HorizontalPanelViewSpec
- #'name:' 'commitPanel'
- #'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0)
- #'component:'
- #(#SpecCollection
- #'collection:'
- #(
- #(#ActionButtonSpec
- #'name:' 'button1'
- #'label:' 'cancel'
- #'tabable:' true
- #'model:' #cancel
- #'extent:' #(#Point 191 24)
- )
- #(#ActionButtonSpec
- #'name:' 'button2'
- #'label:' 'ok'
- #'tabable:' true
- #'isDefault:' true
- #'model:' #accept
- #'extent:' #(#Point 191 24)
- )
- )
- )
- #'horizontalLayout:' #fitSpace
- #'verticalLayout:' #fit
- #'horizontalSpace:' 3
- #'verticalSpace:' 3
- )
- )
- )
- )
-
- "Modified: 24.6.1997 / 18:50:14 / cg"
+! !
+
+!UIPainter methodsFor:'accessing menu'!
+
+menuCanvas
+ ^ [ treeView canvas showMiddleButtonMenu ]
!
-windowSpec
- "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:#windowSpec
- UIPainter new openInterface:#windowSpec
- "
- "UIPainter open"
-
- <resource: #canvas>
-
- ^
-
- #(#FullSpec
- #'flags:' 0
- #'window:'
- #(#WindowSpec
- #'name:' 'uIPainterView'
- #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
- #'flags:' 0
- #'label:' 'Tree-View'
- #'bounds:' #(#Rectangle 0 0 524 456)
- )
- #'component:'
- #(#SpecCollection
- #'collection:'
- #(
- #(#MenuPanelSpec
- #'name:' 'menuPullDown'
- #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0)
- #'flags:' 0
- #'tabable:' true
- #'menu:' #menuPullDown
- )
- #(#MenuPanelSpec
- #'name:' 'menuAlignment'
- #'layout:' #(#LayoutFrame 0 0.0 29 0 233 0 54 0)
- #'flags:' 0
- #'tabable:' true
- #'menu:' #menuAlignment
- #'showSeparatingLines:' true
- )
- #(#PanelViewSpec
- #'name:' 'panelViewButtons'
- #'layout:' #(#LayoutFrame -125 1.0 25 0.0 0 1.0 57 0.0)
- #'flags:' 0
- #'component:'
- #(#SpecCollection
- #'collection:'
- #(
- #(#ActionButtonSpec
- #'name:' 'moveLeft'
- #'flags:' 0
- #'label:' ''
- #'translateLabel:' true
- #'labelChannel:' #'LABELb_moveLeft.xbm'
- #'tabable:' true
- #'defaultable:' true
- #'model:' #moveSelectionLeft
- #'isTriggerOnDown:' true
- #'enableChannel:' #enableChannel
- #'extent:' #(#Point 26 24)
- )
- #(#ActionButtonSpec
- #'name:' 'moveRight'
- #'flags:' 0
- #'label:' ''
- #'translateLabel:' true
- #'labelChannel:' #'LABELb_moveRight.xbm'
- #'tabable:' true
- #'defaultable:' true
- #'model:' #moveSelectionRight
- #'isTriggerOnDown:' true
- #'enableChannel:' #enableChannel
- #'extent:' #(#Point 26 24)
- )
- #(#ActionButtonSpec
- #'name:' 'moveUp'
- #'flags:' 0
- #'label:' ''
- #'translateLabel:' true
- #'labelChannel:' #'LABELb_moveUp.xbm'
- #'tabable:' true
- #'defaultable:' true
- #'model:' #moveSelectionUp
- #'isTriggerOnDown:' true
- #'enableChannel:' #enableChannel
- #'extent:' #(#Point 26 24)
- )
- #(#ActionButtonSpec
- #'name:' 'moveDown'
- #'flags:' 0
- #'label:' ''
- #'translateLabel:' true
- #'labelChannel:' #'LABELb_moveDown.xbm'
- #'tabable:' true
- #'defaultable:' true
- #'model:' #moveSelectionDown
- #'isTriggerOnDown:' true
- #'enableChannel:' #enableChannel
- #'extent:' #(#Point 26 24)
- )
- )
- )
- #'level:' 1
- #'horizontalLayout:' #fitSpace
- #'verticalLayout:' #fitSpace
- #'horizontalSpace:' 4
- #'verticalSpace:' 4
- )
- #(#SequenceViewSpec
- #'name:' 'objectTree'
- #'layout:' #(#LayoutFrame 0 0.0 59 0.0 0 0.35 -25 1.0)
- #'flags:' 0
- #'enableChannel:' #enableChannel
- #'tabable:' true
- #'menu:' #objectListMenu
- #'model:' #objectList
- #'hasHorizontalScrollBar:' true
- #'hasVerticalScrollBar:' true
- #'miniScrollerHorizontal:' true
- #'isMultiSelect:' true
- #'doubleClickSelector:' #doubleClick
- #'useIndex:' true
- )
- #(#NoteBookViewSpec
- #'name:' 'noteBook'
- #'layout:' #(#LayoutFrame 0 0.35 59 0.0 0 1.0 -55 1.0)
- #'flags:' 0
- #'enableChannel:' #enableChannel
- #'tabable:' true
- #'menu:' #tabList
- #'style:'
- #(#FontDescription
- #helvetica #medium
- #roman #'10'
- )
- #'model:' #tabModel
- #'tabWidget:' #Window
- #'canvas:' #noteBookView
- )
- #(#HorizontalPanelViewSpec
- #'name:' 'modifyPanel'
- #'layout:' #(#LayoutFrame 0 0.35 -55 1.0 0 1.0 -25 1.0)
- #'flags:' 0
- #'component:'
- #(#SpecCollection
- #'collection:'
- #(
- #(#ActionButtonSpec
- #'name:' 'cancelButton'
- #'flags:' 0
- #'label:' 'cancel'
- #'tabable:' true
- #'model:' #cancel
- #'enableChannel:' #modifiedChannel
- #'extent:' #(#Point 166 24)
- )
- #(#ActionButtonSpec
- #'name:' 'acceptButton'
- #'flags:' 0
- #'label:' 'ok'
- #'tabable:' true
- #'model:' #accept
- #'enableChannel:' #modifiedChannel
- #'extent:' #(#Point 166 24)
- )
- )
- )
- #'level:' 0
- #'horizontalLayout:' #fitSpace
- #'verticalLayout:' #fitSpace
- #'horizontalSpace:' 3
- #'verticalSpace:' 3
- )
- #(#LabelSpec
- #'name:' 'helpInfo'
- #'layout:' #(#LayoutFrame 2 0.0 -25 1.0 -2 1.0 -2 1.0)
- #'flags:' 0
- #'label:' ''
- #'level:' -1
- #'adjust:' #left
- )
- #(#ToggleSpec
- #'name:' 'galleryLabel'
- #'layout:' #(#LayoutFrame -162 1.0 1 0 -82 1.0 23 0)
- #'flags:' 0
- #'label:' 'Gallery'
- #'model:' #galleryShown
- #'isTriggerOnDown:' true
- #'showLamp:' true
- #'lampColor:' #(#Color 100.0 100.0 0.0)
- )
- #(#ToggleSpec
- #'name:' 'painterLabel'
- #'layout:' #(#LayoutFrame -81 1.0 1 0 -1 1.0 23 0)
- #'flags:' 0
- #'label:' 'Painter'
- #'model:' #painterShown
- #'isTriggerOnDown:' true
- #'showLamp:' true
- #'lampColor:' #(#Color 100.0 100.0 0.0)
- )
- )
- )
- )
+menuMove
+ "this window spec was automatically generated by the ST/X MenuEditor"
+
+ ^ self class menuMove
+
+
+!
+
+menuPullDown
+ "this window spec was automatically generated by the ST/X MenuEditor"
+
+ ^ self class menuPullDown
+
+
! !
!UIPainter methodsFor:'actions'!
@@ -856,8 +1196,6 @@
accept
|layout|
- objectList removeDependent:self.
-
self isLayoutToolSelected ifTrue:[
(layout := layoutTool layout) notNil ifTrue:[
layoutTool layoutType == #Extent ifTrue:[
@@ -873,7 +1211,6 @@
self painter updateFromSpec:(specTool specification).
].
self modifiedChannel value:false.
- objectList addDependent:self.
!
@@ -887,10 +1224,6 @@
]
!
-doubleClick
- objectList selectGroup
-!
-
openEditMenu
|cls aspect editor|
@@ -951,6 +1284,26 @@
!UIPainter methodsFor:'aspects'!
+canStepIn
+ |holder|
+
+ (holder := builder bindingAt:#canStepIn) isNil ifTrue:[
+ builder aspectAt:#canStepIn put:(holder := false asValue).
+ ].
+ ^ holder
+
+!
+
+canStepOut
+ |holder|
+
+ (holder := builder bindingAt:#canStepOut) isNil ifTrue:[
+ builder aspectAt:#canStepOut put:(holder := false asValue).
+ ].
+ ^ holder
+
+!
+
enableChannel
"true if modifications are allowed otherwise running test
"
@@ -968,6 +1321,26 @@
!
+hasSingleSelection
+ |holder|
+
+ (holder := builder bindingAt:#hasSingleSelection) isNil ifTrue:[
+ builder aspectAt:#hasSingleSelection put:(holder := false asValue).
+ ].
+ ^ holder
+
+!
+
+hasValidSelection
+ |holder|
+
+ (holder := builder bindingAt:#hasValidSelection) isNil ifTrue:[
+ builder aspectAt:#hasValidSelection put:(holder := false asValue).
+ ].
+ ^ holder
+
+!
+
modifiedChannel
|holder|
@@ -1008,7 +1381,16 @@
!
objectList
- ^ objectList
+ ^ nil
+"
+ |holder|
+
+ (holder := builder bindingAt:#objectList) isNil ifTrue:[
+ builder aspectAt:#objectList put:(holder := SelectionInList).
+ ].
+ ^ holder
+
+"
!
objectListMenu
@@ -1054,33 +1436,91 @@
builder aspectAt:#tabModel put:holder.
].
^ holder
+!
+
+treeView
+ ^ treeView
! !
!UIPainter methodsFor:'binding access'!
aspectFor:aKey
- "check wether aspect is assigned to a label icon
+ "aspect for a key
"
- (aKey startsWith:'LABEL') ifFalse:[
- ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
- ].
- ^ Image fromFile:(aKey copyFrom:(('LABEL' size) + 1))
+ ^ aspects at:aKey ifAbsent:[ super aspectFor:aKey ]
! !
!UIPainter methodsFor:'change & update'!
-update:something with:aParameter from:someObject
-
- (someObject == objectList and:[something ~~ #list]) ifTrue:[
- something ~~ #layout ifTrue:[
- self objectListChanged
+layoutChanged
+ self modifiedChannel value ifFalse:[
+ layoutTool update.
+ self modifiedChannel value:false
+ ]
+!
+
+treeViewChanged
+ "property or selection in the treeView changed
+ "
+ |oldSelection view slices list spec props size nameOfSpec|
+
+ props := treeView propertySelected.
+ oldSelection := tabSelection.
+ tabSelection := nil.
+
+ self hasValidSelection value:(treeView hasValidSelection).
+ self canStepIn value:(treeView canStepIn).
+ self canStepOut value:(treeView canStepOut).
+
+ props isNil ifFalse:[
+ self hasSingleSelection value:true.
+ view := props view.
+ 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
+ ].
+ (list findFirst:[:n| n = oldSelection ]) ~~ 0 ifTrue:[
+ tabSelection := oldSelection
] ifFalse:[
- self modifiedChannel value ifTrue:[
- ^ self
- ].
- layoutTool update
+ tabSelection := list first
].
- ^ self modifiedChannel value:false
+ nameOfSpec := spec class name.
+ ] ifTrue:[
+ self hasSingleSelection value:false.
+ nameOfSpec := ''
+ ].
+
+ self showHelp:nameOfSpec for:nil.
+
+ layoutTool layoutView:view.
+ specTool specification:spec.
+
+ tabSelection notNil ifTrue:[
+ self isLayoutToolSelected ifTrue:[
+ (self noteBookView subViews at:1) raise
+ ] ifFalse:[
+ specTool selection:tabSelection.
+ (self noteBookView subViews at:2) raise
+ ]
+ ].
+
+ (builder componentAt:#noteBook) setSelection:tabSelection.
+ self modifiedChannel value:false.
+!
+
+update:something with:aParameter from:someObject
+
+ someObject == treeView model ifTrue:[
+ something == #selection ifTrue:[self treeViewChanged].
+ ^ self
].
self galleryShown == someObject ifTrue:[
@@ -1115,57 +1555,6 @@
].
super doesNotUnderstand:aMessage
-!
-
-objectListChanged
- "something changed in the painter view
- "
- |oldSelection view slices list spec props size nameOfSpec|
-
- props := objectList selectedProperty.
- oldSelection := tabSelection.
- tabSelection := nil.
-
- props isNil ifFalse:[
- view := props view.
- 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
- ].
- (list findFirst:[:n| n = oldSelection ]) ~~ 0 ifTrue:[
- tabSelection := oldSelection
- ] ifFalse:[
- tabSelection := list first
- ].
- nameOfSpec := spec class name.
- ] ifTrue:[
- nameOfSpec := ''
- ].
-
- self showHelp:nameOfSpec for:nil.
-
- layoutTool layoutView:view.
- specTool specification:spec.
-
- tabSelection notNil ifTrue:[
- self isLayoutToolSelected ifTrue:[
- (self noteBookView subViews at:1) raise
- ] ifFalse:[
- specTool selection:tabSelection.
- (self noteBookView subViews at:2) raise
- ]
- ].
-
- (builder componentAt:#noteBook) setSelection:tabSelection.
- self modifiedChannel value:false.
! !
!UIPainter methodsFor:'private'!
@@ -1176,7 +1565,7 @@
!
painter
- ^ objectList painter
+ ^ treeView canvas
!
raiseUIView:aView
@@ -1265,14 +1654,14 @@
"
|anyUnsavedChanges|
- objectList painter isModified ifTrue:[
+ self painter isModified ifTrue:[
(self confirm:'quit without saving ?') ifFalse:[
^ self
]
].
- objectList removeDependent:self.
- objectList painter release.
+ treeView model removeDependent:self.
+ self painter release.
selectionPanel notNil ifTrue:[
selectionPanel masterApplication:nil.
@@ -1280,7 +1669,7 @@
].
selectionPanel := nil.
layoutTool := nil.
- objectList := nil.
+ treeView := nil.
activeHelpTool := nil.
super closeRequest.
@@ -1334,6 +1723,7 @@
ifFalse:[#windowSpec]) asValue
).
+ treeView := TreeView new.
painterView := StandardSystemView new.
painterView label:'unnamed canvas'.
painterView extent:300@300.
@@ -1341,8 +1731,9 @@
painter := UIPainterView in:painterView.
painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout.
- objectList := painter listHolder.
- objectList addDependent:self.
+ treeView := treeView canvas:painter.
+ painter treeView:treeView.
+ treeView model addDependent:self.
super openInterface.
@@ -1520,6 +1911,24 @@
"Modified: 17.6.1997 / 14:42:02 / cg"
! !
+!UIPainter methodsFor:'user interaction - move'!
+
+doStepDown
+ treeView doStepOver:1
+!
+
+doStepIn
+ treeView doStepIn
+!
+
+doStepOut
+ treeView doStepOut
+!
+
+doStepUp
+ treeView doStepOver:-1
+! !
+
!UIPainter methodsFor:'user interaction - pullDown'!
doBrowseAppClass
@@ -1549,7 +1958,7 @@
doFromClass
|className methodName cls sel accepted failed spec s painter|
- objectList painter isModified ifTrue:[
+ self painter isModified ifTrue:[
(self confirm:'edit another interface without saving your modifications ?') ifFalse:[
^ self
]
@@ -1664,7 +2073,7 @@
!
doNew
- objectList painter isModified ifTrue:[
+ self painter isModified ifTrue:[
(self confirm:'new interface without saving your modifications ?') ifFalse:[
^ self
]
@@ -1678,7 +2087,7 @@
doPickAView
|painter view cls spec|
- objectList painter isModified ifTrue:[
+ self painter isModified ifTrue:[
(self confirm:'pick another interface without saving your modifications ?') ifFalse:[
^ self
]
@@ -1705,22 +2114,6 @@
"Modified: 24.6.1997 / 19:02:57 / cg"
!
-doRaise
- |top x|
-
- top := self painter topView.
- top realized ifFalse:[
- self painterShown value:true
- ].
- top raise.
-
- top := selectionPanel window.
- top realized ifFalse:[
- self galleryShown value:true
- ].
- top raise.
-!
-
doStartApplication
|cls|
@@ -1760,6 +2153,585 @@
! !
+!UIPainter::TreeView class methodsFor:'constants'!
+
+imageMasterChild
+
+ ImageMasterChild isNil ifTrue:[
+ ImageMasterChild := Image fromFile:('xpmBitmaps/document_images/tiny_file_lock.xpm').
+ ].
+ ^ ImageMasterChild
+
+"
+ImageMasterChild := nil
+"
+
+
+!
+
+imageMasterParent
+
+ ImageMasterParent isNil ifTrue:[
+ ImageMasterParent := Image fromFile:('xpmBitmaps/document_images/tiny_yellow_dir_locked.xpm').
+ ].
+ ^ ImageMasterParent
+
+"
+ImageMasterParent := nil
+"
+
+
+! !
+
+!UIPainter::TreeView class methodsFor:'documentation'!
+
+documentation
+"
+ selection in tree view; only used by the UIPainter
+
+ [see also:]
+ SelectionInTreeView
+ SelectionInTree
+ TreeItem
+ UIPainter
+
+ [author:]
+ Claus Atzkern
+"
+
+
+! !
+
+!UIPainter::TreeView methodsFor:'accessing'!
+
+canvas
+ "returns the canvas( UIPainter )
+ "
+ ^ model root contents view
+
+
+!
+
+canvas:aCanvas
+ "install canvas( UIPainter )
+ "
+ |props|
+
+ props := UIPainterView::ViewProperty new.
+ props view:aCanvas.
+ model root:(TreeItem name:'Canvas' contents:props).
+ model root expand.
+ self enableChannel:(aCanvas enableChannel).
+
+! !
+
+!UIPainter::TreeView methodsFor:'accessing property'!
+
+propertiesDo:aOneArgBlock
+ "evaluate the argument a block on each property
+ "
+ self allItemsDo:[:anItem| aOneArgBlock value:(anItem contents)]
+
+
+!
+
+propertyDetect:aOneArgBlock
+ "evaluate the block on each property
+ "
+ self allItemsDo:[:anItem|
+ (aOneArgBlock value:(anItem contents)) ifTrue:[^ anItem contents]
+ ].
+ ^ nil
+
+!
+
+propertySelected
+ "returns current selected property or nil in case of multi selection
+ or empty selection
+ "
+ |idx|
+
+ selection size == 1 ifTrue:[
+ (idx := selection first) ~~ 1 ifTrue:[ "canvas: not yet supported"
+ ^ (listOfNodes at:idx) contents
+ ]
+ ].
+ ^ nil
+
+! !
+
+!UIPainter::TreeView methodsFor:'adding & removing'!
+
+addProperty:aProperty
+ "add a new item
+ "
+ |prnt child canvas view|
+
+ child := TreeItem name:(aProperty name) contents:aProperty.
+ view := aProperty view.
+ canvas := self canvas.
+
+ [ ((view := view superView) notNil and:[(prnt := self itemOfView:view) isNil])
+ ] whileTrue.
+
+ prnt isNil ifTrue:[
+ prnt := model root
+ ].
+ model add:child below:prnt.
+
+
+!
+
+removeAll
+ "remove all items other than canvas
+ "
+ lastDrawnMaster := nil.
+
+ self canvas subViews copy do:[:aView|
+ (aView isKindOf:InputView) ifFalse:[aView destroy]
+ ].
+ model root children:(OrderedCollection new).
+ model recomputeList.
+ self selection:nil.
+
+
+!
+
+removeView:aView
+ "remove a view
+ "
+ |item spv|
+
+ item := self itemOfView:aView.
+
+ item notNil ifTrue:[
+ spv := aView superView.
+ aView destroy.
+ spv sizeChanged:nil.
+ model remove:item
+ ]
+
+
+! !
+
+!UIPainter::TreeView methodsFor:'canvas selection'!
+
+cvsSelection:aSelection
+ "canvas changed its selection
+ "
+ |sel list rcLt|
+
+ list := OrderedCollection new.
+
+ aSelection isNil ifFalse:[
+ aSelection isCollection ifTrue:[
+ aSelection notNil ifTrue:[sel := aSelection]
+ ] ifFalse:[
+ sel := Array with:aSelection
+ ]
+ ].
+
+ sel notNil ifTrue:[
+ rcLt := false.
+
+ sel do:[:aView||item|
+ (item := self itemOfView:aView) notNil ifTrue:[
+ list add:item.
+
+ [(item := item parent) notNil] whileTrue:[
+ item hidden ifTrue:[
+ rcLt := true.
+ item expand.
+ ]
+ ]
+ ]
+ ].
+ rcLt ifTrue:[model recomputeList].
+ sel := list collect:[:anItem| listOfNodes findFirst:[:el| el == anItem]]
+ ] ifFalse:[
+ sel := list
+ ].
+ self cvsEventsDisabledDo:[ self selection:sel ].
+
+
+
+
+!
+
+cvsSelectionAdd:aView
+ "canvas adds a view to current selection
+ "
+ |parent item rcLt oldSel|
+
+ item := self itemOfView:aView.
+
+ item notNil ifTrue:[
+ parent := item.
+
+ [ (parent := parent parent) notNil ] whileTrue:[
+ parent hidden ifTrue:[
+ rcLt := true.
+ parent expand.
+ ]
+ ].
+ rcLt == true ifTrue:[model recomputeList].
+
+ oldSel := selection copy.
+ self addToSelection:(listOfNodes findFirst:[:el| el == item]).
+ self selectionChangedFrom:oldSel
+ ].
+
+
+
+!
+
+cvsSelectionRemove:aView
+ "canvas removes a view from current selection
+ "
+ |parent item rcLt oldSel|
+
+ item := self itemOfView:aView.
+
+ item notNil ifTrue:[
+ parent := item.
+
+ [ (parent := parent parent) notNil ] whileTrue:[
+ parent hidden ifTrue:[
+ rcLt := true.
+ parent expand.
+ ]
+ ].
+ rcLt == true ifTrue:[model recomputeList].
+
+ oldSel := selection copy.
+ self removeFromSelection:(listOfNodes findFirst:[:el| el == item]).
+ self selectionChangedFrom:oldSel
+ ].
+
+
+
+! !
+
+!UIPainter::TreeView methodsFor:'change & update'!
+
+layoutChanged
+ "layout of any component changed; in case of single selection, the
+ application will be informed to update its layout
+ "
+ selection size == 1 ifTrue:[
+ self application layoutChanged
+ ]
+
+
+!
+
+propertyChanged:aProperty
+ "property of view derived from argument a property changed
+ "
+ |item idx end|
+
+ item := self itemOfView:(aProperty view).
+
+ item notNil ifTrue:[
+ item contents:aProperty.
+
+ item name = aProperty name ifFalse:[
+ idx := self firstLineShown.
+
+ (end := self lastLineShown) > listOfNodes size ifTrue:[
+ end := listOfNodes size
+ ].
+ item name:aProperty name.
+
+ [idx <= end] whileTrue:[
+ (listOfNodes at:idx) == item ifTrue:[
+ self redrawLine:idx. "/ is visible; redraw line
+ end := 0
+ ] ifFalse:[
+ idx := idx + 1
+ ]
+ ]
+ ].
+
+ self selectedNode == item ifTrue:[ "/ inform application
+ self application treeViewChanged
+ ]
+ ].
+
+
+! !
+
+!UIPainter::TreeView methodsFor:'drag & drop'!
+
+canDrop:anObjectOrCollection
+ "can drop ? delegate to canvas
+ "
+ ^ self canvas canDrop:anObjectOrCollection
+!
+
+drop:anObjectOrCollection at:aPoint
+ "drop objects ? delegate to canvas
+ "
+ self canvas drop:anObjectOrCollection at:aPoint
+! !
+
+!UIPainter::TreeView methodsFor:'event processing'!
+
+cvsEventsDisabledDo:aBlock
+ "evaluate the block without raising selection changed notifications
+ to canvas
+ "
+ |restoreCvsEvents|
+
+ restoreCvsEvents := cvsEventsDisabled.
+ cvsEventsDisabled := true.
+ aBlock value.
+ cvsEventsDisabled := restoreCvsEvents.
+
+
+!
+
+cvsSetupListDo:aBlock
+ "evaluate block without handling notifications from model; after evaluation
+ the new list will be recomputed
+ "
+ model removeDependent:self.
+
+ self cvsEventsDisabledDo:[
+ self selection:nil.
+ aBlock value
+ ].
+ model addDependent:self.
+ model recomputeList.
+
+!
+
+doubleClicked
+ "disable collapse of canvas item
+ "
+ self selectedNode == model root ifFalse:[
+ super doubleClicked
+ ]
+
+
+! !
+
+!UIPainter::TreeView methodsFor:'initialization'!
+
+initialize
+ "initialization; set multiple select and model
+ "
+ super initialize.
+ self multipleSelectOk:true.
+ self model:(SelectionInTree new).
+ cvsEventsDisabled := false.
+
+
+! !
+
+!UIPainter::TreeView methodsFor:'private'!
+
+allItemsDo:aOneArgBlock
+ "evaluate the argument a block on each item other than the canvas
+ "
+ model root allChildrenDo:aOneArgBlock
+
+
+!
+
+figureFor:aNode
+ "returns image for an item; testing whether item is the first
+ entry into the selection
+ "
+ |master|
+
+ selection size == 0 ifFalse:[
+ master := listOfNodes at:(selection first).
+
+ aNode == master ifTrue:[
+ lastDrawnMaster := master.
+ aNode children size == 0 ifTrue:[
+ imageMasterChild isNil ifTrue:[
+ imageMasterChild := (self class imageMasterChild) onDevice:device.
+ ].
+ ^ imageMasterChild
+ ].
+ imageMasterParent isNil ifTrue:[
+ imageMasterParent := (self class imageMasterParent) onDevice:device.
+ ].
+ ^ imageMasterParent
+ ]
+ ].
+ ^ super figureFor:aNode
+
+
+!
+
+itemOfView:aView
+ "returns item assigned to view or nil
+ "
+ aView notNil ifTrue:[
+ self allItemsDo:[:anItem|
+ (anItem contents view == aView) ifTrue:[^ anItem]
+ ]
+ ].
+ ^ nil
+
+
+!
+
+selectNode:aNode
+ "change selection to a node
+ "
+ self selection:(listOfNodes findFirst:[:el| el == aNode])
+
+
+!
+
+selectionChangedFrom:oldSelection
+ "selection has changed. update master selection and raise notification
+ to canvas in case of enabled cvs events
+ "
+ |sel|
+
+ super selectionChangedFrom:oldSelection.
+
+ cvsEventsDisabled ifFalse:[
+ selection notNil ifTrue:[
+ sel := selection collect:[:i| (listOfNodes at:i) contents view].
+ ] ifFalse:[
+ sel := #()
+ ].
+ self canvas updateSelectionFromModel:sel.
+ ].
+
+ selection size ~~ 0 ifTrue:[
+ sel := selection first.
+
+ (listOfNodes at:sel) == lastDrawnMaster ifFalse:[
+ self redrawLine:sel
+ ]
+ ]
+
+
+! !
+
+!UIPainter::TreeView methodsFor:'queries'!
+
+canStepIn
+ "returns true if can step in
+ "
+ |item prnt|
+
+ ( (item := self selectedNode) isNil
+ or:[(prnt := item parent) isNil
+ or:[(prnt := prnt childAt:((prnt indexOfChild:item) + 1)) isNil
+ or:[prnt contents spec class supportsSubComponents not]]]
+ ) ifTrue:[
+ ^ false
+ ].
+ ^ true
+!
+
+canStepOut
+ |item prnt|
+
+ ( (item := self selectedNode) isNil
+ or:[(prnt := item parent) isNil
+ or:[prnt parent isNil]]
+ ) ifTrue:[
+ ^ false
+ ].
+ ^ true
+!
+
+hasValidSelection
+ "returns true if any selection exists other than root
+ "
+ |size|
+
+ (size := selection size) > 1 ifFalse:[
+ (size == 0 or:[self isInSelection:1]) ifTrue:[
+ ^ false
+ ]
+ ].
+ ^ true
+! !
+
+!UIPainter::TreeView methodsFor:'user interactions'!
+
+doStepIn
+ |item prnt canvas|
+
+ ( (item := self selectedNode) isNil
+ or:[(prnt := item parent) isNil
+ or:[(prnt := prnt childAt:((prnt indexOfChild:item) + 1)) isNil
+ or:[prnt contents spec class supportsSubComponents not]]]
+ ) ifFalse:[
+ canvas := self canvas.
+ canvas deleteSelection.
+ canvas setSelection:(prnt contents view) withRedraw:false.
+ canvas pasteWithLayout.
+ ]
+!
+
+doStepOut
+ |item next prnt prop spVw index canvas to|
+
+ ( (item := self selectedNode) isNil
+ or:[(prnt := item parent) isNil
+ or:[(next := prnt parent) isNil]]
+ ) ifTrue:[
+ ^ self
+ ].
+ model removeDependent:self.
+
+ canvas := self canvas.
+ canvas deleteSelection.
+ canvas setSelection:(next contents view) withRedraw:false.
+ canvas pasteWithLayout.
+
+!
+
+doStepOver:anIndex
+ "move child 'anOffset' forward or backward in list of children
+ "
+ |item idx size prnt spVw view|
+
+ ( (item := self selectedNode) isNil
+ or:[(prnt := item parent) isNil
+ or:[(size := prnt children size) < 2]]
+ ) ifFalse:[
+ idx := prnt indexOfChild:item.
+
+ model removeDependent:self.
+ model removeSelection.
+ selection := nil.
+ model addDependent:self.
+ idx := idx + anIndex.
+
+ idx < 1 ifTrue:[idx := size]
+ ifFalse:[idx > size ifTrue:[idx := 1]].
+
+ model add:item beforeIndex:idx below:prnt.
+ idx := prnt indexOfChild:item.
+ view := item contents view.
+ spVw := view superView.
+
+ "/ input view might by contained in sequence
+ ((size := self canvas findInputViewIn:spVw) ~~ 0 and:[idx >= size]) ifTrue:[
+ idx := idx + 1
+ ].
+ spVw changeSequenceOrderFor:view to:idx.
+
+ spVw specClass isLayoutContainer ifFalse:[
+ spVw subViews do:[:v| v raise ].
+ self canvas inputView raise
+ ].
+ self selectNode:item.
+ ]
+! !
+
!UIPainter class methodsFor:'documentation'!
version