DSVColumnView.st
changeset 2714 f0d55d0e204d
parent 2711 6cbf18e03573
child 2722 18c5bd340b1b
--- a/DSVColumnView.st	Fri Jun 04 15:23:10 2004 +0200
+++ b/DSVColumnView.st	Mon Jun 07 11:32:18 2004 +0200
@@ -31,7 +31,8 @@
 		dropSource columnAdaptor tabAtEndAction tabAtStartAction
 		modifiedChannel autoScroll autoScrollBlock needFitColumns
 		scrollWhenUpdating separatorOneDColor selectionForegroundColor
-		selectionBackgroundColor previousExtent selectConditionBlock'
+		selectionBackgroundColor previousExtent selectConditionBlock
+		scrollRowWise'
 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
 		DefaultHilightForegroundColor DefaultHilightBackgroundColor
 		ButtonLightColor ButtonShadowColor CheckToggleActiveImage
@@ -300,83 +301,35 @@
     ^ StopRedrawSignal
 ! !
 
-!DSVColumnView methodsFor:'AEG-Extensions'!
-
-doScrollCenterToColAt:aColNr
-    "make column at a column number visible, positioning in the center
-    "
-    |x  dX l  x1 |
-
-    (aColNr between:0 and:(self numberOfColumns)) ifFalse:[
-        ^ self
-    ].
-
-    dX := 0.
-    aColNr == 0 ifTrue:[^self].
-    x1  := self xVisibleOfColNr:aColNr.
-    x := x1 - (width / 2) asInteger.
-    x <= margin ifTrue:[
-        dX := margin - x
-    ] ifFalse:[
-        x := x1 + (width / 2) asInteger - 1.
-        l := width - margin.
-        x > l ifTrue:[dX := l - x]
-    ].
-
-    (dX == 0) ifFalse:[
-        self scrollTo: viewOrigin - (dX@0).
-    ].
-
-!
-
-scrollCenterToColAt:aColNr
-    "make column at a column number visible, positioning in the center
-    "
-"/    |x  dX l  x1 |
-    self pushEvent:#doScrollCenterToColAt: with:aColNr.
-"/    (aColNr between:0 and:(self numberOfColumns)) ifFalse:[
-"/        ^ self
-"/    ].
-"/
-"/    dX := 0.
-"/    aColNr == 0 ifTrue:[^self].
-"/    x1  := self xVisibleOfColNr:aColNr.
-"/    x := x1 - (width / 2) asInteger.
-"/    x <= margin ifTrue:[
-"/        dX := margin - x
-"/    ] ifFalse:[
-"/        x := x1 + (width / 2) asInteger - 1.
-"/        l := width - margin.
-"/        x > l ifTrue:[dX := l - x]
-"/    ].
-"/
-"/    (dX == 0) ifFalse:[
-"/        self scrollTo: viewOrigin - (dX@0).
-"/    ]
-"/
-
-! !
-
 !DSVColumnView methodsFor:'accessing'!
 
 builder
-    "get the builder (UIBuilder or nil)
-    "
+    "get the builder (UIBuilder or nil)"
+    
     ^ builder
 !
 
-builder:aBuilder
-    "set the builder (UIBuilder or nil)
-    "
+builder:aBuilder 
+    "set the builder (UIBuilder or nil)"
+    
     builder := aBuilder
 !
 
 columnView
-    "returns self
-    "
+    "returns self"
+    
     ^ self
 !
 
+heightOfContents
+    "return the height of the contents in pixels"
+    
+    preferredExtent isNil ifTrue:[
+        self preferredExtent
+    ].
+    ^ preferredExtent y
+!
+
 labelView
 
     ^labelView
@@ -392,9 +345,9 @@
                         bottomFraction:0 offset:[self preferredLabelViewHeight]).
 !
 
-level:aLevel
-    "change the level and thus the level of the labelView
-    "
+level:aLevel 
+    "change the level and thus the level of the labelView"
+    
     aLevel ~~ level ifTrue:[
         super level:aLevel.
 "/        labelView level:aLevel.
@@ -418,75 +371,65 @@
 !
 
 rowFontAscent
-    "returns the inset of a printable text in a row
-    "
+    "returns the inset of a printable text in a row"
+    
     ^ rowFontAscent
 ! !
 
 !DSVColumnView methodsFor:'accessing-actions'!
 
-action:aOneArgAction
-    "set the action block to be performed on select
-    "
+action:aOneArgAction 
+    "set the action block to be performed on select"
+    
     actionBlock := aOneArgAction
-
-
 !
 
-doubleClickAction:aOneArgAction
-    "set the action block to be performed on doubleclick
-    "
+doubleClickAction:aOneArgAction 
+    "set the action block to be performed on doubleclick"
+    
     doubleClickActionBlock := aOneArgAction
-
-
 !
 
-rowIfAbsent:aOneArgAction
+rowIfAbsent:aOneArgAction 
     "set the action block to be performed on each 'nil' entry into the
      list. The argument to the block is the index into the list. The
-     block returns the row which is put to the list
-    "
+     block returns the row which is put to the list"
+    
     rowIfAbsentBlock := aOneArgAction
-
-
 !
 
 selectConditionBlock
     "get the select-conditionBlock; this block is evaluated before 
      any selection change is performed (passing the to-be-changed row number
      index as arg).
-     The change will not be done, if the block returns false. 
-    "
+     The change will not be done, if the block returns false. "
+    
     ^ selectConditionBlock
 !
 
-selectConditionBlock:aOneArgBlockOrNil
+selectConditionBlock:aOneArgBlockOrNil 
     "set the select-conditionBlock; this block is evaluated before 
      any selection change is performed (passing the to-be-changed row number
      index as arg).
-     The change will not be done, if the block returns false. 
-    "
+     The change will not be done, if the block returns false. "
+    
     selectConditionBlock := aOneArgBlockOrNil.
 !
 
-tabAtEndAction:aNoneArgAction
+tabAtEndAction:aNoneArgAction 
     "set the action, called without any argument at end of the list entering
      tab next.
-     The default is to give the focus to the view after self in the focusSequence
-    "
+     The default is to give the focus to the view after self in the focusSequence"
+    
     tabAtEndAction := aNoneArgAction
-
-
 !
 
-tabAtStartAction:aNoneArgAction
+tabAtStartAction:aNoneArgAction 
     "set the action, called without any argument at start of the list entering
      tab previous.
-     The default is to give the focus to the view before self in the focusSequence
-    "
+     The default is to give the focus to the view before self in the focusSequence"
+    
     tabAtStartAction := aNoneArgAction
-
-
 ! !
 
 !DSVColumnView methodsFor:'accessing-behavior'!
@@ -496,25 +439,28 @@
      raised by a row is catched and the cell identified by the 'readSelector'
      is redrawn. In case of a nil readSelector, the whole raw is redrawn.
         -> row changed:'what'
-     On default the attribute is set to false (disabled).
-    "
+     By default, the attribute is set to false (disabled)."
+    
     ^ beDependentOfRows
 !
 
-beDependentOfRows:aBool
+beDependentOfRows:aBool 
     "make myself dependent of any row; in this case any change notification
      raised by a row is catched and the cell identified by the 'readSelector'
      is redrawn. In case of a nil readSelector, the whole raw is redrawn.
         -> row changed:'what'
-     On default the attribute is set to false (disabled).
-    "
+     By default, the attribute is set to false (disabled)."
+    
     aBool ~~ beDependentOfRows ifTrue:[
         beDependentOfRows := aBool.
-
         list size ~~ 0 ifTrue:[
-            list do:[:aRow| aRow notNil ifTrue:[
-                beDependentOfRows ifTrue:[aRow addDependent:self]
-                                 ifFalse:[aRow removeDependent:self]
+            list do:[:aRow | 
+                aRow notNil ifTrue:[
+                    beDependentOfRows ifTrue:[
+                        aRow addDependent:self
+                    ] ifFalse:[
+                        aRow removeDependent:self
+                    ]
                 ]
             ]
         ]
@@ -531,14 +477,14 @@
 !
 
 multipleSelectOk
-    "allow/disallow multiple row selections; the default is false
-    "
+    "allow/disallow multiple row selections; the default is false"
+    
     ^ multipleSelectOk
 !
 
-multipleSelectOk:aState
-    "allow/disallow multiple row selections; the default is false
-    "
+multipleSelectOk:aState 
+    "allow/disallow multiple row selections; the default is false"
+    
     aState == multipleSelectOk ifFalse:[
         multipleSelectOk := aState.
         self deselect
@@ -582,62 +528,56 @@
 !
 
 selectRowOnDefault
-    "in case of selecting a none selectable cell, the row is selected
-    "
+    "in case of selecting a none selectable cell, the row is selected"
+    
     ^ selectRowOnDefault
 !
 
-selectRowOnDefault:aBool
-    "in case of selecting a none selectable cell, the row is selected
-    "
+selectRowOnDefault:aBool 
+    "in case of selecting a none selectable cell, the row is selected"
+    
     selectRowOnDefault := aBool
 !
 
 tabIntern
-    "returns true if tabing is supported in the widget
-    "
+    "returns true if tabing is supported in the widget"
+    
     ^ tabIntern
 !
 
-tabIntern:aBool
-    "returns true if tabing is supported in the widget
-    "
+tabIntern:aBool 
+    "returns true if tabing is supported in the widget"
+    
     tabIntern := aBool ? true
 !
 
 useIndex
     "specify, if the selected components value or its index in the
-     list should be sent to the model. The default is its index.
-    "
+     list should be sent to the model. The default is its index."
+    
     ^ useIndex
-
-
 !
 
-useIndex:aBool
+useIndex:aBool 
     "specify, if the selected components value or its index in the
-     list should be sent to the model. The default is its index.
-    "
+     list should be sent to the model. The default is its index."
+    
     useIndex := aBool
-
 ! !
 
 !DSVColumnView methodsFor:'accessing-colors'!
 
 backgroundColor
-    "get the background color of the rows
-    "
+    "get the background color of the rows"
+    
     ^ bgColor
-
-
 !
 
-backgroundColor:aColor
-    "set the background color of the rows
-    "
+backgroundColor:aColor 
+    "set the background color of the rows"
+    
     bgColor ~~ aColor ifTrue:[
         super viewBackground:bgColor.
-
         self realized ifTrue:[
             bgColor := aColor onDevice:device.
             self invalidate
@@ -648,15 +588,14 @@
 !
 
 foregroundColor
-    "return the foreground color of the rows
-    "
+    "return the foreground color of the rows"
+    
     ^ fgColor
-
 !
 
-foregroundColor:aColor
-    "set the foreground color of the rows
-    "
+foregroundColor:aColor 
+    "set the foreground color of the rows"
+    
     fgColor ~~ aColor ifTrue:[
         self realized ifTrue:[
             fgColor := aColor onDevice:device.
@@ -665,51 +604,49 @@
             fgColor := aColor
         ]
     ]
-
 !
 
 selectionBackgroundColor
-    "returns the background color of a selected row
-    "
+    "returns the background color of a selected row"
+    
     ^ selectionBackgroundColor
 !
 
 selectionForegroundColor
-    "returns the foreground color of a selected row
-    "
+    "returns the foreground color of a selected row"
+    
     ^ selectionForegroundColor
 !
 
 separatorDarkColor
-    "returns the dark color used for drawing a shadowed separator (3D)
-    "
+    "returns the dark color used for drawing a shadowed separator (3D)"
+    
     ^ shadowColor
-
-
 !
 
 separatorLightColor
-    "returns the light color used for drawing a shadowed separator (3D)
-    "
+    "returns the light color used for drawing a shadowed separator (3D)"
+    
     ^ lightColor
-
-
 !
 
 separatorOneDColor
-    "returns the color used for drawing a oneD separator
-    "
-    separatorOneDColor isNil ifTrue:[^ fgColor].
+    "returns the color used for drawing a oneD separator"
+    
+    separatorOneDColor isNil ifTrue:[
+        ^ fgColor
+    ].
     ^ separatorOneDColor
 !
 
-separatorOneDColor:aColorOrNil
+separatorOneDColor:aColorOrNil 
     "set the color used for drawing a oneD separator; if the color
-     is nil, the current forgroundColor is used
-    "
-    separatorOneDColor = aColorOrNil ifTrue:[^ self].
+     is nil, the current forgroundColor is used"
+    
+    separatorOneDColor = aColorOrNil ifTrue:[
+        ^ self
+    ].
     separatorOneDColor := aColorOrNil.
-
     self realized ifTrue:[
         separatorOneDColor notNil ifTrue:[
             separatorOneDColor := separatorOneDColor onDevice:device.
@@ -720,64 +657,61 @@
 
 !DSVColumnView methodsFor:'accessing-columns'!
 
-columnAt:anIndex
-    "returns the column at an index
-    "
+columnAt:anIndex 
+    "returns the column at an index"
+    
     ^ columnDescriptors at:anIndex ifAbsent:nil
 !
 
 columnDescriptors
-    "returns list of column descriptors
-    "
-    ^ columnDescriptors collect:[:aCol| aCol description ]
+    "returns list of column descriptors"
+    
+    ^ columnDescriptors collect:[:aCol | aCol description ]
 !
 
-columnDescriptors:aColumnDescriptionList
-    "set the columnDescriptors; scroll to top and deselect
-    "
-    | delta|
+columnDescriptors:aColumnDescriptionList 
+    "set the columnDescriptors; scroll to top and deselect"
+    
+    |delta|
 
     self deselect.
-
-    (viewOrigin x ~~ 0 or:[viewOrigin y ~~ 0]) ifTrue:[
+    (viewOrigin x ~~ 0 or:[ viewOrigin y ~~ 0 ]) ifTrue:[
         delta := viewOrigin negated.
-        viewOrigin := 0@0.
+        viewOrigin := 0 @ 0.
         self originChanged:delta
     ].
     self setColumnDescriptors:aColumnDescriptionList
 !
 
 dataSetColumns
-    "returns the list of DataSetColumns; each column reprasents a DataSetColumnSpec
-    "
+    "returns the list of DataSetColumns; each column represents a DataSetColumnSpec"
+    
     ^ columnDescriptors
 !
 
 firstColumn
-    "returns the first column
-    "
+    "returns the first column"
+    
     ^ columnDescriptors at:1
-
 !
 
 lastColumn
-    "returns the last column
-    "
+    "returns the last column"
+    
     ^ columnDescriptors last
-
 !
 
 setColumnDescriptors:aColumnDescriptionList
-    "set the columnDescriptors; dont deselect and do not scroll to top
-    "
+    "set the columnDescriptors; dont deselect and do not scroll to top"
     |cid|
 
     cid := 0.
     columnDescriptors := aColumnDescriptionList ? #().
 
     columnDescriptors := columnDescriptors collect:[:el||dsc lbl|
-        dsc := el isSequenceable ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:el]
-                                ifFalse:[el].
+        dsc := el isSequenceable 
+                    ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:el]
+                    ifFalse:[el].
         cid := cid + 1.
         lbl := DataSetLabel new description:dsc builder:builder on:labelView.
         DataSetColumn new on:self description:dsc columnNumber:cid label:lbl
@@ -798,20 +732,20 @@
 !
 
 checkToggleExtent
-    "returns the extent of a checkToggle
-    "
+    "returns the extent of a checkToggle"
+    
     ^ checkToggleExtent
 !
 
 checkToggleForm
-    "returns the form of a checkToggle
-    "
+    "returns the form of a checkToggle"
+    
     ^ checkToggleForm
 !
 
 checkToggleLevel
-    "returns the level of a checkToggle button
-    "
+    "returns the level of a checkToggle button"
+    
     ^ checkToggleLevel
 !
 
@@ -820,33 +754,33 @@
 !
 
 comboButtonExtent
-    "returns the extent of a comboList or -Box
-    "
+    "returns the extent of a comboList or -Box"
+    
     ^ comboButtonExtent
 !
 
 comboButtonForm
-    "returns the form of a comboList or -Box
-    "
+    "returns the form of a comboList or -Box"
+    
     ^ comboButtonForm
 !
 
 comboButtonLevel
-    "returns the level of a comboList or -Box button
-    "
+    "returns the level of a comboList or -Box button"
+    
     ^ comboButtonLevel
 !
 
 rowSelectorExtent
-    "returns the bitmap of a selected row
-    "
+    "returns the bitmap of a selected row"
+    
     ^ rowSelectorForm extent
 !
 
 rowSelectorForm
     "returns the (arrow-) image shown for a selected row.
-     (te arrow shown in the first column)
-    "
+     (the arrow shown in the first column)"
+    
     ^ rowSelectorForm
 ! !
 
@@ -854,9 +788,11 @@
 
 columnAdaptor
     "return the value of the instance variable 'columnAdaptor' (automatically generated)"
-
-    columnAdaptor isValueModel ifTrue:[^ columnAdaptor value].
-  ^ columnAdaptor
+    
+    columnAdaptor isValueModel ifTrue:[
+        ^ columnAdaptor value
+    ].
+    ^ columnAdaptor
 !
 
 columnAdaptor:something
@@ -871,36 +807,32 @@
 !
 
 columnHolder
-    "get the valueHolder, which keeps the list of column descriptions
-    "
+    "get the valueHolder, which keeps the list of column descriptions"
+    
     ^ columnHolder
-
 !
 
-columnHolder:aValueHolder
-    "set the valueHolder, which keeps the list of column descriptions
-    "
+columnHolder:aValueHolder 
+    "set the valueHolder, which keeps the list of column descriptions"
+    
     |columns|
 
     columnHolder notNil ifTrue:[
         columnHolder removeDependent:self
     ].
-
     (columnHolder := aValueHolder) notNil ifTrue:[
         columnHolder addDependent:self.
         columns := columnHolder value.
-
         columns notNil ifTrue:[
             self columnDescriptors:columns
         ]
     ].
-
 !
 
-listAt:index put:newElement
+listAt:index put:newElement 
     "kludge callback, when an element hs to be replaced
-     due to a col-adaptor returning a new row element
-    "
+     due to a col-adaptor returning a new row element"
+    
     |list|
 
     (list := listHolder value) notNil ifTrue:[
@@ -909,30 +841,28 @@
 !
 
 listHolder
-    "get the valueHolder which holds the list of rows
-    "
+    "get the valueHolder which holds the list of rows"
+    
     ^ listHolder
 !
 
-listHolder:aListHolder
-    "set the valueHolder which holds the list of rows
-    "
+listHolder:aListHolder 
+    "set the valueHolder which holds the list of rows"
+    
     listHolder ~~ aListHolder ifTrue:[
         listHolder notNil ifTrue:[
             listHolder removeDependent:self
         ].
-
         (listHolder := aListHolder) notNil ifTrue:[
             listHolder addDependent:self
         ]
     ].
     self pushEvent:#list: with:(listHolder value).
-
 !
 
-model:aModel
-    "set the valueHolder which holds the selection and maybe the list of rows
-    "
+model:aModel 
+    "set the valueHolder which holds the selection and maybe the list of rows"
+    
     model notNil ifTrue:[
         model removeDependent:self.
         (model respondsTo:#list) ifTrue:[
@@ -941,22 +871,19 @@
             ]
         ]
     ].
-
     (model := aModel) notNil ifTrue:[
         model addDependent:self.
-
         (aModel respondsTo:#list) ifTrue:[
             self listHolder:model list
         ]
     ]
-
 ! !
 
 !DSVColumnView methodsFor:'accessing-rows'!
 
 at:aRowNr
-    "return the row at an index, aRowNr
-    "
+    "return the row at an index, aRowNr"
+
     |row|
 
     (row := list at:aRowNr) isNil ifTrue:[
@@ -975,62 +902,63 @@
     "Modified: / 31.7.1998 / 01:07:46 / cg"
 !
 
-at:aRowNr ifAbsent:exceptionBlock
+at:aRowNr ifAbsent:exceptionBlock 
     "return the row at a aRowNr. If the index is invalid, return the
-     result of evaluating the exceptionblock
-    "
+     result of evaluating the exceptionblock"
+    
     (aRowNr between:1 and:list size) ifTrue:[
         ^ self at:aRowNr
     ].
     ^ exceptionBlock value
 !
 
-at:aRowNr put:aRow
-    "change the row at an index. The added row is returned
-    "
+at:aRowNr put:aRow 
+    "change the row at an index. The added row is returned"
+    
     lockRowIndex ~~ aRowNr ifTrue:[
-        (aRowNr <= list size and:[(list at:aRowNr) == aRow]) ifTrue:[
+        (aRowNr <= list size and:[ (list at:aRowNr) == aRow ]) ifTrue:[
             self invalidateRowAt:aRowNr
         ] ifFalse:[
-            self replaceFrom:aRowNr to:aRowNr with:(Array with:aRow) startingAt:1.
+            self 
+                replaceFrom:aRowNr
+                to:aRowNr
+                with:(Array with:aRow)
+                startingAt:1.
         ]
     ].
-  ^ aRow
+    ^ aRow
 !
 
 first
-    "return the first row
-    "
+    "return the first row"
+    
     ^ self at:1
 !
 
-identityIndexOfRow:aRow
-    "returns index of a row or 0
-    "
-    (list size ~~ 0 and:[aRow notNil]) ifTrue:[
+identityIndexOfRow:aRow 
+    "returns index of a row or 0"
+    
+    (list size ~~ 0 and:[ aRow notNil ]) ifTrue:[
         ^ list identityIndexOf:aRow
     ].
     ^ 0
 !
 
 last
-    "return the last row
-    "
+    "return the last row"
+    
     ^ self at:(list size)
 !
 
 list
-    "get the list of rows
-    "
+    "get the list of rows"
+    
     ^ list
-
-
-
 !
 
 list:aList
-    "set the list of rows
-    "
+    "set the list of rows"
+
     |makeDependent selectionHasChanged|
 
     "/ remove selection without redraw
@@ -1079,13 +1007,15 @@
 
 !DSVColumnView methodsFor:'accessing-visibility'!
 
-font:aFont
-    "set the font for all shown rows.
-    "
-    (aFont notNil and:[aFont ~~ font]) ifTrue:[
+font:aFont 
+    "set the font for all shown rows."
+    
+    (aFont notNil and:[ aFont ~~ font ]) ifTrue:[
         super font:(aFont onDevice:device).
         realized ifTrue:[
-            columnDescriptors do:[:aCol| aCol invalidate ].
+            columnDescriptors do:[:aCol | 
+                aCol invalidate
+            ].
             self preferredExtentChanged.
             self invalidate.
             self contentsChanged
@@ -1097,41 +1027,39 @@
 !
 
 has3Dseparators
-    "returns true if shown in 3D mode
-    "
+    "returns true if shown in 3D mode"
+    
     ^ separatorSize ~~ 1
 !
 
-has3Dseparators:aBool
-    "enable or disable 3D mode
-    "
+has3Dseparators:aBool 
+    "enable or disable 3D mode"
+    
     |newSepSize|
 
-    newSepSize := aBool ifTrue:[2] ifFalse:[1].
-
+    newSepSize := aBool ifTrue:2 ifFalse:1.
     newSepSize ~~ separatorSize ifTrue:[
         separatorSize := newSepSize.
-
         realized ifTrue:[
-            columnDescriptors do:[:aCol| aCol invalidate ].
+            columnDescriptors do:[:aCol | 
+                aCol invalidate
+            ].
             self preferredExtentChanged.
             self invalidate.
             self contentsChanged
         ]
     ]
-
-
 !
 
 horizontalSpacing
-    "horizontal spacing used by columns
-    "
+    "horizontal spacing used by columns"
+    
     ^ horizontalSpacing
 !
 
-horizontalSpacing:aNumber
-    "horizontal spacing used by columns
-    "
+horizontalSpacing:aNumber 
+    "horizontal spacing used by columns"
+    
     horizontalSpacing ~~ aNumber ifTrue:[
         horizontalSpacing := aNumber.
         self preferredExtentChanged.
@@ -1139,27 +1067,26 @@
 !
 
 showLabels
-    "control the labels view to be visible or unvisible
-    "
+    "control the labels view to be visible or unvisible"
+    
     ^ labelView isVisible
-
 !
 
-showLabels:aState
-    "control the labels view to be visible or unvisible
-    "
+showLabels:aState 
+    "control the labels view to be visible or unvisible"
+    
     labelView isVisible:aState
 !
 
 verticalSpacing
-    "vertical spacing used by columns
-    "
+    "vertical spacing used by columns"
+    
     ^ verticalSpacing
 !
 
-verticalSpacing:aNumber
-    "vertical spacing used by columns
-    "
+verticalSpacing:aNumber 
+    "vertical spacing used by columns"
+    
     verticalSpacing ~~ aNumber ifTrue:[
         verticalSpacing := aNumber.
         self preferredExtentChanged.
@@ -1168,30 +1095,30 @@
 
 !DSVColumnView methodsFor:'adding & removing rows'!
 
-add:aRow
-    "insert row at end
-    "
+add:aRow 
+    "insert row at end"
+    
     ^ self add:aRow beforeIndex:(1 + list size)
 !
 
-add:aRow afterIndex:aRowNr
+add:aRow afterIndex:aRowNr 
     "add a new row after slot aRowNr and redisplay; returns nil in case
-     of an invalid index or the row
-    "
+     of an invalid index or the row"
+    
     ^ self add:aRow beforeIndex:(aRowNr + 1)
 !
 
-add:aRow beforeIndex:aRowNr
+add:aRow beforeIndex:aRowNr 
     "add a new row before slot aRowNr and redisplay; returns nil in case
-     of an invalid index or the row
-    "
+     of an invalid index or the row"
+    
     self addAll:(Array with:aRow) beforeIndex:aRowNr.
     ^ aRow.
 !
 
 addAll:aList beforeIndex:start
-    "add a collection of rows before slot start and redisplay
-    "
+    "add a collection of rows before slot start and redisplay"
+
     |y0 y1 yD h dH size noSel|
 
     (size := aList size) == 0 ifTrue:[
@@ -1268,19 +1195,18 @@
     self contentsChanged.
 !
 
-addFirst:aRow
-    "insert a row at start
-    "
+addFirst:aRow 
+    "insert a row at start"
+    
     ^ self add:aRow beforeIndex:1
 !
 
-remove:aRow
-    "remove a row
-    "
+remove:aRow 
+    "remove a row"
+    
     |idx|
 
     idx := list identityIndexOf:aRow.
-
     idx ~~ 0 ifTrue:[
         self removeFrom:idx to:idx.
     ].
@@ -1288,14 +1214,14 @@
 !
 
 removeFirst
-    "remove first row; returns the removed row
-    "
+    "remove first row; returns the removed row"
+    
     ^ self removeIndex:1
 !
 
 removeFrom:startIndex to:stopIndex
-    "remove rows from start to stop
-    "
+    "remove rows from start to stop"
+
     |coll noRedraw
      noSel "{ Class: SmallInteger }"
      size  "{ Class: SmallInteger }"
@@ -1407,27 +1333,27 @@
     self contentsChanged.
 !
 
-removeIndex:aRowNr
-    "remove row at an index; returns the removed row
-    "
+removeIndex:aRowNr 
+    "remove row at an index; returns the removed row"
+    
     |row|
 
     row := list at:aRowNr ifAbsent:nil.
     self removeFrom:aRowNr to:aRowNr.
-  ^ row
+    ^ row
 !
 
 removeLast
-    "remove last row; the row is returned
-    "
+    "remove last row; the row is returned"
+    
     ^ self removeIndex:(list size)
 !
 
 replaceFrom:start to:stop with:aCollection startingAt:repStart
     "replace elements in the receiver between index start and stop,
      with elements  taken from replacementCollection starting at repStart.
-     Return the receiver.
-    "
+     Return the receiver."
+
     |inSelList listSize repStop run|
 
     inSelList := OrderedCollection new.
@@ -1484,28 +1410,27 @@
     preferredExtent notNil ifTrue:[self fitColumns]
 !
 
-update:what with:aPara from:chgObj
-    "one of my rows/cells changed its value
-    "
+update:what with:aPara from:chgObj 
+    "one of my rows/cells changed its value"
+    
     |row listHoldersList arg1 arg2 col|
 
     chgObj == columnHolder ifTrue:[
         ^ self columnDescriptors:(columnHolder value)
     ].
-
     chgObj == columnAdaptor ifTrue:[
         col := columnAdaptor value.
-        columnDescriptors do:[:aCol| aCol columnAdaptor:col].
-      ^ self invalidate
+        columnDescriptors do:[:aCol | 
+            aCol columnAdaptor:col
+        ].
+        ^ self invalidate
     ].
-
     chgObj == editValue ifTrue:[
         self updateColumnFromEditValue.
         ^ self
     ].
-
     chgObj == model ifTrue:[
-        (what == #selectionIndex or:[what == #selection]) ifTrue:[
+        (what == #selectionIndex or:[ what == #selection ]) ifTrue:[
             ^ self selectRowIndex:(model selectionIndex copy)
         ].
         what == #list ifTrue:[
@@ -1520,10 +1445,8 @@
         ].
         ^ self
     ].
-
     chgObj == listHolder ifTrue:[
         listHoldersList := listHolder value.
-
         what == #value ifTrue:[
             ^ self list:listHoldersList
         ].
@@ -1533,41 +1456,46 @@
         ] ifFalse:[
             arg1 := arg2 := aPara
         ].
-
         what == #at: ifTrue:[
             ^ self at:arg1 put:(listHoldersList at:arg1)
         ].
-
         what == #insert: ifTrue:[
             ^ self add:(listHoldersList at:arg1) beforeIndex:arg1
         ].
-        
         what == #remove: ifTrue:[
             ^ self removeFrom:arg1 to:arg1
         ].
         what == #removeFrom: ifTrue:[
-            listHoldersList size == 0 ifTrue:[self list:nil]
-                          ifFalse:[self removeFrom:arg1 to:arg2].
+            listHoldersList size == 0 ifTrue:[
+                self list:nil
+            ] ifFalse:[
+                self removeFrom:arg1 to:arg2
+            ].
             ^ self
         ].
-
         what == #insertCollection: ifTrue:[
             arg2 ~~ 0 ifTrue:[
-                self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1)) beforeIndex:arg1
+                self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1))
+                    beforeIndex:arg1
             ].
             ^ self.
         ].
         what == #replace: ifTrue:[
-            self replaceFrom:arg1 to:arg2 with:listHoldersList startingAt:arg1.
+            self 
+                replaceFrom:arg1
+                to:arg2
+                with:listHoldersList
+                startingAt:arg1.
             ^ self
         ].
         self list:listHoldersList.
         ^ self
     ].
     arg1 := aPara ? what.
-    row := (what isNumber) ifTrue:[what] ifFalse:[chgObj].
+    row := (what isNumber) ifTrue:[
+                what
+            ] ifFalse:[ chgObj ].
     self invalidateVisibleRow:row readSelector:arg1.
-
     editView notNil ifTrue:[
         (self isInSelection:(self identityIndexOfRow:row)) ifTrue:[
             self updateEditorFromChangedRow
@@ -1607,40 +1535,36 @@
 !
 
 updateEditorFromChangedRow
-    "/ self reopenEditor
-
     |rowsValue rowNr|
 
     (rowNr := selectedRowIndex) isNumber ifFalse:[
         rowNr := rowNr first.
     ].
-
     rowsValue := (self columnAt:selectedColIndex) at:rowNr.
-
-    (editValue notNil and:[editValue value ~= rowsValue]) ifTrue:[
-        editValue value:rowsValue withoutNotifying:self. 
-        editView withAllSubViewsDo:[:v |
-            v isInputField ifTrue:[
-                v flash. 
+    (editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[
+        editValue value:rowsValue withoutNotifying:self.
+        editView 
+            withAllSubViewsDo:[:v | 
+                v isInputField ifTrue:[
+                    v flash.
+                ]
             ]
-        ]
     ].
 ! !
 
 !DSVColumnView methodsFor:'drag & drop'!
 
 canDrag
-    "returns true if dragging is enabled
-    "
+    "returns true if dragging is enabled"
+    
     ^ dropSource notNil
-
 !
 
 dragAutoScroll:aContext
     "called by the DragAndDropManager to scroll during a drag/drop operation
      if necassery (decided by the widget itself); If a scroll is done return
-     true otherwise false (used to restore the background)
-    "
+     true otherwise false (used to restore the background)"
+
     |yInset absLnNr y|
 
     y := aContext targetPoint y.
@@ -1665,33 +1589,27 @@
 !
 
 dropSource
-    "returns the dropSource or nil
-    "
+    "returns the dropSource or nil"
+    
     ^ dropSource
-
-
 !
 
-dropSource:aDropSourceOrNil
-    "set the dropSource or nil
-    "
+dropSource:aDropSourceOrNil 
+    "set the dropSource or nil"
+    
     dropSource := aDropSourceOrNil.
-
-
 !
 
 dropTarget
-    "returns the dropTarget or nil
-    "
+    "returns the dropTarget or nil"
+    
     ^ dropTarget
-
 !
 
-dropTarget:aDropTragetOrNil
-    "set the dropTarget or nil
-    "
+dropTarget:aDropTragetOrNil 
+    "set the dropTarget or nil"
+    
     dropTarget := aDropTragetOrNil.
-
 !
 
 startDragAt:aPoint
@@ -1704,14 +1622,13 @@
 
 !DSVColumnView methodsFor:'drawing'!
 
-colorOnDevice:aColor
-    "returns color on device
-    "
+colorOnDevice:aColor 
+    "returns color on device"
+    
     |col|
 
     aColor = Color noColor ifFalse:[
         col := colorMap at:aColor ifAbsent:nil.
-
         col isNil ifTrue:[
             colorMap at:aColor put:(col := aColor onDevice:device)
         ].
@@ -1721,33 +1638,31 @@
 !
 
 forceRedraw
-    "a redraw forced by any other component
-    "
+    "a redraw forced by any other component"
+    
     shown ifTrue:[
         self invalidate
     ]
 !
 
 invalidate
-    "recompute extent before repair range
-    "
-    self  recomputeHeightOfContents.
+    "recompute extent before repair range"
+    
+    self recomputeHeightOfContents.
     super invalidate.
-
-
 !
 
-invalidateRowAt:aRowNr
-    "redraw total row at an index
-    "
+invalidateRowAt:aRowNr 
+    "redraw total row at an index"
+    
     self invalidateRowAt:aRowNr colAt:0
 !
 
 invalidateRowAt:aRowNr colAt:aColNr
     "redraw either a single column in a row,
      or the complete visible row (in case of aColNr == 0).
-     If the row/column is hidden, no redraw is done
-    "
+     If the row/column is hidden, no redraw is done"
+
     |x "{ Class:SmallInteger }"
      y "{ Class:SmallInteger }"
      h "{ Class:SmallInteger }"
@@ -1800,8 +1715,8 @@
 !
 
 invalidateRowsFrom:aStart to:aStop
-    "redraw visible row from start to stop
-    "
+    "redraw visible row from start to stop"
+
     |size start stop y0 y1|
 
     shown ifTrue:[
@@ -1820,17 +1735,17 @@
     ]
 !
 
-invalidateVisibleRow:aRow
-    "redraw row if visible
-    "
+invalidateVisibleRow:aRow 
+    "redraw row if visible"
+    
     self invalidateVisibleRow:aRow colAt:0
 !
 
 invalidateVisibleRow:aRow colAt:aColNr
     "redraw either a single column in a row,
      or the complete visible row (in case of aColNr == 0).
-     If the row/column is hidden, no redraw is done
-    "
+     If the row/column is hidden, no redraw is done"
+
     |start "{ Class:SmallInteger }"
      stop  "{ Class:SmallInteger }"
     |
@@ -1854,8 +1769,8 @@
 
 invalidateVisibleRow:aRow readSelector:aSelector
     "redraw a column identified by its read selector; if no column with
-     the specified read selector is detected, the whole line is drawn.
-    "
+     the specified read selector is detected, the whole line is drawn."
+
     |row idx|
 
     aSelector isNil ifTrue:[
@@ -1872,8 +1787,8 @@
 !
 
 redrawX:x y:y width:w height:h
-    "redraw part of myself immediately, given logical coordinates 
-    "
+    "redraw part of myself immediately, given logical coordinates "
+
     |c0 savClip stopRedraw
      start "{ Class:SmallInteger }"
      stop  "{ Class:SmallInteger }"
@@ -1975,8 +1890,8 @@
 
 displayLabel:aLabel x:xLeft y:yTop
     "display the label at x y; test whether the height of the label matches to the current
-     rowHeight. If not, an exception is raised and the rowHeight is recomputed
-    "
+     rowHeight. If not, an exception is raised and the rowHeight is recomputed"
+
     |y h |
 
     aLabel notNil ifTrue:[
@@ -2003,8 +1918,8 @@
 !
 
 drawCheckToggleAtX:xTop y:yTop w:rowWidth state:aState
-    "draw a check toggle button
-    "
+    "draw a check toggle button"
+
     |e form
      y "{ Class:SmallInteger }"
      x "{ Class:SmallInteger }"
@@ -2037,8 +1952,8 @@
 !
 
 drawComboButtonAtX:xTop y:yTop w:rowWidth
-    "draw a combo button
-    "
+    "draw a combo button"
+
     |e
      x "{ Class:SmallInteger }"
      y "{ Class:SmallInteger }"
@@ -2056,42 +1971,40 @@
     self drawEdgesAtX:x   y:y width:w height:h level:comboButtonLevel on:self.
     self paint:fgColor on:bgColor.
     self displayForm:comboButtonForm x:(x + e x) y:(y + e y)
-
 !
 
-drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC
-    "draw edges for a cell or label
-    "
-    aGC  drawEdgesForX:x
-                     y:y 
-                 width:w
-                height:h
-                 level:aLevel 
-                shadow:buttonShadowColor 
-                 light:buttonLightColor
-            halfShadow:buttonHalfShadowColor 
-             halfLight:buttonHalfLightColor
-                 style:ButtonEdgeStyle.
-
+drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC 
+    "draw edges for a cell or label"
+    
+    aGC 
+        drawEdgesForX:x
+        y:y
+        width:w
+        height:h
+        level:aLevel
+        shadow:buttonShadowColor
+        light:buttonLightColor
+        halfShadow:buttonHalfShadowColor
+        halfLight:buttonHalfLightColor
+        style:ButtonEdgeStyle.
 ! !
 
 !DSVColumnView methodsFor:'enumerating columns'!
 
-columnsDo:aOneArgBlock
-    "evaluate the argument, aOneArgBlock for every column
-    "
+columnsDo:aOneArgBlock 
+    "evaluate the argument, aOneArgBlock for every column"
+    
     columnDescriptors do:aOneArgBlock
-
-
 !
 
-columnsFrom:start to:stop do:aOneArgBlock
+columnsFrom:start to:stop do:aOneArgBlock 
     "evaluate the argument, aOneArgBlock for the columns with index start to
-     stop in the collection of column descriptors
-    "
-    columnDescriptors from:start to:stop do:aOneArgBlock
-
-
+     stop in the collection of column descriptors"
+    
+    columnDescriptors 
+        from:start
+        to:stop
+        do:aOneArgBlock
 ! !
 
 !DSVColumnView methodsFor:'event handling'!
@@ -2147,14 +2060,14 @@
     ].
 !
 
-buttonMotion:buttonMask x:x y:y
-    "mouse-move while button was pressed - handle multiple selection changes
-    "
-    self isEnabled ifFalse:[^ self].
-
+buttonMotion:buttonMask x:x y:y 
+    "mouse-move while button was pressed - handle multiple selection changes"
+    
+    self isEnabled ifFalse:[
+        ^ self
+    ].
     buttonMotionAction notNil ifTrue:[
-        buttonMotionAction value:(x@y).
-
+        buttonMotionAction value:(x @ y).
         buttonMotionAction notNil ifTrue:[
             autoScroll ifTrue:[
                 "/ if moved outside of view, start autoscroll
@@ -2171,8 +2084,8 @@
 !
 
 buttonMultiPress:button x:x y:y
-    "a button was pressed twice - handle doubleclick here
-    "
+    "a button was pressed twice - handle doubleclick here"
+
     buttonMotionAction := buttonReleaseAction := nil.
 
     self isEnabled ifFalse:[^ self].
@@ -2192,8 +2105,8 @@
 !
 
 buttonPress:button x:x y:y
-    "a button was pressed - handle selection here
-    "
+    "a button was pressed - handle selection here"
+
     |rowNr colNr menu sensor clickPoint|
 
     buttonMotionAction := buttonReleaseAction := nil.
@@ -2272,8 +2185,8 @@
 !
 
 characterPress:aChar x:x y:y
-    "search row in column at x/y starting its printable label with cahracter.
-    "
+    "search row in column at x/y starting its printable label with cahracter."
+
     |colNr rowNr lsize found column|
 
     lsize  := list size.
@@ -2307,14 +2220,13 @@
 !
 
 contentsChanged
-    "contents changed - move origin up if possible
-    "
+    "contents changed - move origin up if possible"
+    
     |y|
 
     shown ifTrue:[
         self recomputeHeightOfContents.
         y := self maxViewOriginY.
-
         viewOrigin y > y ifTrue:[
             scrollWhenUpdating ~~ false ifTrue:[
                 self scrollTo:(viewOrigin x @ y)
@@ -2327,14 +2239,14 @@
 !
 
 doubleClicked
-    "handle a double click
-    "
+    "handle a double click"
+    
     |col sel idx|
 
     self hasSelection ifTrue:[
         idx := self firstIndexSelected.
         col := self selectedColumn.
-        (col notNil and:[(sel := col doubleClickedSelector) notNil]) ifTrue:[
+        (col notNil and:[ (sel := col doubleClickedSelector) notNil ]) ifTrue:[
             col doubleClickOn:idx
         ] ifFalse:[
             doubleClickActionBlock notNil ifTrue:[
@@ -2367,20 +2279,19 @@
 !
 
 findMenuForSelection
-    "find the middle button menu for the current selection; returns the menu or nil
-    "
+    "find the middle button menu for the current selection; returns the menu or nil"
+    
     |col row menu|
 
     self numberOfSelections == 1 ifTrue:[
         row := self at:(self firstIndexSelected).
         col := self selectedColumn.
-
-        (col notNil and:[(menu := col menuForRow:row orAdaptor:columnAdaptor) notNil]) ifTrue:[
-            ^ menu
-        ].
-        col := columnDescriptors detect:[:c| c rendererType == #rowSelector]
-                                 ifNone:[nil].
-
+        (col notNil 
+            and:[ (menu := col menuForRow:row orAdaptor:columnAdaptor) notNil ]) 
+                ifTrue:[ ^ menu ].
+        col := columnDescriptors 
+                    detect:[:c | c rendererType == #rowSelector ]
+                    ifNone:[ nil ].
         col notNil ifTrue:[
             ^ col menuForRow:row inApplication:(self application)
         ]
@@ -2389,8 +2300,8 @@
 !
 
 keyPress:aKey x:x y:y
-    "a key was pressed - handle page-keys here
-    "
+    "a key was pressed - handle page-keys here"
+
     <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
                           #BeginOfText #EndOfText #ScrollUp #ScrollDown
                           #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)>
@@ -2592,18 +2503,18 @@
     ].
 !
 
-originChanged:delta
+originChanged:delta 
     "this one is sent, after the origin of my contents has changed -
-     tell dependents (i.e. scrollers) about this
-    "
+     tell dependents (i.e. scrollers) about this"
+    
     super originChanged:delta.
     self updateEditViewOrigin.
 !
 
 sizeChanged:how
     "size changed - move origin up if possible
-     change the layout of the labelView dependent on my layout
-    "
+     change the layout of the labelView dependent on my layout"
+
     |selectionWasVisible|
 
     selectionWasVisible := self isSelectionVisibleIn:(previousExtent ? self extent).
@@ -2658,34 +2569,24 @@
 
 !DSVColumnView methodsFor:'gc operations'!
 
-imageOnMyDevice:anImage
-    "associate image to device and clear pixel mask; returns the new image.
-    "
+imageOnMyDevice:anImage 
+    "associate image to device and clear pixel mask; returns the new image."
+    
     |deviceImage|
 
-    anImage isNil ifTrue:[^ anImage].
-
+    anImage isNil ifTrue:[
+        ^ anImage
+    ].
     deviceImage := anImage onDevice:device.
     deviceImage isImage ifTrue:[
         deviceImage clearMaskedPixels.
     ].
     ^ deviceImage
-"/    |image|
-"/
-"/    (image := anImage) notNil ifTrue:[
-"/        image device ~~ device ifTrue:[
-"/            image := image copy onDevice:device.
-"/        ].
-"/        image isImage ifTrue:[
-"/            image := image clearMaskedPixels
-"/        ]
-"/    ].
-"/    ^ image
 !
 
-registerImage:anImage key:aKey
-    "any row can register an image with a unique identifier a key symbol
-    "
+registerImage:anImage key:aKey 
+    "any row can register an image with a unique identifier a key symbol"
+    
     |img|
 
     (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
@@ -2696,23 +2597,21 @@
     ^ img
 !
 
-registeredImageAt:aKey
-    "any row can register an image with a unique identifier
-    "
+registeredImageAt:aKey 
+    "any row can register an image with a unique identifier"
+    
     ^ registererImages at:aKey ifAbsent:nil
 !
 
 releaseAllRegisteredImages
-    "release all registered images
-    "
+    "release all registered images"
+    
     registererImages := IdentityDictionary new.
 ! !
 
 !DSVColumnView methodsFor:'initialization & release'!
 
 create
-    "set color on device
-    "
     super create.
 
     fgColor     := fgColor     onDevice:device.
@@ -2738,8 +2637,8 @@
 !
 
 initStyle
-    "setup colors
-    "
+    "setup colors, etc."
+
     |button widget|
 
     super initStyle.
@@ -2804,8 +2703,8 @@
 !
 
 initialize
-    "set default attributes
-    "
+    "set default attributes"
+
     super initialize.
     self lineWidth:0.
 
@@ -2828,33 +2727,17 @@
     separatorSize      := 1.                            "/ separators mode 2D
     selectRowOnDefault := true.
     autoScroll         := true.
-!
-
-mapped
-    "set selection if exists after mapping
-    "
-"/    |idx|
-"/
-    super mapped.
-"/    needFitColumns == true ifTrue:[
-"/        self fitColumns
-"/    ].
-"/
-"/    (idx := self firstIndexSelected) ~~ 0 ifTrue:[
-"/        self scrollToRowAt:idx colAt:0.        
-"/    ].
+    scrollRowWise      := false.
 !
 
 realize
-    "recompute contents and fit columns to view
-    "
+    "recompute contents and fit columns to view"
+    
     |selection|
 
-    self  bitGravity:#NorthWest.
-    self  recomputeHeightOfContents.
-
+    self bitGravity:#NorthWest.
+    self recomputeHeightOfContents.
     selection := 0.
-
     model notNil ifTrue:[
         (model respondsTo:#selectionIndex) ifTrue:[
             selection := model selectionIndex
@@ -2865,38 +2748,32 @@
         ]
     ].
     self selectRowIndex:selection.
-
     super realize.
-    self  fitColumns.
+    self fitColumns.
 !
 
 realized
-    "set selection if exists after mapping
-    "
+    "set selection if exists after mapping"
+    
     |idx|
 
     super realized.
-
     needFitColumns == true ifTrue:[
         self fitColumns
     ].
-
     (idx := self firstIndexSelected) ~~ 0 ifTrue:[
-        self scrollToRowAt:idx colAt:0.        
+        self scrollToRowAt:idx colAt:0.
     ].
 !
 
 release
-    "remove dependencies
-    "
+    "remove dependencies"
+    
     self columnHolder:nil.
-
-    listHolder    removeDependent:self.
-
+    listHolder removeDependent:self.
     columnAdaptor isValueModel ifTrue:[
         columnAdaptor removeDependent:self
     ].
-
     self beDependentOfRows:false.
     super release
 ! !
@@ -2904,16 +2781,15 @@
 !DSVColumnView methodsFor:'obsolete'!
 
 has3Dsepartors
-    "shouldn't be used any more
-    "
+    "shouldn't be used any more"
+    
     ^ self has3Dseparators
 !
 
-has3Dsepartors:aBool
-    "shouldn't be used any more
-    "
+has3Dsepartors:aBool 
+    "shouldn't be used any more"
+    
     self has3Dseparators:aBool
-
 ! !
 
 !DSVColumnView methodsFor:'private'!
@@ -2937,51 +2813,32 @@
 !
 
 destroyEditView
-    "destroy the edit view; release KeyboardForwarder
-    "
+    "destroy the edit view; release KeyboardForwarder"
+    
     editValue notNil ifTrue:[
         editValue removeDependent:self.
         editValue := nil
     ].
     editView notNil ifTrue:[
-        editView withAllSubViewsDo:[:aView|
-            aView delegate:nil
-        ].
+        editView withAllSubViewsDo:[:aView | aView delegate:nil ].
         editView destroy.
         editView := nil.
         self windowGroup focusView:nil.
     ].
-
-
 !
 
-detectViewAt:aPoint in:aView
-    "returns the view at a point
-    "
-    aView isNil ifTrue:[^ nil].
+detectViewAt:aPoint in:aView 
+    "returns the view at a point"
+    
+    aView isNil ifTrue:[
+        ^ nil
+    ].
     ^ aView detectViewAt:aPoint.
-
-"/ cg: old code was (refactored to use common code)
-"/
-"/    |p|
-"/
-"/    (aView notNil and:[aView subViews notNil]) ifTrue:[
-"/        aView subViews do:[:sv|
-"/            p := device translatePoint:aPoint fromView:self toView:sv.
-"/
-"/            (p x >= 0 and:[p y >= 0 and:[p x <= sv width and:[p y <= sv height]]]) ifTrue:[
-"/                ^ self detectViewAt:aPoint in:sv
-"/            ]
-"/        ]
-"/    ].
-"/    ^ aView
-
-    "Modified: / 10.10.2001 / 13:53:24 / cg"
 !
 
 fitColumns
-    "fit columns to view; 
-    "
+    "fit columns to view; "
+
     |selectedColumn list width changed dX sz oldOrgX newOrgX|
 
     preferredExtent isNil ifTrue:[
@@ -3055,81 +2912,71 @@
 !
 
 maxViewOriginY
-    "returns the maximum possible y of the view origin
-    "
+    "returns the maximum possible y of the view origin"
+    
     |y|
 
     y := self heightOfContents - self innerHeight.
-  ^ y max:0
-
+    ^ y max:0
 !
 
 updateEditViewOrigin
-    "update origin of the editView
-    "
+    "update origin of the editView"
+    
     |x y|
 
     editView notNil ifTrue:[
         y := self yVisibleOfRowNr:(self firstIndexSelected).
         x := self xVisibleOfColNr:selectedColIndex.
-
         editView origin:(x @ y + separatorSize).
     ].
-
 !
 
-xVisibleOfColNr:aColNr
-    "returns visible x assigned to a column number
-    "
-    |x
-     end "{ Class:SmallInteger }"
-    |
+xVisibleOfColNr:aColNr 
+    "returns visible x assigned to a column number"
+    
+    |x 
+     end "{ Class:SmallInteger }"|
+
     x := margin - viewOrigin x.
-
     aColNr > 1 ifTrue:[
         end := aColNr - 1.
-
-        columnDescriptors from:1 to:end do:[:aCol|
-            x := x + aCol width
-        ]
+        columnDescriptors 
+            from:1
+            to:end
+            do:[:aCol | x := x + aCol width ]
     ].
-  ^ x
-
+    ^ x
 !
 
-xVisibleToColNr:x
-    "returns the column number assigned to a physical x or nil
-    "
-    |x0
-     nr "{ Class:SmallInteger }"
-    |
+xVisibleToColNr:x 
+    "returns the column number assigned to a physical x or nil"
+    
+    |x0 
+     nr "{ Class:SmallInteger }"|
 
     x0 := x + viewOrigin x - margin.
     nr := 1.
-
-    columnDescriptors do:[:aCol|
+    columnDescriptors do:[:aCol | 
         x0 := x0 - aCol width.
-        x0 <= 0 ifTrue:[^ nr].
+        x0 <= 0 ifTrue:[ ^ nr ].
         nr := nr + 1.
     ].
     ^ nil.
-
 !
 
-yVisibleOfRowNr:aRowNr
-    "returns visible y assigned to the row number
-    "
+yVisibleOfRowNr:aRowNr 
+    "returns visible y assigned to the row number"
+    
     ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y
-
 !
 
-yVisibleToRowNr:y
-    "returns the row number assigned to a physical y or nil
-    "
+yVisibleToRowNr:y 
+    "returns the row number assigned to a physical y or nil"
+    
     |rowNr|
 
     rowNr := (y + viewOrigin y - margin) // rowHeight + 1.
-
     (rowNr between:1 and:(list size)) ifTrue:[
         ^ rowNr
     ].
@@ -3143,115 +2990,109 @@
 !
 
 indexOfFirstRowShown
-    "returns index of first row shown
-    "
+    "returns index of first row shown"
+    
     |idx|
 
     idx := (viewOrigin y // rowHeight) + 1.
-  ^ (idx <= list size) ifTrue:[idx] ifFalse:[0]
-
+    ^ (idx <= list size) ifTrue:[ idx ] ifFalse:[ 0 ]
 !
 
 isEnabled
     ^ enableChannel value ~~ false
 !
 
-isRowSelectable:aRowNumber
-    "returne true if a row number is selectable
-    "
-    (aRowNumber notNil and:[aRowNumber ~~ 0]) ifTrue:[
-        selectConditionBlock isNil ifTrue:[^ true].
+isRowSelectable:aRowNumber 
+    "returne true if a row number is selectable"
+    
+    (aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[
+        selectConditionBlock isNil ifTrue:[
+            ^ true
+        ].
         ^ (selectConditionBlock value:aRowNumber)
     ].
     ^ false
 !
 
 numberOfColumns
-    "returns number of columns
-    "
+    "returns number of columns"
+    
     ^ columnDescriptors size
-
 !
 
 numberOfRows
-    "returns number of raws
-    "
+    "returns number of raws"
+    
     ^ list size
-
 !
 
 rowHeight
-    "get the height of the highest row in pixels
-    "
+    "get the height of the highest row in pixels"
+    
     ^ rowHeight
-
 !
 
 separatorSize
     "returns vertical/horizontal size of a separator dependent on the
-     3D effect.
-    "
+     3D effect."
+    
     ^ separatorSize
-
 !
 
 size
-    "returns number of raws
-    "
+    "returns number of raws"
+    
     ^ list size
-
 ! !
 
 !DSVColumnView methodsFor:'recomputation'!
 
 hasPreferredExtent
-    "returns true if preferred extent is accumulated
-    "
+    "returns true if preferred extent is accumulated"
+    
     ^ preferredExtent notNil
 !
 
 preferredExtent
-    "recompute preferred extent; raise notification
-    "
+    "recompute preferred extent; raise notification"
+    
     |x|
 
     preferredExtent notNil ifTrue:[
         ^ preferredExtent
     ].
     x := 3.
-
-    columnDescriptors do:[:aCol|
+    columnDescriptors do:[:aCol | 
         minRowHeight := (aCol heightOfHighestRow) max:minRowHeight.
         x := x + (aCol minWidth).
     ].
-    rowHeight       := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2.
+    rowHeight := (minRowHeight + separatorSize + verticalSpacing 
+                + verticalSpacing + 1) 
+                // 2 * 2.
     preferredExtent := x @ (list size * rowHeight).
-    rowFontAscent   := font ascent.
-
-  ^ preferredExtent
+    rowFontAscent := font ascent.
+    ^ preferredExtent
 !
 
 preferredExtentChanged
-    "called if the preffered extent changed
-    "
+    "called if the preffered extent changed"
+    
     |x "{ Class:SmallInteger }"
-     y "{ Class:SmallInteger }"
-    |
+     y "{ Class:SmallInteger }"|
+
     y := viewOrigin y.
     x := viewOrigin x.
-
-    (y ~~ 0 or:[x ~~ 0]) ifTrue:[
+    (y ~~ 0 or:[ x ~~ 0 ]) ifTrue:[
         self originWillChange.
-
         viewOrigin := 0 @ 0.
         preferredExtent := nil.
-        self originChanged:(x negated  @ y negated).
+        self originChanged:(x negated @ y negated).
     ]
 !
 
 recomputeHeightOfContents
-    "recompute height of contents( scrolling )
-    "
+    "recompute height of contents( scrolling )"
+    
     preferredExtent notNil ifTrue:[
         preferredExtent y:(rowHeight * list size)
     ] ifFalse:[
@@ -3261,68 +3102,51 @@
 
 !DSVColumnView methodsFor:'scroller interface'!
 
-heightOfContents
-    "return the height of the contents in pixels
-    "
-    preferredExtent isNil ifTrue:[
-        self preferredExtent
-    ].
-    ^ preferredExtent y
-!
-
 innerHeight
-    "returns the inner height of the contents shown
-    "
+    "returns the inner height of the contents shown"
+    
     ^ height - margin - margin
-
 !
 
 verticalScrollStep
-    "return the amount to scroll when stepping up/down.
-    "
+    "return the amount to scroll when stepping up/down."
+    
     ^ rowHeight
-
-
-
 !
 
 viewOrigin
     "return the viewOrigin; thats the coordinate of the contents 
-     which is shown topLeft in the view.
-    "
+     which is shown topLeft in the view."
+    
     ^ viewOrigin
-
 !
 
 widthOfContents
-    "return the width of the contents in pixels
-    "
+    "return the width of the contents in pixels"
+    
     preferredExtent isNil ifTrue:[
         self preferredExtent
     ].
     ^ preferredExtent x
-
 !
 
 xOriginOfContents
-    "return the horizontal origin of the contents in pixels
-    "
-    ^ viewOrigin x 
-
+    "return the horizontal origin of the contents in pixels"
+    
+    ^ viewOrigin x
 !
 
 yOriginOfContents
-    "return the vertical origin of the contents in pixels
-    "
+    "return the vertical origin of the contents in pixels"
+    
     ^ viewOrigin y
-
 ! !
 
 !DSVColumnView methodsFor:'scrolling'!
 
 scrollTo:anOrigin redraw:doRedraw
-    "change origin to have newOrigin be visible at the top-left.
-    "
+    "change origin to have newOrigin be visible at the top-left."
+
     |newOrg dltOrg wg
      h       "{ Class:SmallInteger }"
      w       "{ Class:SmallInteger }"
@@ -3438,8 +3262,8 @@
 !
 
 scrollToRowAt:aRowNr colAt:aColNr
-    "make row at a row number in column at a column number visible
-    "
+    "make row at a row number in column at a column number visible"
+
     |x  "{ Class:SmallInteger }"
      y  "{ Class:SmallInteger }"
      l  "{ Class:SmallInteger }"
@@ -3482,19 +3306,16 @@
     (dX == 0 and:[dY == 0]) ifFalse:[
         self scrollTo:(viewOrigin - (dX @ dY)).
     ]
-
-
 !
 
 scrollToSelection
-    "make selection visible
-    "
+    "make selection visible"
+
     |rowNr|
 
     (rowNr := self firstIndexSelected) ~~ 0 ifTrue:[
         self scrollToRowAt:rowNr colAt:selectedColIndex
     ]
-
 !
 
 scrollVerticalTo:aPixelOffset
@@ -3503,15 +3324,18 @@
     |orgX orgY|
 
     orgX := viewOrigin x.
-    orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight.
-  ^ self scrollTo:(orgX @ orgY).
-
+    scrollRowWise ifTrue:[
+        orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight.
+    ] ifFalse:[
+        orgY := aPixelOffset.
+    ].
+    ^ self scrollTo:(orgX @ orgY).
 !
 
 startAutoScroll:aSelectorOrBlock distance:aDistance
     "setup for auto-scroll (when button-press-moving below/above view);
-     - timeDelta for scroll is computed from distance
-    "
+     - timeDelta for scroll is computed from distance"
+
     |timeDelta scrollBlock|
 
     autoScroll ifFalse:[
@@ -3544,23 +3368,21 @@
 !
 
 stopAutoScroll
-    "stop any autoScroll
-    "
+    "stop any autoScroll"
+
     autoScrollBlock notNil ifTrue:[
         Processor removeTimedBlock:autoScrollBlock.
         autoScrollBlock := nil.
         self compressMotionEvents:true.
     ].
-
-
 ! !
 
 !DSVColumnView methodsFor:'selection'!
 
 addRowToSelection:aRowNr
     "add a row to the selection
-     if a column is selected, the column will be closed
-    "
+     if a column is selected, the column will be closed"
+
     |newSelection|
 
     (self isRowSelectable:aRowNr) ifFalse:[
@@ -3589,14 +3411,12 @@
 !
 
 deselect
-    "deselect
-    "
     self selectColIndex:0 rowIndex:0
 !
 
 firstIndexSelected
-    "returns index of first row selected or 0
-    "
+    "returns index of first row selected or 0"
+
     multipleSelectOk ifFalse:[
         ^ selectedRowIndex
     ].
@@ -3617,22 +3437,20 @@
 
 hasRowSelection
     "returns true if a selection exists, and its a complete row
-     (as opposed to either no selection, or a columnSelection)
-    "
+     (as opposed to either no selection, or a columnSelection)"
+
     ^ self hasSelection and:[selectedColIndex == 0]
 !
 
 hasSelection
-    "returns true if a selection exists
-    "
+    "returns true if a selection exists"
+
     ^ self numberOfSelections ~~ 0
-
-
 !
 
 isInSelection:aRowNr
-    "return true, if row, aRowNr is in the selection
-    "
+    "returns true, if row, aRowNr is in the selection"
+
     aRowNr ~~ 0 ifTrue:[
         multipleSelectOk ifFalse:[
             ^ aRowNr == selectedRowIndex
@@ -3645,8 +3463,8 @@
 !
 
 isRowSelected:aRowNr
-    "return true, if row is in the selection
-    "
+    "returns true, if row is in the selection"
+
     selectedColIndex == 0 ifTrue:[
         ^ self isInSelection:aRowNr
     ].
@@ -3671,8 +3489,8 @@
 
 isSelected:aRowNr inColumn:aColNr
     "returns true if cell in a row; a row number, in a column, a column
-     number is selected.
-    "
+     number is selected."
+
     multipleSelectOk ifFalse:[
         aRowNr ~~ selectedRowIndex ifTrue:[
             ^ false
@@ -3683,7 +3501,6 @@
         ]
     ].
     ^ (selectedColIndex == 0 or:[selectedColIndex == aColNr])
-
 !
 
 isSelectionVisibleIn:anExtentPoint
@@ -3697,8 +3514,8 @@
 !
 
 lastIndexSelected
-    "returns index of last row selected or 0
-    "
+    "returns index of last selected row or 0"
+
     multipleSelectOk ifFalse:[
         ^ selectedRowIndex
     ].
@@ -3709,8 +3526,8 @@
 !
 
 makeLineVisible:aLine
-    "scroll to make aLine visible
-    "
+    "scroll to make aLine visible"
+
     |colNr|
 
     aLine == 0 ifTrue:[^ self].
@@ -3726,8 +3543,8 @@
 !
 
 makeSelectionVisible
-    "scroll to make the selection line visible
-    "
+    "scroll to make the selection line visible"
+
     |rowNr colNr|
 
     rowNr := self firstIndexSelected.
@@ -3742,8 +3559,8 @@
 !
 
 maxIndexSelected
-    "return the largest index selected or 0
-    "
+    "return the largest index selected or 0"
+
     multipleSelectOk ifFalse:[
         ^ selectedRowIndex
     ].
@@ -3754,8 +3571,8 @@
 !
 
 minIndexSelected
-    "return the smallest index selected or 0
-    "
+    "return the smallest index selected or 0"
+
     multipleSelectOk ifFalse:[
         ^ selectedRowIndex
     ].
@@ -3766,8 +3583,8 @@
 !
 
 numberOfSelections
-    "return the number of selected rows
-    "
+    "return the number of selected rows"
+
     multipleSelectOk ifFalse:[
         ^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0]
     ].
@@ -3775,8 +3592,8 @@
 !
 
 removeRowFromSelection:aRowNr
-    "remove a row from the selection
-    "
+    "remove a row from the selection"
+
     (self isInSelection:aRowNr) ifFalse:[^ self].
 
     self numberOfSelections == 1 ifTrue:[
@@ -3789,8 +3606,8 @@
 !
 
 selectAllRows
-    "select all
-    "
+    "select all"
+
     multipleSelectOk ifFalse:[^ self].
 
     selectedRowIndex := (1 to:list size) select:[:idx| self isRowSelectable:idx ].
@@ -3799,8 +3616,8 @@
 !
 
 selectColIndex:aColNr rowIndex:aRowNr
-    "change selection with notification
-    "
+    "change selection with notification"
+
     |oC oR|
 
     oC := self selectedColIndex.
@@ -3814,8 +3631,8 @@
 !
 
 selectRow:something
-    "select a row
-    "
+    "select a row"
+
     ^ self selectedRowIndex:something
 !
 
@@ -3867,96 +3684,94 @@
 !
 
 selectRowIndex:something
-    "set selection of rows
-    "
+    "set selection of rows"
+
     self selectColIndex:selectedColIndex rowIndex:something
-
-
 !
 
 selectedColIndex
-    "returns selected column number or 0
-    "
+    "returns selected column number or 0"
+
     ^ selectedColIndex
 !
 
 selectedColumn
-    "returns selected column or nil
-    "
+    "returns selected column or nil"
+
     ^ columnDescriptors at:selectedColIndex ifAbsent:nil.
 !
 
 selectedRow
-    "returns selected row (or collection if multiple selection) or nil
-    "
+    "returns the selected row (or collection if multiple selection) or nil"
+    
     multipleSelectOk ifFalse:[
         ^ self at:selectedRowIndex ifAbsent:nil
     ].
-
     selectedRowIndex size ~~ 0 ifTrue:[
-        ^ selectedRowIndex collect:[:i| self at:i]
+        ^ selectedRowIndex collect:[:i | self at:i ]
     ].
     ^ nil
 !
 
-selectedRow:something
-    "select something
-    "
+selectedRow:something 
+    "select something"
+    
     self selectedRowIndex:something
 !
 
 selectedRowIndex
-    "returns selected row number or 0
-    "
+    "returns selected row number or 0"
+    
     ^ selectedRowIndex
 !
 
-selectedRowIndex:something
+selectedRowIndex:something 
     "set the row selection (single or multiple rows);
-     does NOT change the selectoed column.
-    "
+     does NOT change the selectoed column."
+    
     self selectColIndex:selectedColIndex rowIndex:something
 !
 
 selectionChanged
-    "selection has changed
-    "
+    "selection has changed"
+    
     |val|
 
     model notNil ifTrue:[
         val := self selectedRowIndex copy.
-
         (model respondsTo:#selectionIndex:) ifTrue:[
             model selectionIndex:val
         ] ifFalse:[
-            useIndex ifFalse:[ model value:(self selectedRow) ]
-                      ifTrue:[ model value:val ]
+            useIndex ifFalse:[
+                model value:(self selectedRow)
+            ] ifTrue:[
+                model value:val
+            ]
         ]
     ].
-
     actionBlock notNil ifTrue:[
         actionBlock value:(self selectedRowIndex)
     ]
 !
 
-selectionIndicesDo:aOneArgBlock
+selectionIndicesDo:aOneArgBlock 
     "evaluate block on each row selected; the argument to the row
-     is the index of the selected row
-    "
+     is the index of the selected row"
+    
     multipleSelectOk ifFalse:[
         selectedRowIndex ~~ 0 ifTrue:[
             aOneArgBlock value:selectedRowIndex
         ]
     ] ifTrue:[
         selectedRowIndex size ~~ 0 ifTrue:[
-            selectedRowIndex do:[:i| aOneArgBlock value:i ]
+            selectedRowIndex do:aOneArgBlock
         ]
     ]
 !
 
 setSelectColIndex:colNrArg rowIndex:rowNrArg
-    "change selection without notification
-    "
+    "change selection without notification"
+
     |editSpec rowNr colNr newCol oldCol oldRow sensor sglSelRow oldSz
      keyBrdFwd filter edView|
 
@@ -4161,5 +3976,5 @@
 !DSVColumnView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.184 2004-05-27 14:27:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.185 2004-06-07 09:32:18 cg Exp $'
 ! !