DSVColumnView.st
changeset 5723 3019347d6f76
parent 5719 d53bae9fd8b2
child 5730 dcaa2eb5a14b
equal deleted inserted replaced
5722:33fa68fa29f9 5723:3019347d6f76
   190 !
   190 !
   191 
   191 
   192 updateStyleCache
   192 updateStyleCache
   193     "extract values from the styleSheet and cache them in class variables"
   193     "extract values from the styleSheet and cache them in class variables"
   194 
   194 
   195     <resource: #style (#textForegroundColor 
   195     <resource: #style (#textForegroundColor
   196                        #'scrollableView.backgroundColor'
   196                        #'scrollableView.backgroundColor'
   197                        #'button.lightColor'
   197                        #'button.lightColor'
   198                        #'button.shadowColor'
   198                        #'button.shadowColor'
   199                        #'button.halfLightColor'
   199                        #'button.halfLightColor'
   200                        #'button.halfShadowColor'
   200                        #'button.halfShadowColor'
   202                        #'checkToggle.activeImage'
   202                        #'checkToggle.activeImage'
   203                        #'checkToggle.passiveImage'
   203                        #'checkToggle.passiveImage'
   204                        #'radioButton.activeImage'
   204                        #'radioButton.activeImage'
   205                        #'radioButton.passiveImage'
   205                        #'radioButton.passiveImage'
   206                        #'selection.hilightForegroundColor'
   206                        #'selection.hilightForegroundColor'
   207                        #'selection.hilightBackgroundColor' 
   207                        #'selection.hilightBackgroundColor'
   208                        #'selection.hilightFrameColor'
   208                        #'selection.hilightFrameColor'
   209                        #'dataSet.labelView.foregroundColor'
   209                        #'dataSet.labelView.foregroundColor'
   210                        #'dataSet.labelView.backgroundColor'
   210                        #'dataSet.labelView.backgroundColor'
   211     )>
   211     )>
   212 
   212 
   253     ComboButtonLevel  := nil.
   253     ComboButtonLevel  := nil.
   254     ComboButtonExtent := nil.
   254     ComboButtonExtent := nil.
   255 
   255 
   256     DefaultLabelBackgroundColor := StyleSheet at:#'dataSet.labelView.backgroundColor' default:nil.
   256     DefaultLabelBackgroundColor := StyleSheet at:#'dataSet.labelView.backgroundColor' default:nil.
   257     DefaultLabelForegroundColor := StyleSheet at:#'dataSet.labelView.foregroundColor' default:nil.
   257     DefaultLabelForegroundColor := StyleSheet at:#'dataSet.labelView.foregroundColor' default:nil.
   258     
   258 
   259     "
   259     "
   260      self updateStyleCache.
   260      self updateStyleCache.
   261     "
   261     "
   262 
   262 
   263     "Modified: / 20-01-2011 / 08:44:28 / cg"
   263     "Modified: / 20-01-2011 / 08:44:28 / cg"
   286     "
   286     "
   287 
   287 
   288     <resource: #image>
   288     <resource: #image>
   289 
   289 
   290     ^Icon
   290     ^Icon
   291         constantNamed:'DSVColumnView dragIconMulti'
   291         constantNamed:'DSVColumnView class dragIconMulti'
   292         ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
   292         ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
   293 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@<@@@@O@@@@C3??L@<??3@OO?<<C3??O@<??0@OO?<@C3???0<???<OO???C3???0<???<OO???@C?
   293 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@<@@@@O@@@@C3??L@<??3@OO?<<C3??O@<??0@OO?<@C3???0<???<OO???C3???0<???<OO???@C?
   294 ??0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
   294 ??0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
   295             colorMapFromArray:#[0 0 0 255 255 255]
   295             colorMapFromArray:#[0 0 0 255 255 255]
   296             mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
   296             mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
   312     "
   312     "
   313 
   313 
   314     <resource: #image>
   314     <resource: #image>
   315 
   315 
   316     ^Icon
   316     ^Icon
   317         constantNamed:'DSVColumnView dragIconSingle'
   317         constantNamed:'DSVColumnView class dragIconSingle'
   318         ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
   318         ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
   319 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C??
   319 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C??
   320 ?0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
   320 ?0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
   321             colorMapFromArray:#[0 0 0 255 255 255]
   321             colorMapFromArray:#[0 0 0 255 255 255]
   322             mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
   322             mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
   323 @@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O??
   323 @@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O??
   324 ?<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself]
   324 ?<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself]
   325 !
   325 !
   326 
   326 
   327 rowSelectorImage
   327 rowSelectorImage
   328     <resource: #image>
       
   329     "This resource specification was automatically generated
   328     "This resource specification was automatically generated
   330      by the ImageEditor of ST/X."
   329      by the ImageEditor of ST/X."
       
   330 
   331     "Do not manually edit this!! If it is corrupted,
   331     "Do not manually edit this!! If it is corrupted,
   332      the ImageEditor may not be able to read the specification."
   332      the ImageEditor may not be able to read the specification."
       
   333 
   333     "
   334     "
   334      self rowSelectorImage inspect
   335      self rowSelectorImage inspect
   335      ImageEditor openOnClass:self andSelector:#rowSelectorImage
   336      ImageEditor openOnClass:self andSelector:#rowSelectorImage
   336      Icon flushCachedIcons"
   337      Icon flushCachedIcons
   337     
   338     "
   338     ^ Icon constantNamed:#'DSVColumnView class rowSelectorImage'
   339 
   339         ifAbsentPut:[
   340     <resource: #image>
   340             (Depth2Image new)
   341 
   341                 width:11;
   342     ^Icon
   342                 height:11;
   343         constantNamed:'DSVColumnView class rowSelectorImage'
   343                 photometric:(#palette);
   344         ifAbsentPut:[(Depth2Image width:11 height:11) bits:(ByteArray fromPackedString:'@ @@@#@@*#0@@C,@O>(0N*($J*$P@BT@*!!P@@!!@@@ @@')
   344                 bitsPerSample:(#( 2 ));
   345             colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 255 255]
   345                 samplesPerPixel:(1);
   346             mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'C@@N@@<@?8C?0O? ?<C? @<@C @L@@@a'); yourself); yourself]
   346                 bits:(ByteArray 
       
   347                             fromPackedString:'@0@@@1@@?1P@@A4@EW=@G?? O?:@@C(@?2 @@2@@@0@@');
       
   348                 colorMapFromArray:#[ 0 0 0 255 255 255 127 127 127 170 170 170 ];
       
   349                 mask:((ImageMask new)
       
   350                             width:11;
       
   351                             height:11;
       
   352                             bits:(ByteArray fromPackedString:'C@@N@@<@?8C?0O? ?<C? @<@C @L@@@a');
       
   353                             yourself);
       
   354                 yourself
       
   355         ]
       
   356 ! !
   347 ! !
   357 
   348 
   358 !DSVColumnView class methodsFor:'signal constants'!
   349 !DSVColumnView class methodsFor:'signal constants'!
   359 
   350 
   360 stopRedrawSignal
   351 stopRedrawSignal
   370 
   361 
   371 !DSVColumnView methodsFor:'accessing'!
   362 !DSVColumnView methodsFor:'accessing'!
   372 
   363 
   373 builder
   364 builder
   374     "get the builder (UIBuilder or nil)"
   365     "get the builder (UIBuilder or nil)"
   375     
   366 
   376     ^ builder
   367     ^ builder
   377 !
   368 !
   378 
   369 
   379 builder:aBuilder 
   370 builder:aBuilder
   380     "set the builder (UIBuilder or nil)"
   371     "set the builder (UIBuilder or nil)"
   381     
   372 
   382     builder := aBuilder
   373     builder := aBuilder
   383 !
   374 !
   384 
   375 
   385 columnView
   376 columnView
   386     "returns self"
   377     "returns self"
   387     
   378 
   388     ^ self
   379     ^ self
   389 !
   380 !
   390 
   381 
   391 heightOfContents
   382 heightOfContents
   392     "return the height of the contents in pixels"
   383     "return the height of the contents in pixels"
   393     
   384 
   394     cachedPreferredExtent isNil ifTrue:[
   385     cachedPreferredExtent isNil ifTrue:[
   395         self preferredExtent
   386         self preferredExtent
   396     ].
   387     ].
   397     ^ cachedPreferredExtent y
   388     ^ cachedPreferredExtent y
   398 !
   389 !
   404 
   395 
   405 labelView:aView
   396 labelView:aView
   406     labelView := aView for:self.
   397     labelView := aView for:self.
   407 
   398 
   408     labelView layout:(LayoutFrame
   399     labelView layout:(LayoutFrame
   409                         leftFraction:0 offset:0 
   400                         leftFraction:0 offset:0
   410                         rightFraction:1 offset:0 
   401                         rightFraction:1 offset:0
   411                         topFraction:0 offset:0 
   402                         topFraction:0 offset:0
   412                         bottomFraction:0 offset:[self preferredLabelViewHeight]).
   403                         bottomFraction:0 offset:[self preferredLabelViewHeight]).
   413 !
   404 !
   414 
   405 
   415 level:aLevel 
   406 level:aLevel
   416     "change the level and thus the level of the labelView"
   407     "change the level and thus the level of the labelView"
   417     
   408 
   418     aLevel ~~ level ifTrue:[
   409     aLevel ~~ level ifTrue:[
   419         super level:aLevel.
   410         super level:aLevel.
   420 "/        labelView level:aLevel.
   411 "/        labelView level:aLevel.
   421     ]
   412     ]
   422 !
   413 !
   425     ^ labelView preferredHeight "/ + (labelView margin + self verticalSpacing * 2).
   416     ^ labelView preferredHeight "/ + (labelView margin + self verticalSpacing * 2).
   426 !
   417 !
   427 
   418 
   428 rowFontAscent
   419 rowFontAscent
   429     "returns the inset of a printable text in a row"
   420     "returns the inset of a printable text in a row"
   430     
   421 
   431     ^ rowFontAscent
   422     ^ rowFontAscent
   432 !
   423 !
   433 
   424 
   434 selectedColIndex:newSelectedColIndex
   425 selectedColIndex:newSelectedColIndex
   435     self selectedColIndexHolder value:newSelectedColIndex
   426     self selectedColIndexHolder value:newSelectedColIndex
   442     ^ selectedColIndexHolder
   433     ^ selectedColIndexHolder
   443 ! !
   434 ! !
   444 
   435 
   445 !DSVColumnView methodsFor:'accessing-actions'!
   436 !DSVColumnView methodsFor:'accessing-actions'!
   446 
   437 
   447 action:aOneArgAction 
   438 action:aOneArgAction
   448     "set the action block to be performed on select"
   439     "set the action block to be performed on select"
   449     
   440 
   450     actionBlock := aOneArgAction
   441     actionBlock := aOneArgAction
   451 !
   442 !
   452 
   443 
   453 doubleClickAction:aOneArgAction 
   444 doubleClickAction:aOneArgAction
   454     "set the action block to be performed on doubleclick"
   445     "set the action block to be performed on doubleclick"
   455     
   446 
   456     doubleClickActionBlock := aOneArgAction
   447     doubleClickActionBlock := aOneArgAction
   457 !
   448 !
   458 
   449 
   459 rowIfAbsent:aOneArgAction 
   450 rowIfAbsent:aOneArgAction
   460     "set the action block to be performed on each 'nil' entry into the
   451     "set the action block to be performed on each 'nil' entry into the
   461      list. The argument to the block is the index into the list. The
   452      list. The argument to the block is the index into the list. The
   462      block returns the row which is put to the list"
   453      block returns the row which is put to the list"
   463     
   454 
   464     rowIfAbsentBlock := aOneArgAction
   455     rowIfAbsentBlock := aOneArgAction
   465 !
   456 !
   466 
   457 
   467 selectConditionBlock
   458 selectConditionBlock
   468     "get the select-conditionBlock; this block is evaluated before 
   459     "get the select-conditionBlock; this block is evaluated before
   469      any selection change is performed (passing the to-be-changed row number
   460      any selection change is performed (passing the to-be-changed row number
   470      index as arg).
   461      index as arg).
   471      The change will not be done, if the block returns false. "
   462      The change will not be done, if the block returns false. "
   472     
   463 
   473     ^ selectConditionBlock
   464     ^ selectConditionBlock
   474 !
   465 !
   475 
   466 
   476 selectConditionBlock:aOneArgBlockOrNil 
   467 selectConditionBlock:aOneArgBlockOrNil
   477     "set the select-conditionBlock; this block is evaluated before 
   468     "set the select-conditionBlock; this block is evaluated before
   478      any selection change is performed (passing the to-be-changed row number
   469      any selection change is performed (passing the to-be-changed row number
   479      index as arg).
   470      index as arg).
   480      The change will not be done, if the block returns false. "
   471      The change will not be done, if the block returns false. "
   481     
   472 
   482     selectConditionBlock := aOneArgBlockOrNil.
   473     selectConditionBlock := aOneArgBlockOrNil.
   483 !
   474 !
   484 
   475 
   485 tabAtEndAction:aNoneArgAction 
   476 tabAtEndAction:aNoneArgAction
   486     "set the action, called without any argument at end of the list entering
   477     "set the action, called without any argument at end of the list entering
   487      tab next.
   478      tab next.
   488      The default is to give the focus to the view after self in the focusSequence"
   479      The default is to give the focus to the view after self in the focusSequence"
   489     
   480 
   490     tabAtEndAction := aNoneArgAction
   481     tabAtEndAction := aNoneArgAction
   491 !
   482 !
   492 
   483 
   493 tabAtStartAction:aNoneArgAction 
   484 tabAtStartAction:aNoneArgAction
   494     "set the action, called without any argument at start of the list entering
   485     "set the action, called without any argument at start of the list entering
   495      tab previous.
   486      tab previous.
   496      The default is to give the focus to the view before self in the focusSequence"
   487      The default is to give the focus to the view before self in the focusSequence"
   497     
   488 
   498     tabAtStartAction := aNoneArgAction
   489     tabAtStartAction := aNoneArgAction
   499 ! !
   490 ! !
   500 
   491 
   501 !DSVColumnView methodsFor:'accessing-behavior'!
   492 !DSVColumnView methodsFor:'accessing-behavior'!
   502 
   493 
   521     "make myself dependent of any row; in this case any change notification
   512     "make myself dependent of any row; in this case any change notification
   522      raised by a row is catched and the cell identified by the 'readSelector'
   513      raised by a row is catched and the cell identified by the 'readSelector'
   523      is redrawn. In case of a nil readSelector, the whole raw is redrawn.
   514      is redrawn. In case of a nil readSelector, the whole raw is redrawn.
   524         -> row changed:'what'
   515         -> row changed:'what'
   525      By default, the attribute is set to false (disabled)."
   516      By default, the attribute is set to false (disabled)."
   526     
   517 
   527     ^ beDependentOfRows
   518     ^ beDependentOfRows
   528 !
   519 !
   529 
   520 
   530 beDependentOfRows:aBool 
   521 beDependentOfRows:aBool
   531     "make myself dependent of any row; in this case any change notification
   522     "make myself dependent of any row; in this case any change notification
   532      raised by a row is catched and the cell identified by the 'readSelector'
   523      raised by a row is catched and the cell identified by the 'readSelector'
   533      is redrawn. In case of a nil readSelector, the whole raw is redrawn.
   524      is redrawn. In case of a nil readSelector, the whole raw is redrawn.
   534         -> row changed:'what'
   525         -> row changed:'what'
   535      By default, the attribute is set to false (disabled)."
   526      By default, the attribute is set to false (disabled)."
   536     
   527 
   537     aBool ~~ beDependentOfRows ifTrue:[
   528     aBool ~~ beDependentOfRows ifTrue:[
   538         beDependentOfRows := aBool.
   529         beDependentOfRows := aBool.
   539         aBool ifTrue:[
   530         aBool ifTrue:[
   540             self makeDependentOfRows
   531             self makeDependentOfRows
   541         ] ifFalse:[
   532         ] ifFalse:[
   571     ignoreReselect := aBoolean
   562     ignoreReselect := aBoolean
   572 
   563 
   573     "Created: / 22-10-2006 / 11:01:25 / cg"
   564     "Created: / 22-10-2006 / 11:01:25 / cg"
   574 !
   565 !
   575 
   566 
   576 makeDependentOfRows 
   567 makeDependentOfRows
   577     "make myself dependent of any row"
   568     "make myself dependent of any row"
   578     
   569 
   579     list size ~~ 0 ifTrue:[
   570     list size ~~ 0 ifTrue:[
   580         list do:[:aRow | 
   571         list do:[:aRow |
   581             aRow notNil ifTrue:[
   572             aRow notNil ifTrue:[
   582                 aRow addDependent:self
   573                 aRow addDependent:self
   583             ]
   574             ]
   584         ]
   575         ]
   585     ]
   576     ]
   586 !
   577 !
   587 
   578 
   588 makeIndependentOfRows 
   579 makeIndependentOfRows
   589     "make myself independent of any row"
   580     "make myself independent of any row"
   590     
   581 
   591     list size ~~ 0 ifTrue:[
   582     list size ~~ 0 ifTrue:[
   592         list do:[:aRow | 
   583         list do:[:aRow |
   593             aRow notNil ifTrue:[
   584             aRow notNil ifTrue:[
   594                 aRow removeDependent:self
   585                 aRow removeDependent:self
   595             ]
   586             ]
   596         ]
   587         ]
   597     ]
   588     ]
   598 !
   589 !
   599 
   590 
   600 multipleSelectOk
   591 multipleSelectOk
   601     "allow/disallow multiple row selections; the default is false"
   592     "allow/disallow multiple row selections; the default is false"
   602     
   593 
   603     ^ multipleSelectOk
   594     ^ multipleSelectOk
   604 !
   595 !
   605 
   596 
   606 multipleSelectOk:sBoolean 
   597 multipleSelectOk:sBoolean
   607     "allow/disallow multiple row selections; the default is false"
   598     "allow/disallow multiple row selections; the default is false"
   608 
   599 
   609     |colIdx rowIdx|
   600     |colIdx rowIdx|
   610 
   601 
   611     sBoolean == multipleSelectOk ifTrue:[^ self ].
   602     sBoolean == multipleSelectOk ifTrue:[^ self ].
   633 opaqueColumnResize:aBoolean
   624 opaqueColumnResize:aBoolean
   634     labelView opaqueColumnResize:aBoolean
   625     labelView opaqueColumnResize:aBoolean
   635 !
   626 !
   636 
   627 
   637 scrollWhenUpdating
   628 scrollWhenUpdating
   638     "return the scroll behavior, when I get a new text 
   629     "return the scroll behavior, when I get a new text
   639      (via the model or the #contents/#list)
   630      (via the model or the #contents/#list)
   640      Possible returnValues are:
   631      Possible returnValues are:
   641         #keep / nil     -> no change
   632         #keep / nil     -> no change
   642         #endOfText      -> scroll to the end
   633         #endOfText      -> scroll to the end
   643         #beginOfText    -> scroll to the top
   634         #beginOfText    -> scroll to the top
   647 
   638 
   648     ^ scrollWhenUpdating
   639     ^ scrollWhenUpdating
   649 !
   640 !
   650 
   641 
   651 scrollWhenUpdating:aSymbolOrNil
   642 scrollWhenUpdating:aSymbolOrNil
   652     "define how to scroll, when I get a new text 
   643     "define how to scroll, when I get a new text
   653      (via the model or the #contents/#list)
   644      (via the model or the #contents/#list)
   654      Allowed arguments are:
   645      Allowed arguments are:
   655         #keep / nil     -> no change
   646         #keep / nil     -> no change
   656         #endOfText      -> scroll to the end
   647         #endOfText      -> scroll to the end
   657         #beginOfText    -> scroll to the top
   648         #beginOfText    -> scroll to the top
   663 !
   654 !
   664 
   655 
   665 selectRowOnDefault
   656 selectRowOnDefault
   666     "if true, in case of selecting a none selectable cell, the row is selected.
   657     "if true, in case of selecting a none selectable cell, the row is selected.
   667      If false, nothing is selected. The default is true."
   658      If false, nothing is selected. The default is true."
   668     
   659 
   669     ^ selectRowOnDefault
   660     ^ selectRowOnDefault
   670 !
   661 !
   671 
   662 
   672 selectRowOnDefault:aBool 
   663 selectRowOnDefault:aBool
   673     "if true, in case of selecting a none selectable cell, the row is selected.
   664     "if true, in case of selecting a none selectable cell, the row is selected.
   674      If false, nothing is selected. The default is true."
   665      If false, nothing is selected. The default is true."
   675     
   666 
   676     selectRowOnDefault := aBool
   667     selectRowOnDefault := aBool
   677 !
   668 !
   678 
   669 
   679 sortListInPlace
   670 sortListInPlace
   680     "when false (default for backward compatibility): 
   671     "when false (default for backward compatibility):
   681      if sorting, create a copy
   672      if sorting, create a copy
   682      of the list, which is wrong when useIndex is on,
   673      of the list, which is wrong when useIndex is on,
   683      as the application will get the index in the sorted
   674      as the application will get the index in the sorted
   684      list, which is probably different from tha apps list mode.
   675      list, which is probably different from tha apps list mode.
   685      When true (should be default, but that might break many
   676      When true (should be default, but that might break many
   686      users), the passed in list is sorted in place (i.e. possibly
   677      users), the passed in list is sorted in place (i.e. possibly
   687      sorting the application's list)."
   678      sorting the application's list)."
   688      
   679 
   689     ^ sortListInPlace
   680     ^ sortListInPlace
   690 !
   681 !
   691 
   682 
   692 sortListInPlace:aBoolean
   683 sortListInPlace:aBoolean
   693     "when false (default for backward compatibility): 
   684     "when false (default for backward compatibility):
   694      if sorting, create a copy
   685      if sorting, create a copy
   695      of the list, which is wrong when useIndex is on,
   686      of the list, which is wrong when useIndex is on,
   696      as the application will get the index in the sorted
   687      as the application will get the index in the sorted
   697      list, which is probably different from tha apps list mode.
   688      list, which is probably different from tha apps list mode.
   698      When true (should be default, but that might break many
   689      When true (should be default, but that might break many
   699      users), the passed in list is sorted in place (i.e. possibly
   690      users), the passed in list is sorted in place (i.e. possibly
   700      sorting the application's list)."
   691      sorting the application's list)."
   701      
   692 
   702     sortListInPlace := aBoolean.
   693     sortListInPlace := aBoolean.
   703 !
   694 !
   704 
   695 
   705 tabIntern
   696 tabIntern
   706     "returns true if tabing is supported in the widget"
   697     "returns true if tabing is supported in the widget"
   707     
   698 
   708     ^ tabIntern
   699     ^ tabIntern
   709 !
   700 !
   710 
   701 
   711 tabIntern:aBool 
   702 tabIntern:aBool
   712     "returns true if tabing is supported in the widget"
   703     "returns true if tabing is supported in the widget"
   713     
   704 
   714     tabIntern := aBool ? true
   705     tabIntern := aBool ? true
   715 !
   706 !
   716 
   707 
   717 updateListHolderWhenSorting
   708 updateListHolderWhenSorting
   718     "return true if the the listHolder's value are be updated,
   709     "return true if the the listHolder's value are be updated,
   719      when I sort a list.
   710      when I sort a list.
   720      By default, this is false so it must be set explicitly
   711      By default, this is false so it must be set explicitly
   721      (for bug-backward compatibility,
   712      (for bug-backward compatibility,
   722      and to avoid introducing new side effects)."
   713      and to avoid introducing new side effects)."
   723 
   714 
   724     ^ updateListHolderWhenSorting 
   715     ^ updateListHolderWhenSorting
   725 !
   716 !
   726 
   717 
   727 updateListHolderWhenSorting:aBoolean
   718 updateListHolderWhenSorting:aBoolean
   728     "define if the the listHolder's value should be updated,
   719     "define if the the listHolder's value should be updated,
   729      when I sort a list.
   720      when I sort a list.
   735 !
   726 !
   736 
   727 
   737 useIndex
   728 useIndex
   738     "specify, if the selected components value or its index in the
   729     "specify, if the selected components value or its index in the
   739      list should be sent to the model. The default is its index."
   730      list should be sent to the model. The default is its index."
   740     
   731 
   741     ^ useIndex
   732     ^ useIndex
   742 !
   733 !
   743 
   734 
   744 useIndex:aBool 
   735 useIndex:aBool
   745     "specify, if the selected components value or its index in the
   736     "specify, if the selected components value or its index in the
   746      list should be sent to the model. The default is its index."
   737      list should be sent to the model. The default is its index."
   747     
   738 
   748     useIndex := aBool
   739     useIndex := aBool
   749 ! !
   740 ! !
   750 
   741 
   751 !DSVColumnView methodsFor:'accessing-channels'!
   742 !DSVColumnView methodsFor:'accessing-channels'!
   752 
   743 
   764 
   755 
   765 !DSVColumnView methodsFor:'accessing-color & font'!
   756 !DSVColumnView methodsFor:'accessing-color & font'!
   766 
   757 
   767 backgroundColor
   758 backgroundColor
   768     "get the background color of the rows"
   759     "get the background color of the rows"
   769     
   760 
   770     ^ bgColor
   761     ^ bgColor
   771 !
   762 !
   772 
   763 
   773 backgroundColor:aColor 
   764 backgroundColor:aColor
   774     "set the background color of the rows"
   765     "set the background color of the rows"
   775     
   766 
   776     bgColor ~~ aColor ifTrue:[
   767     bgColor ~~ aColor ifTrue:[
   777         super viewBackground:bgColor.
   768         super viewBackground:bgColor.
   778         self realized ifTrue:[
   769         self realized ifTrue:[
   779             bgColor := aColor onDevice:device.
   770             bgColor := aColor onDevice:device.
   780             self invalidate
   771             self invalidate
   784     ]
   775     ]
   785 !
   776 !
   786 
   777 
   787 foregroundColor
   778 foregroundColor
   788     "return the foreground color of the rows"
   779     "return the foreground color of the rows"
   789     
   780 
   790     ^ fgColor
   781     ^ fgColor
   791 !
   782 !
   792 
   783 
   793 foregroundColor:aColor 
   784 foregroundColor:aColor
   794     "set the foreground color of the rows"
   785     "set the foreground color of the rows"
   795     
   786 
   796     fgColor ~~ aColor ifTrue:[
   787     fgColor ~~ aColor ifTrue:[
   797         self realized ifTrue:[
   788         self realized ifTrue:[
   798             fgColor := aColor onDevice:device.
   789             fgColor := aColor onDevice:device.
   799             self invalidate
   790             self invalidate
   800         ] ifFalse:[
   791         ] ifFalse:[
   803     ]
   794     ]
   804 !
   795 !
   805 
   796 
   806 labelBackgroundColor
   797 labelBackgroundColor
   807     "get the background color of the label row"
   798     "get the background color of the label row"
   808     
   799 
   809     ^ labelBgColor ? bgColor
   800     ^ labelBgColor ? bgColor
   810 !
   801 !
   811 
   802 
   812 labelForegroundColor
   803 labelForegroundColor
   813     "get the foreground color of the label row"
   804     "get the foreground color of the label row"
   814     
   805 
   815     ^ labelFgColor ? fgColor
   806     ^ labelFgColor ? fgColor
   816 !
   807 !
   817 
   808 
   818 selectionBackgroundColor
   809 selectionBackgroundColor
   819     "returns the background color of a selected row"
   810     "returns the background color of a selected row"
   820     
   811 
   821     self hasFocus ifTrue:[
   812     self hasFocus ifTrue:[
   822         ^ selectionBackgroundColor
   813         ^ selectionBackgroundColor
   823     ].
   814     ].
   824     ^ selectionBackgroundColorNoFocus.
   815     ^ selectionBackgroundColorNoFocus.
   825 !
   816 !
   844     "Created: / 20-01-2011 / 08:45:08 / cg"
   835     "Created: / 20-01-2011 / 08:45:08 / cg"
   845 !
   836 !
   846 
   837 
   847 separatorDarkColor
   838 separatorDarkColor
   848     "returns the dark color used for drawing a shadowed separator (3D)"
   839     "returns the dark color used for drawing a shadowed separator (3D)"
   849     
   840 
   850     ^ shadowColor
   841     ^ shadowColor
   851 !
   842 !
   852 
   843 
   853 separatorLightColor
   844 separatorLightColor
   854     "returns the light color used for drawing a shadowed separator (3D)"
   845     "returns the light color used for drawing a shadowed separator (3D)"
   855     
   846 
   856     ^ lightColor
   847     ^ lightColor
   857 !
   848 !
   858 
   849 
   859 separatorOneDColor
   850 separatorOneDColor
   860     "returns the color used for drawing a oneD separator"
   851     "returns the color used for drawing a oneD separator"
   861     
   852 
   862     separatorOneDColor isNil ifTrue:[
   853     separatorOneDColor isNil ifTrue:[
   863         ^ fgColor
   854         ^ fgColor
   864     ].
   855     ].
   865     ^ separatorOneDColor
   856     ^ separatorOneDColor
   866 !
   857 !
   867 
   858 
   868 separatorOneDColor:aColorOrNil 
   859 separatorOneDColor:aColorOrNil
   869     "set the color used for drawing a oneD separator; if the color
   860     "set the color used for drawing a oneD separator; if the color
   870      is nil, the current forgroundColor is used"
   861      is nil, the current forgroundColor is used"
   871     
   862 
   872     separatorOneDColor = aColorOrNil ifTrue:[
   863     separatorOneDColor = aColorOrNil ifTrue:[
   873         ^ self
   864         ^ self
   874     ].
   865     ].
   875     separatorOneDColor := aColorOrNil.
   866     separatorOneDColor := aColorOrNil.
   876     self realized ifTrue:[
   867     self realized ifTrue:[
   883 
   874 
   884 !DSVColumnView methodsFor:'accessing-columns'!
   875 !DSVColumnView methodsFor:'accessing-columns'!
   885 
   876 
   886 columnAt:anIndex
   877 columnAt:anIndex
   887     <resource: #obsolete>
   878     <resource: #obsolete>
   888  
   879 
   889     "returns the column at an index"
   880     "returns the column at an index"
   890 
   881 
   891     self obsoleteMethodWarning:'use columnDescriptorAt:'.
   882     self obsoleteMethodWarning:'use columnDescriptorAt:'.
   892     ^ self columnDescriptorAt:anIndex
   883     ^ self columnDescriptorAt:anIndex
   893 !
   884 !
   894 
   885 
   895 columnDescriptorAt:anIndex 
   886 columnDescriptorAt:anIndex
   896     "returns the columnDescriptor at an index"
   887     "returns the columnDescriptor at an index"
   897     
   888 
   898     ^ columnDescriptors at:anIndex ifAbsent:nil
   889     ^ columnDescriptors at:anIndex ifAbsent:nil
   899 !
   890 !
   900 
   891 
   901 columnDescriptors
   892 columnDescriptors
   902     "returns list of column descriptors"
   893     "returns list of column descriptors"
   903     
   894 
   904     ^ columnDescriptors collect:[:aCol | aCol description ]
   895     ^ columnDescriptors collect:[:aCol | aCol description ]
   905 !
   896 !
   906 
   897 
   907 columnDescriptors:aColumnDescriptionList 
   898 columnDescriptors:aColumnDescriptionList
   908     "set the columnDescriptors; 
   899     "set the columnDescriptors;
   909      scroll to top and deselect"
   900      scroll to top and deselect"
   910     
   901 
   911     self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:true
   902     self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:true
   912 
   903 
   913     "Modified: / 13-09-2017 / 15:05:05 / cg"
   904     "Modified: / 13-09-2017 / 15:05:05 / cg"
   914 !
   905 !
   915 
   906 
   916 columnDescriptors:aColumnDescriptionList deselect:deselect scrollToTop:scrollToTop 
   907 columnDescriptors:aColumnDescriptionList deselect:deselect scrollToTop:scrollToTop
   917     "set the columnDescriptors; 
   908     "set the columnDescriptors;
   918      if deselect is true, then deselect;
   909      if deselect is true, then deselect;
   919      if scrollToTop is true, then scroll to top;
   910      if scrollToTop is true, then scroll to top;
   920      otherwise, take the current selection and try to make it visible"
   911      otherwise, take the current selection and try to make it visible"
   921     
   912 
   922     |delta indexOfFirstRow|
   913     |delta indexOfFirstRow|
   923 
   914 
   924     deselect ifTrue:[
   915     deselect ifTrue:[
   925         self deselect.
   916         self deselect.
   926     ].
   917     ].
   927     
   918 
   928     (viewOrigin x ~~ 0 or:[ viewOrigin y ~~ 0 ]) ifTrue:[
   919     (viewOrigin x ~~ 0 or:[ viewOrigin y ~~ 0 ]) ifTrue:[
   929         scrollToTop ifTrue:[
   920         scrollToTop ifTrue:[
   930             delta := viewOrigin negated.
   921             delta := viewOrigin negated.
   931             viewOrigin := 0 @ 0.
   922             viewOrigin := 0 @ 0.
   932             self originChanged:delta
   923             self originChanged:delta
   933         ] ifFalse:[
   924         ] ifFalse:[
   934             indexOfFirstRow := self yVisibleToRowNr:0.
   925             indexOfFirstRow := self yVisibleToRowNr:0.
   935         ].
   926         ].
   936     ].
   927     ].
   937     self setColumnDescriptors:aColumnDescriptionList.
   928     self setColumnDescriptors:aColumnDescriptionList.
   938     
   929 
   939     indexOfFirstRow notNil ifTrue:[
   930     indexOfFirstRow notNil ifTrue:[
   940         self scrollToRowAt:indexOfFirstRow colAt:1.
   931         self scrollToRowAt:indexOfFirstRow colAt:1.
   941     ].
   932     ].
   942 
   933 
   943     "Created: / 13-09-2017 / 15:04:50 / cg"
   934     "Created: / 13-09-2017 / 15:04:50 / cg"
   944 !
   935 !
   945 
   936 
   946 columnDescriptors:aColumnDescriptionList scrollToTop:scrollToTop 
   937 columnDescriptors:aColumnDescriptionList scrollToTop:scrollToTop
   947     "set the columnDescriptors and deselect; 
   938     "set the columnDescriptors and deselect;
   948      if scrollToTop is true, then scroll to top;
   939      if scrollToTop is true, then scroll to top;
   949      otherwise, take the current selection and try to make it visible"
   940      otherwise, take the current selection and try to make it visible"
   950     
   941 
   951     self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:scrollToTop
   942     self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:scrollToTop
   952 
   943 
   953     "Created: / 13-09-2017 / 15:03:15 / cg"
   944     "Created: / 13-09-2017 / 15:03:15 / cg"
   954 !
   945 !
   955 
   946 
   956 dataSetColumns
   947 dataSetColumns
   957     "returns the list of DataSetColumns; each column represents a DataSetColumnSpec"
   948     "returns the list of DataSetColumns; each column represents a DataSetColumnSpec"
   958     
   949 
   959     ^ columnDescriptors
   950     ^ columnDescriptors
   960 !
   951 !
   961 
   952 
   962 firstColumn
   953 firstColumn
   963     "returns the first column"
   954     "returns the first column"
   964     
   955 
   965     ^ columnDescriptors at:1
   956     ^ columnDescriptors at:1
   966 !
   957 !
   967 
   958 
   968 lastColumn
   959 lastColumn
   969     "returns the last column"
   960     "returns the last column"
   970     
   961 
   971     ^ columnDescriptors last
   962     ^ columnDescriptors last
   972 !
   963 !
   973 
   964 
   974 setColumnDescriptors:aColumnDescriptionList
   965 setColumnDescriptors:aColumnDescriptionList
   975     "set the columnDescriptors; don't deselect and do not scroll to top"
   966     "set the columnDescriptors; don't deselect and do not scroll to top"
   976     
   967 
   977     |cid|
   968     |cid|
   978 
   969 
   979     cid := 0.
   970     cid := 0.
   980 
   971 
   981     aColumnDescriptionList isEmptyOrNil ifTrue:[
   972     aColumnDescriptionList isEmptyOrNil ifTrue:[
   982         columnDescriptors := OrderedCollection new.
   973         columnDescriptors := OrderedCollection new.
   983     ] ifFalse:[
   974     ] ifFalse:[
   984         columnDescriptors := aColumnDescriptionList 
   975         columnDescriptors := aColumnDescriptionList
   985             collect:
   976             collect:
   986                 [:el||dsc lbl|
   977                 [:el||dsc lbl|
   987                     dsc := el isSequenceable 
   978                     dsc := el isSequenceable
   988                                 ifTrue:[DataSetColumnSpec decodeFromLiteralArray:el]
   979                                 ifTrue:[DataSetColumnSpec decodeFromLiteralArray:el]
   989                                 ifFalse:[el].
   980                                 ifFalse:[el].
   990                     cid := cid + 1.
   981                     cid := cid + 1.
   991                     lbl := DataSetLabel new description:dsc builder:builder on:labelView.
   982                     lbl := DataSetLabel new description:dsc builder:builder on:labelView.
   992                     DataSetColumn new on:self description:dsc columnNumber:cid label:lbl
   983                     DataSetColumn new on:self description:dsc columnNumber:cid label:lbl
  1008     ^ checkToggleActiveImage
   999     ^ checkToggleActiveImage
  1009 !
  1000 !
  1010 
  1001 
  1011 checkToggleExtent
  1002 checkToggleExtent
  1012     "returns the extent of a checkToggle"
  1003     "returns the extent of a checkToggle"
  1013     
  1004 
  1014     ^ checkToggleExtent
  1005     ^ checkToggleExtent
  1015 !
  1006 !
  1016 
  1007 
  1017 checkToggleForm
  1008 checkToggleForm
  1018     "returns the form of a checkToggle"
  1009     "returns the form of a checkToggle"
  1019     
  1010 
  1020     ^ checkToggleForm
  1011     ^ checkToggleForm
  1021 !
  1012 !
  1022 
  1013 
  1023 checkToggleLevel
  1014 checkToggleLevel
  1024     "returns the level of a checkToggle button"
  1015     "returns the level of a checkToggle button"
  1025     
  1016 
  1026     ^ checkToggleLevel
  1017     ^ checkToggleLevel
  1027 !
  1018 !
  1028 
  1019 
  1029 checkTogglePassiveImage
  1020 checkTogglePassiveImage
  1030     ^ checkTogglePassiveImage
  1021     ^ checkTogglePassiveImage
  1031 !
  1022 !
  1032 
  1023 
  1033 comboButtonExtent
  1024 comboButtonExtent
  1034     "returns the extent of a comboList or -Box"
  1025     "returns the extent of a comboList or -Box"
  1035     
  1026 
  1036     ^ comboButtonExtent
  1027     ^ comboButtonExtent
  1037 !
  1028 !
  1038 
  1029 
  1039 comboButtonForm
  1030 comboButtonForm
  1040     "returns the form of a comboList or -Box"
  1031     "returns the form of a comboList or -Box"
  1041     
  1032 
  1042     ^ comboButtonForm
  1033     ^ comboButtonForm
  1043 !
  1034 !
  1044 
  1035 
  1045 comboButtonLevel
  1036 comboButtonLevel
  1046     "returns the level of a comboList or -Box button"
  1037     "returns the level of a comboList or -Box button"
  1047     
  1038 
  1048     ^ comboButtonLevel
  1039     ^ comboButtonLevel
  1049 !
  1040 !
  1050 
  1041 
  1051 radioButtonExtent
  1042 radioButtonExtent
  1052     "returns the extent of a radio button"
  1043     "returns the extent of a radio button"
  1053     
  1044 
  1054     ^ radioButtonActiveImage extent
  1045     ^ radioButtonActiveImage extent
  1055 !
  1046 !
  1056 
  1047 
  1057 rowSelectorExtent
  1048 rowSelectorExtent
  1058     "returns the bitmap of a selected row"
  1049     "returns the bitmap of a selected row"
  1059     
  1050 
  1060     ^ rowSelectorForm extent
  1051     ^ rowSelectorForm extent
  1061 !
  1052 !
  1062 
  1053 
  1063 rowSelectorForm
  1054 rowSelectorForm
  1064     "returns the (arrow-) image shown for a selected row.
  1055     "returns the (arrow-) image shown for a selected row.
  1065      (the arrow shown in the first column)"
  1056      (the arrow shown in the first column)"
  1066     
  1057 
  1067     ^ rowSelectorForm
  1058     ^ rowSelectorForm
  1068 ! !
  1059 ! !
  1069 
  1060 
  1070 !DSVColumnView methodsFor:'accessing-mvc'!
  1061 !DSVColumnView methodsFor:'accessing-mvc'!
  1071 
  1062 
  1072 columnAdaptor
  1063 columnAdaptor
  1073     "return the value of the instance variable 'columnAdaptor' (automatically generated)"
  1064     "return the value of the instance variable 'columnAdaptor' (automatically generated)"
  1074     
  1065 
  1075     columnAdaptor isValueModel ifTrue:[
  1066     columnAdaptor isValueModel ifTrue:[
  1076         ^ columnAdaptor value
  1067         ^ columnAdaptor value
  1077     ].
  1068     ].
  1078     ^ columnAdaptor
  1069     ^ columnAdaptor
  1079 !
  1070 !
  1089     ].
  1080     ].
  1090 !
  1081 !
  1091 
  1082 
  1092 columnHolder
  1083 columnHolder
  1093     "get the valueHolder, which keeps the list of column descriptions"
  1084     "get the valueHolder, which keeps the list of column descriptions"
  1094     
  1085 
  1095     ^ columnHolder
  1086     ^ columnHolder
  1096 !
  1087 !
  1097 
  1088 
  1098 columnHolder:aValueHolder 
  1089 columnHolder:aValueHolder
  1099     "set the valueHolder, which keeps the list of column descriptions"
  1090     "set the valueHolder, which keeps the list of column descriptions"
  1100     
  1091 
  1101     |columns|
  1092     |columns|
  1102 
  1093 
  1103     columnHolder notNil ifTrue:[
  1094     columnHolder notNil ifTrue:[
  1104         columnHolder removeDependent:self
  1095         columnHolder removeDependent:self
  1105     ].
  1096     ].
  1110             self columnDescriptors:columns
  1101             self columnDescriptors:columns
  1111         ]
  1102         ]
  1112     ].
  1103     ].
  1113 !
  1104 !
  1114 
  1105 
  1115 listAt:index put:newElement 
  1106 listAt:index put:newElement
  1116     "kludge callback, when an element hs to be replaced
  1107     "kludge callback, when an element hs to be replaced
  1117      due to a col-adaptor returning a new row element"
  1108      due to a col-adaptor returning a new row element"
  1118     
  1109 
  1119     |list|
  1110     |list|
  1120 
  1111 
  1121     (list := listHolder value) notNil ifTrue:[
  1112     (list := listHolder value) notNil ifTrue:[
  1122         list at:index put:newElement
  1113         list at:index put:newElement
  1123     ]
  1114     ]
  1124 !
  1115 !
  1125 
  1116 
  1126 listHolder
  1117 listHolder
  1127     "get the valueHolder which holds the list of rows"
  1118     "get the valueHolder which holds the list of rows"
  1128     
  1119 
  1129     ^ listHolder
  1120     ^ listHolder
  1130 !
  1121 !
  1131 
  1122 
  1132 listHolder:aListHolder 
  1123 listHolder:aListHolder
  1133     "set the valueHolder which holds the list of rows"
  1124     "set the valueHolder which holds the list of rows"
  1134     
  1125 
  1135     listHolder ~~ aListHolder ifTrue:[
  1126     listHolder ~~ aListHolder ifTrue:[
  1136         listHolder notNil ifTrue:[
  1127         listHolder notNil ifTrue:[
  1137             listHolder removeDependent:self
  1128             listHolder removeDependent:self
  1138         ].
  1129         ].
  1139         (listHolder := aListHolder) notNil ifTrue:[
  1130         (listHolder := aListHolder) notNil ifTrue:[
  1141         ]
  1132         ]
  1142     ].
  1133     ].
  1143     self pushEvent:#list: with:(listHolder value).
  1134     self pushEvent:#list: with:(listHolder value).
  1144 !
  1135 !
  1145 
  1136 
  1146 model:aModel 
  1137 model:aModel
  1147     "set the valueHolder which holds the selection and maybe the list of rows"
  1138     "set the valueHolder which holds the selection and maybe the list of rows"
  1148     
  1139 
  1149     model notNil ifTrue:[
  1140     model notNil ifTrue:[
  1150         model removeDependent:self.
  1141         model removeDependent:self.
  1151         (model respondsTo:#list) ifTrue:[
  1142         (model respondsTo:#list) ifTrue:[
  1152             (model list == listHolder) ifTrue:[
  1143             (model list == listHolder) ifTrue:[
  1153                 self listHolder:nil
  1144                 self listHolder:nil
  1184     ^ row
  1175     ^ row
  1185 
  1176 
  1186     "Modified: / 22-01-2011 / 09:14:48 / cg"
  1177     "Modified: / 22-01-2011 / 09:14:48 / cg"
  1187 !
  1178 !
  1188 
  1179 
  1189 at:aRowNr ifAbsent:exceptionBlock 
  1180 at:aRowNr ifAbsent:exceptionBlock
  1190     "return the row at a aRowNr. If the index is invalid, return the
  1181     "return the row at a aRowNr. If the index is invalid, return the
  1191      result of evaluating the exceptionblock"
  1182      result of evaluating the exceptionblock"
  1192     
  1183 
  1193     (aRowNr between:1 and:list size) ifTrue:[
  1184     (aRowNr between:1 and:list size) ifTrue:[
  1194         ^ self at:aRowNr
  1185         ^ self at:aRowNr
  1195     ].
  1186     ].
  1196     ^ exceptionBlock value
  1187     ^ exceptionBlock value
  1197 !
  1188 !
  1198 
  1189 
  1199 at:aRowNr put:aRow 
  1190 at:aRowNr put:aRow
  1200     "change the row at an index. The added row is returned"
  1191     "change the row at an index. The added row is returned"
  1201     
  1192 
  1202     lockRowIndex ~~ aRowNr ifTrue:[
  1193     lockRowIndex ~~ aRowNr ifTrue:[
  1203         (aRowNr <= list size and:[ (list at:aRowNr) == aRow ]) ifTrue:[
  1194         (aRowNr <= list size and:[ (list at:aRowNr) == aRow ]) ifTrue:[
  1204             self invalidateRowAt:aRowNr
  1195             self invalidateRowAt:aRowNr
  1205         ] ifFalse:[
  1196         ] ifFalse:[
  1206             self 
  1197             self
  1207                 replaceFrom:aRowNr
  1198                 replaceFrom:aRowNr
  1208                 to:aRowNr
  1199                 to:aRowNr
  1209                 with:(Array with:aRow)
  1200                 with:(Array with:aRow)
  1210                 startingAt:1.
  1201                 startingAt:1.
  1211         ]
  1202         ]
  1213     ^ aRow
  1204     ^ aRow
  1214 !
  1205 !
  1215 
  1206 
  1216 first
  1207 first
  1217     "return the first row"
  1208     "return the first row"
  1218     
  1209 
  1219     ^ self at:1
  1210     ^ self at:1
  1220 !
  1211 !
  1221 
  1212 
  1222 identityIndexOfRow:aRow 
  1213 identityIndexOfRow:aRow
  1223     "returns index of a row or 0"
  1214     "returns index of a row or 0"
  1224     
  1215 
  1225     (list size ~~ 0 and:[ aRow notNil ]) ifTrue:[
  1216     (list size ~~ 0 and:[ aRow notNil ]) ifTrue:[
  1226         ^ list identityIndexOf:aRow
  1217         ^ list identityIndexOf:aRow
  1227     ].
  1218     ].
  1228     ^ 0
  1219     ^ 0
  1229 !
  1220 !
  1230 
  1221 
  1231 last
  1222 last
  1232     "return the last row"
  1223     "return the last row"
  1233     
  1224 
  1234     ^ self at:(list size)
  1225     ^ self at:(list size)
  1235 !
  1226 !
  1236 
  1227 
  1237 list
  1228 list
  1238     "get the list of rows"
  1229     "get the list of rows"
  1239     
  1230 
  1240     ^ list
  1231     ^ list
  1241 !
  1232 !
  1242 
  1233 
  1243 list:aRawList
  1234 list:aRawList
  1244     "set the list of rows"
  1235     "set the list of rows"
  1255     selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0].
  1246     selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0].
  1256 
  1247 
  1257     shown ifFalse:[
  1248     shown ifFalse:[
  1258         cachedPreferredExtent := nil
  1249         cachedPreferredExtent := nil
  1259     ] ifTrue:[
  1250     ] ifTrue:[
  1260         aRawList size == 0 ifTrue:[  
  1251         aRawList size == 0 ifTrue:[
  1261             "/ keep old column-width information
  1252             "/ keep old column-width information
  1262         ] ifFalse:[
  1253         ] ifFalse:[
  1263             columnDescriptors notNil ifTrue:[
  1254             columnDescriptors notNil ifTrue:[
  1264                 columnDescriptors do:[:aCol| aCol invalidate ].
  1255                 columnDescriptors do:[:aCol| aCol invalidate ].
  1265             ].
  1256             ].
  1299             labelView reverseSort ifTrue:[
  1290             labelView reverseSort ifTrue:[
  1300                 newList reverse.
  1291                 newList reverse.
  1301             ].
  1292             ].
  1302         ].
  1293         ].
  1303         list := newList.
  1294         list := newList.
  1304         
  1295 
  1305         sortListInPlace ifFalse:[
  1296         sortListInPlace ifFalse:[
  1306             listHolder notNil ifTrue:[
  1297             listHolder notNil ifTrue:[
  1307                 updateListHolderWhenSorting ifTrue:[
  1298                 updateListHolderWhenSorting ifTrue:[
  1308                     listHolder value:newList withoutNotifying:self.
  1299                     listHolder value:newList withoutNotifying:self.
  1309                 ].
  1300                 ].
  1310             ].
  1301             ].
  1311         ].
  1302         ].
  1312         
  1303 
  1313         beDependentOfRows ifTrue:[
  1304         beDependentOfRows ifTrue:[
  1314             self makeDependentOfRows
  1305             self makeDependentOfRows
  1315         ].
  1306         ].
  1316     ].
  1307     ].
  1317 
  1308 
  1329     "Modified: / 08-11-2010 / 22:07:49 / cg"
  1320     "Modified: / 08-11-2010 / 22:07:49 / cg"
  1330 ! !
  1321 ! !
  1331 
  1322 
  1332 !DSVColumnView methodsFor:'accessing-visibility'!
  1323 !DSVColumnView methodsFor:'accessing-visibility'!
  1333 
  1324 
  1334 font:aFont 
  1325 font:aFont
  1335     "set the font for all shown rows."
  1326     "set the font for all shown rows."
  1336     |newGCFont|
  1327     |newGCFont|
  1337 
  1328 
  1338     (aFont isNil or:[aFont = self font]) ifTrue:[
  1329     (aFont isNil or:[aFont = self font]) ifTrue:[
  1339         ^ self
  1330         ^ self
  1340     ].
  1331     ].
  1341     
  1332 
  1342     columnDescriptors isEmptyOrNil ifTrue:[
  1333     columnDescriptors isEmptyOrNil ifTrue:[
  1343         super font:aFont.
  1334         super font:aFont.
  1344         self labelView font:aFont.
  1335         self labelView font:aFont.
  1345         rowFontAscent := self font ascent.
  1336         rowFontAscent := self font ascent.
  1346         rowHeight     := verticalSpacing + (self font height) + verticalSpacing + separatorSize.
  1337         rowHeight     := verticalSpacing + (self font height) + verticalSpacing + separatorSize.
  1391             ].
  1382             ].
  1392         ].
  1383         ].
  1393     ].
  1384     ].
  1394 
  1385 
  1395     super font:newGCFont.
  1386     super font:newGCFont.
  1396     
  1387 
  1397     rowFontAscent := self font ascent.
  1388     rowFontAscent := self font ascent.
  1398     rowHeight     := verticalSpacing + self font height + verticalSpacing + separatorSize.
  1389     rowHeight     := verticalSpacing + self font height + verticalSpacing + separatorSize.
  1399     minRowHeight  := rowHeight.
  1390     minRowHeight  := rowHeight.
  1400 
  1391 
  1401     columnDescriptors do:[:eachColumn| eachColumn invalidate].
  1392     columnDescriptors do:[:eachColumn| eachColumn invalidate].
  1418     "Modified (format): / 13-09-2017 / 15:34:22 / cg"
  1409     "Modified (format): / 13-09-2017 / 15:34:22 / cg"
  1419 !
  1410 !
  1420 
  1411 
  1421 has3Dseparators
  1412 has3Dseparators
  1422     "returns true if shown in 3D mode"
  1413     "returns true if shown in 3D mode"
  1423     
  1414 
  1424     ^ separatorSize ~~ 1
  1415     ^ separatorSize ~~ 1
  1425 !
  1416 !
  1426 
  1417 
  1427 has3Dseparators:aBool 
  1418 has3Dseparators:aBool
  1428     "enable or disable 3D mode"
  1419     "enable or disable 3D mode"
  1429     
  1420 
  1430     |newSepSize|
  1421     |newSepSize|
  1431 
  1422 
  1432     newSepSize := aBool ifTrue:[2] ifFalse:[1].
  1423     newSepSize := aBool ifTrue:[2] ifFalse:[1].
  1433     newSepSize ~~ separatorSize ifTrue:[
  1424     newSepSize ~~ separatorSize ifTrue:[
  1434         separatorSize := newSepSize.
  1425         separatorSize := newSepSize.
  1435         realized ifTrue:[
  1426         realized ifTrue:[
  1436             columnDescriptors do:[:aCol | 
  1427             columnDescriptors do:[:aCol |
  1437                 aCol invalidate
  1428                 aCol invalidate
  1438             ].
  1429             ].
  1439             self preferredExtentChanged.
  1430             self preferredExtentChanged.
  1440             self invalidate.
  1431             self invalidate.
  1441             self contentsChanged
  1432             self contentsChanged
  1443     ]
  1434     ]
  1444 !
  1435 !
  1445 
  1436 
  1446 horizontalSpacing
  1437 horizontalSpacing
  1447     "horizontal spacing used by columns"
  1438     "horizontal spacing used by columns"
  1448     
  1439 
  1449     ^ horizontalSpacing
  1440     ^ horizontalSpacing
  1450 !
  1441 !
  1451 
  1442 
  1452 horizontalSpacing:aNumber 
  1443 horizontalSpacing:aNumber
  1453     "horizontal spacing used by columns"
  1444     "horizontal spacing used by columns"
  1454     
  1445 
  1455     horizontalSpacing ~~ aNumber ifTrue:[
  1446     horizontalSpacing ~~ aNumber ifTrue:[
  1456         horizontalSpacing := aNumber.
  1447         horizontalSpacing := aNumber.
  1457         self preferredExtentChanged.
  1448         self preferredExtentChanged.
  1458     ].
  1449     ].
  1459 !
  1450 !
  1460 
  1451 
  1461 showLabels
  1452 showLabels
  1462     "control the labels view to be visible or unvisible"
  1453     "control the labels view to be visible or unvisible"
  1463     
  1454 
  1464     ^ labelView isVisible
  1455     ^ labelView isVisible
  1465 !
  1456 !
  1466 
  1457 
  1467 showLabels:aBoolean 
  1458 showLabels:aBoolean
  1468     "control the labels view to be visible or unvisible"
  1459     "control the labels view to be visible or unvisible"
  1469     
  1460 
  1470     labelView isVisible:aBoolean
  1461     labelView isVisible:aBoolean
  1471 
  1462 
  1472     "Modified (format): / 04-02-2017 / 21:31:43 / cg"
  1463     "Modified (format): / 04-02-2017 / 21:31:43 / cg"
  1473 !
  1464 !
  1474 
  1465 
  1475 verticalSpacing
  1466 verticalSpacing
  1476     "vertical spacing used by columns"
  1467     "vertical spacing used by columns"
  1477     
  1468 
  1478     ^ verticalSpacing
  1469     ^ verticalSpacing
  1479 !
  1470 !
  1480 
  1471 
  1481 verticalSpacing:aNumber 
  1472 verticalSpacing:aNumber
  1482     "vertical spacing used by columns"
  1473     "vertical spacing used by columns"
  1483     
  1474 
  1484     verticalSpacing ~~ aNumber ifTrue:[
  1475     verticalSpacing ~~ aNumber ifTrue:[
  1485         verticalSpacing := aNumber.
  1476         verticalSpacing := aNumber.
  1486         self preferredExtentChanged.
  1477         self preferredExtentChanged.
  1487     ].
  1478     ].
  1488 ! !
  1479 ! !
  1489 
  1480 
  1490 !DSVColumnView methodsFor:'adding & removing rows'!
  1481 !DSVColumnView methodsFor:'adding & removing rows'!
  1491 
  1482 
  1492 add:aRow 
  1483 add:aRow
  1493     "insert row at end"
  1484     "insert row at end"
  1494     
  1485 
  1495     ^ self add:aRow beforeIndex:(1 + list size)
  1486     ^ self add:aRow beforeIndex:(1 + list size)
  1496 !
  1487 !
  1497 
  1488 
  1498 add:aRow afterIndex:aRowNr 
  1489 add:aRow afterIndex:aRowNr
  1499     "add a new row after slot aRowNr and redisplay; returns nil in case
  1490     "add a new row after slot aRowNr and redisplay; returns nil in case
  1500      of an invalid index or the row"
  1491      of an invalid index or the row"
  1501     
  1492 
  1502     ^ self add:aRow beforeIndex:(aRowNr + 1)
  1493     ^ self add:aRow beforeIndex:(aRowNr + 1)
  1503 !
  1494 !
  1504 
  1495 
  1505 add:aRow beforeIndex:aRowNr 
  1496 add:aRow beforeIndex:aRowNr
  1506     "add a new row before slot aRowNr and redisplay; returns nil in case
  1497     "add a new row before slot aRowNr and redisplay; returns nil in case
  1507      of an invalid index or the row"
  1498      of an invalid index or the row"
  1508     
  1499 
  1509     self addAll:(Array with:aRow) beforeIndex:aRowNr.
  1500     self addAll:(Array with:aRow) beforeIndex:aRowNr.
  1510     ^ aRow.
  1501     ^ aRow.
  1511 !
  1502 !
  1512 
  1503 
  1513 addAll:aList beforeIndex:start
  1504 addAll:aList beforeIndex:start
  1569 
  1560 
  1570     (y1 > margin and:[y0 < h]) ifTrue:[
  1561     (y1 > margin and:[y0 < h]) ifTrue:[
  1571         "/ cg: if I have a non-solid background color,
  1562         "/ cg: if I have a non-solid background color,
  1572         "/ or individual items have a bgColor selector,
  1563         "/ or individual items have a bgColor selector,
  1573         "/ invalidate the area (and readraw) instead of a scroll.
  1564         "/ invalidate the area (and readraw) instead of a scroll.
  1574         (viewBackground isImageOrForm 
  1565         (viewBackground isImageOrForm
  1575         or:[ self anyColumnHasPotentialNonConstantBackground ])
  1566         or:[ self anyColumnHasPotentialNonConstantBackground ])
  1576         ifTrue:[
  1567         ifTrue:[
  1577             "/ do not scroll but invalidate ...
  1568             "/ do not scroll but invalidate ...
  1578             self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
  1569             self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
  1579         ] ifFalse:[
  1570         ] ifFalse:[
  1593     (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
  1584     (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
  1594         self scrollToBottom.
  1585         self scrollToBottom.
  1595     ].
  1586     ].
  1596 !
  1587 !
  1597 
  1588 
  1598 addFirst:aRow 
  1589 addFirst:aRow
  1599     "insert a row at start"
  1590     "insert a row at start"
  1600     
  1591 
  1601     ^ self add:aRow beforeIndex:1
  1592     ^ self add:aRow beforeIndex:1
  1602 !
  1593 !
  1603 
  1594 
  1604 remove:aRow 
  1595 remove:aRow
  1605     "remove a row"
  1596     "remove a row"
  1606     
  1597 
  1607     |idx|
  1598     |idx|
  1608 
  1599 
  1609     idx := list identityIndexOf:aRow.
  1600     idx := list identityIndexOf:aRow.
  1610     idx ~~ 0 ifTrue:[
  1601     idx ~~ 0 ifTrue:[
  1611         self removeFrom:idx to:idx.
  1602         self removeFrom:idx to:idx.
  1613     ^ aRow
  1604     ^ aRow
  1614 !
  1605 !
  1615 
  1606 
  1616 removeFirst
  1607 removeFirst
  1617     "remove first row; returns the removed row"
  1608     "remove first row; returns the removed row"
  1618     
  1609 
  1619     ^ self removeIndex:1
  1610     ^ self removeIndex:1
  1620 !
  1611 !
  1621 
  1612 
  1622 removeFrom:startIndex to:stopIndex
  1613 removeFrom:startIndex to:stopIndex
  1623     "remove rows from start to stop"
  1614     "remove rows from start to stop"
  1696         (noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY]
  1687         (noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY]
  1697                                 ifTrue:[dY := dY negated].
  1688                                 ifTrue:[dY := dY negated].
  1698         self originWillChange.
  1689         self originWillChange.
  1699         viewOrigin := viewOrigin x @ (dY + oY).
  1690         viewOrigin := viewOrigin x @ (dY + oY).
  1700         "/ viewOrigin y:(dY + oY).
  1691         "/ viewOrigin y:(dY + oY).
  1701         self originChanged:(0 @ dY).        
  1692         self originChanged:(0 @ dY).
  1702     ] ifFalse:[
  1693     ] ifFalse:[
  1703         noRedraw := y0 > (height + viewOrigin y)
  1694         noRedraw := y0 > (height + viewOrigin y)
  1704     ].
  1695     ].
  1705 
  1696 
  1706     (shown not or:[self sensor hasDamageFor:self]) ifTrue:[
  1697     (shown not or:[self sensor hasDamageFor:self]) ifTrue:[
  1713         y0 := y0 max:margin.
  1704         y0 := y0 max:margin.
  1714 
  1705 
  1715         "/ cg: if I have a non-solid background color,
  1706         "/ cg: if I have a non-solid background color,
  1716         "/ or individual items have a bgColor selector,
  1707         "/ or individual items have a bgColor selector,
  1717         "/ invalidate the area (and readraw) instead of a scroll.
  1708         "/ invalidate the area (and readraw) instead of a scroll.
  1718         (viewBackground isImageOrForm 
  1709         (viewBackground isImageOrForm
  1719         or:[ self anyColumnHasPotentialNonConstantBackground ])
  1710         or:[ self anyColumnHasPotentialNonConstantBackground ])
  1720         ifTrue:[
  1711         ifTrue:[
  1721             "/ do not scroll but invalidate ...
  1712             "/ do not scroll but invalidate ...
  1722         ] ifFalse:[
  1713         ] ifFalse:[
  1723             y1 := yB.
  1714             y1 := yB.
  1731         self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
  1722         self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
  1732     ].
  1723     ].
  1733     self contentsChanged.
  1724     self contentsChanged.
  1734 !
  1725 !
  1735 
  1726 
  1736 removeIndex:aRowNr 
  1727 removeIndex:aRowNr
  1737     "remove row at an index; returns the removed row"
  1728     "remove row at an index; returns the removed row"
  1738     
  1729 
  1739     |row|
  1730     |row|
  1740 
  1731 
  1741     row := list at:aRowNr ifAbsent:nil.
  1732     row := list at:aRowNr ifAbsent:nil.
  1742     self removeFrom:aRowNr to:aRowNr.
  1733     self removeFrom:aRowNr to:aRowNr.
  1743     ^ row
  1734     ^ row
  1744 !
  1735 !
  1745 
  1736 
  1746 removeLast
  1737 removeLast
  1747     "remove last row; the row is returned"
  1738     "remove last row; the row is returned"
  1748     
  1739 
  1749     ^ self removeIndex:(list size)
  1740     ^ self removeIndex:(list size)
  1750 !
  1741 !
  1751 
  1742 
  1752 replaceFrom:start to:stop with:aCollection startingAt:repStart
  1743 replaceFrom:start to:stop with:aCollection startingAt:repStart
  1753     "replace elements in the receiver between index start and stop,
  1744     "replace elements in the receiver between index start and stop,
  1766 
  1757 
  1767     [listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ].
  1758     [listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ].
  1768 
  1759 
  1769     start to:stop do:[:i| |aRow|
  1760     start to:stop do:[:i| |aRow|
  1770         aRow := list at:i ifAbsent:nil.
  1761         aRow := list at:i ifAbsent:nil.
  1771     
  1762 
  1772         aRow notNil ifTrue:[
  1763         aRow notNil ifTrue:[
  1773             beDependentOfRows ifTrue:[aRow removeDependent:self].
  1764             beDependentOfRows ifTrue:[aRow removeDependent:self].
  1774 
  1765 
  1775             (self isInSelection:i) ifTrue:[
  1766             (self isInSelection:i) ifTrue:[
  1776                 inSelList add:i
  1767                 inSelList add:i
  1808 
  1799 
  1809     aColumn setDescWidth:(aColumn width + aDeltaX).
  1800     aColumn setDescWidth:(aColumn width + aDeltaX).
  1810     cachedPreferredExtent notNil ifTrue:[self fitColumns]
  1801     cachedPreferredExtent notNil ifTrue:[self fitColumns]
  1811 !
  1802 !
  1812 
  1803 
  1813 update:what with:aPara from:chgObj 
  1804 update:what with:aPara from:chgObj
  1814     "one of my rows/cells changed its value"
  1805     "one of my rows/cells changed its value"
  1815     
  1806 
  1816     |row listHoldersList arg1 arg2 col|
  1807     |row listHoldersList arg1 arg2 col|
  1817 
  1808 
  1818     chgObj == columnHolder ifTrue:[
  1809     chgObj == columnHolder ifTrue:[
  1819         cachedPreferredExtent := nil.
  1810         cachedPreferredExtent := nil.
  1820         self columnDescriptors:(columnHolder value). 
  1811         self columnDescriptors:(columnHolder value).
  1821         ^ self. 
  1812         ^ self.
  1822     ].
  1813     ].
  1823     chgObj == columnAdaptor ifTrue:[
  1814     chgObj == columnAdaptor ifTrue:[
  1824         col := columnAdaptor value.
  1815         col := columnAdaptor value.
  1825         columnDescriptors do:[:aCol | 
  1816         columnDescriptors do:[:aCol |
  1826             aCol columnAdaptor:col
  1817             aCol columnAdaptor:col
  1827         ].
  1818         ].
  1828         self invalidate.
  1819         self invalidate.
  1829         ^ self
  1820         ^ self
  1830     ].
  1821     ].
  1833         ^ self
  1824         ^ self
  1834     ].
  1825     ].
  1835 
  1826 
  1836     chgObj == model ifTrue:[
  1827     chgObj == model ifTrue:[
  1837         (what == #selectionIndex or:[ what == #selection ]) ifTrue:[
  1828         (what == #selectionIndex or:[ what == #selection ]) ifTrue:[
  1838             self selectRowIndex:(model selectionIndex copy). 
  1829             self selectRowIndex:(model selectionIndex copy).
  1839             ^ self. 
  1830             ^ self.
  1840         ].
  1831         ].
  1841         what == #list ifTrue:[
  1832         what == #list ifTrue:[
  1842             cachedPreferredExtent := nil.
  1833             cachedPreferredExtent := nil.
  1843             self listHolder:model list. 
  1834             self listHolder:model list.
  1844             ^ self. 
  1835             ^ self.
  1845         ].
  1836         ].
  1846         what == #value ifTrue:[
  1837         what == #value ifTrue:[
  1847             model == listHolder ifTrue:[
  1838             model == listHolder ifTrue:[
  1848                 cachedPreferredExtent := nil.
  1839                 cachedPreferredExtent := nil.
  1849                 self list:(listHolder value)
  1840                 self list:(listHolder value)
  1868     (chgObj == listHolder) ifTrue:[
  1859     (chgObj == listHolder) ifTrue:[
  1869         cachedPreferredExtent := nil.
  1860         cachedPreferredExtent := nil.
  1870         listHoldersList := listHolder value.
  1861         listHoldersList := listHolder value.
  1871 
  1862 
  1872         what == #value ifTrue:[
  1863         what == #value ifTrue:[
  1873             self list:listHoldersList.  
  1864             self list:listHoldersList.
  1874             ^ self. 
  1865             ^ self.
  1875         ].
  1866         ].
  1876         aPara isCollection ifTrue:[
  1867         aPara isCollection ifTrue:[
  1877             arg1 := aPara at:1.
  1868             arg1 := aPara at:1.
  1878             arg2 := aPara at:2.
  1869             arg2 := aPara at:2.
  1879         ] ifFalse:[
  1870         ] ifFalse:[
  1880             arg1 := arg2 := aPara
  1871             arg1 := arg2 := aPara
  1881         ].
  1872         ].
  1882         what == #at: ifTrue:[
  1873         what == #at: ifTrue:[
  1883             self at:arg1 put:(listHoldersList at:arg1). 
  1874             self at:arg1 put:(listHoldersList at:arg1).
  1884             ^ self.
  1875             ^ self.
  1885         ].
  1876         ].
  1886         what == #insert: ifTrue:[
  1877         what == #insert: ifTrue:[
  1887             self add:(listHoldersList at:arg1) beforeIndex:arg1. 
  1878             self add:(listHoldersList at:arg1) beforeIndex:arg1.
  1888             ^ self.
  1879             ^ self.
  1889         ].
  1880         ].
  1890         what == #remove: ifTrue:[
  1881         what == #remove: ifTrue:[
  1891             self removeFrom:arg1 to:arg1. 
  1882             self removeFrom:arg1 to:arg1.
  1892             ^ self.
  1883             ^ self.
  1893         ].
  1884         ].
  1894         what == #removeFrom: ifTrue:[
  1885         what == #removeFrom: ifTrue:[
  1895             listHoldersList size == 0 ifTrue:[
  1886             listHoldersList size == 0 ifTrue:[
  1896                 self list:nil
  1887                 self list:nil
  1905                     beforeIndex:arg1
  1896                     beforeIndex:arg1
  1906             ].
  1897             ].
  1907             ^ self.
  1898             ^ self.
  1908         ].
  1899         ].
  1909         what == #replace: ifTrue:[
  1900         what == #replace: ifTrue:[
  1910             self 
  1901             self
  1911                 replaceFrom:arg1 to:arg2
  1902                 replaceFrom:arg1 to:arg2
  1912                 with:listHoldersList startingAt:arg1.
  1903                 with:listHoldersList startingAt:arg1.
  1913             ^ self
  1904             ^ self
  1914         ].
  1905         ].
  1915         self list:listHoldersList.
  1906         self list:listHoldersList.
  1961 
  1952 
  1962         "/ just in case someone nilled or changed the editValue
  1953         "/ just in case someone nilled or changed the editValue
  1963         "/ Q: is this CA's paranoia or could this really be done in the at:put: above ???
  1954         "/ Q: is this CA's paranoia or could this really be done in the at:put: above ???
  1964         "/ A (sv): it me happen, if the set method specified in the column descriptor did not set the
  1955         "/ A (sv): it me happen, if the set method specified in the column descriptor did not set the
  1965         "/         model.
  1956         "/         model.
  1966         (editValueBefore == editValue) ifTrue:[ 
  1957         (editValueBefore == editValue) ifTrue:[
  1967             editValue value:realValue withoutNotifying:self.
  1958             editValue value:realValue withoutNotifying:self.
  1968         ].
  1959         ].
  1969     ].
  1960     ].
  1970 
  1961 
  1971     modifiedChannel notNil ifTrue:[
  1962     modifiedChannel notNil ifTrue:[
  1972         modifiedChannel value:true.
  1963         modifiedChannel value:true.
  1973     ].
  1964     ].
  1974 
       
  1975 
       
  1976 !
  1965 !
  1977 
  1966 
  1978 updateEditorFromChangedRow
  1967 updateEditorFromChangedRow
  1979     |rowsValue rowNr|
  1968     |rowsValue rowNr|
  1980 
  1969 
  1982         rowNr := rowNr first.
  1971         rowNr := rowNr first.
  1983     ].
  1972     ].
  1984     rowsValue := (self columnDescriptorAt:self selectedColIndex) at:rowNr.
  1973     rowsValue := (self columnDescriptorAt:self selectedColIndex) at:rowNr.
  1985     (editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[
  1974     (editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[
  1986         editValue value:rowsValue withoutNotifying:self.
  1975         editValue value:rowsValue withoutNotifying:self.
  1987         editView 
  1976         editView
  1988             withAllSubViewsDo:[:v | 
  1977             withAllSubViewsDo:[:v |
  1989                 v isInputField ifTrue:[
  1978                 v isInputField ifTrue:[
  1990                     v flash.
  1979                     v flash.
  1991                 ]
  1980                 ]
  1992             ]
  1981             ]
  1993     ].
  1982     ].
  2006 
  1995 
  2007 !DSVColumnView methodsFor:'drag & drop'!
  1996 !DSVColumnView methodsFor:'drag & drop'!
  2008 
  1997 
  2009 canDrag
  1998 canDrag
  2010     "returns true if dragging is enabled"
  1999     "returns true if dragging is enabled"
  2011     
  2000 
  2012     ^ dropSource notNil
  2001     ^ dropSource notNil
  2013 !
  2002 !
  2014 
  2003 
  2015 canStartDragAt:aPoint clickedAt:clickPoint
  2004 canStartDragAt:aPoint clickedAt:clickPoint
  2016     self canDrag ifFalse:[
  2005     self canDrag ifFalse:[
  2038     (absLnNr > 1 and:[absLnNr < self size]) ifFalse:[
  2027     (absLnNr > 1 and:[absLnNr < self size]) ifFalse:[
  2039         ^ false
  2028         ^ false
  2040     ].
  2029     ].
  2041     aContext contentsWillChange.
  2030     aContext contentsWillChange.
  2042 
  2031 
  2043     y > yInset 
  2032     y > yInset
  2044         ifTrue:[self scrollDown:rowHeight]
  2033         ifTrue:[self scrollDown:rowHeight]
  2045         ifFalse:[self scrollUp:rowHeight].
  2034         ifFalse:[self scrollUp:rowHeight].
  2046 
  2035 
  2047     ^ true
  2036     ^ true
  2048 !
  2037 !
  2049 
  2038 
  2050 dropSource
  2039 dropSource
  2051     "returns the dropSource or nil"
  2040     "returns the dropSource or nil"
  2052     
  2041 
  2053     ^ dropSource
  2042     ^ dropSource
  2054 !
  2043 !
  2055 
  2044 
  2056 dropSource:aDropSourceOrNil 
  2045 dropSource:aDropSourceOrNil
  2057     "set the dropSource or nil"
  2046     "set the dropSource or nil"
  2058     
  2047 
  2059     dropSource := aDropSourceOrNil.
  2048     dropSource := aDropSourceOrNil.
  2060 !
  2049 !
  2061 
  2050 
  2062 startDragAt:aPoint
  2051 startDragAt:aPoint
  2063 
  2052 
  2067     ]
  2056     ]
  2068 ! !
  2057 ! !
  2069 
  2058 
  2070 !DSVColumnView methodsFor:'drawing'!
  2059 !DSVColumnView methodsFor:'drawing'!
  2071 
  2060 
  2072 colorOnDevice:aColor 
  2061 colorOnDevice:aColor
  2073     "returns color on device"
  2062     "returns color on device"
  2074     
  2063 
  2075     |col|
  2064     |col|
  2076 
  2065 
  2077     aColor = Color noColor ifFalse:[
  2066     aColor = Color noColor ifFalse:[
  2078         col := colorMap at:aColor ifAbsent:nil.
  2067         col := colorMap at:aColor ifAbsent:nil.
  2079         col isNil ifTrue:[
  2068         col isNil ifTrue:[
  2084     ^ bgColor
  2073     ^ bgColor
  2085 !
  2074 !
  2086 
  2075 
  2087 forceRedraw
  2076 forceRedraw
  2088     "a redraw forced by any other component"
  2077     "a redraw forced by any other component"
  2089     
  2078 
  2090     shown ifTrue:[
  2079     shown ifTrue:[
  2091         self invalidate
  2080         self invalidate
  2092     ]
  2081     ]
  2093 !
  2082 !
  2094 
  2083 
  2095 invalidate
  2084 invalidate
  2096     "recompute extent before repair range"
  2085     "recompute extent before repair range"
  2097     
  2086 
  2098     self recomputeHeightOfContents.
  2087     self recomputeHeightOfContents.
  2099     super invalidate.
  2088     super invalidate.
  2100 !
  2089 !
  2101 
  2090 
  2102 invalidateRowAt:aRowNr 
  2091 invalidateRowAt:aRowNr
  2103     "redraw total row at an index"
  2092     "redraw total row at an index"
  2104     
  2093 
  2105     self invalidateRowAt:aRowNr colAt:0
  2094     self invalidateRowAt:aRowNr colAt:0
  2106 !
  2095 !
  2107 
  2096 
  2108 invalidateRowAt:aRowNr colAt:aColNr
  2097 invalidateRowAt:aRowNr colAt:aColNr
  2109     "redraw either a single column in a row,
  2098     "redraw either a single column in a row,
  2185 invalidateSelection
  2174 invalidateSelection
  2186     "invalidate (force async redraw) the current selection"
  2175     "invalidate (force async redraw) the current selection"
  2187 
  2176 
  2188     |colIndex|
  2177     |colIndex|
  2189 
  2178 
  2190     shown ifTrue:[ 
  2179     shown ifTrue:[
  2191         colIndex := self selectedColIndex ? 0.
  2180         colIndex := self selectedColIndex ? 0.
  2192 
  2181 
  2193         self selectionIndicesDo:[:aRowIndex|
  2182         self selectionIndicesDo:[:aRowIndex|
  2194             self invalidateRowAt:aRowIndex colAt:colIndex.
  2183             self invalidateRowAt:aRowIndex colAt:colIndex.
  2195         ].
  2184         ].
  2196     ]
  2185     ]
  2197 !
  2186 !
  2198 
  2187 
  2199 invalidateVisibleRow:aRow 
  2188 invalidateVisibleRow:aRow
  2200     "redraw row if visible"
  2189     "redraw row if visible"
  2201     
  2190 
  2202     self invalidateVisibleRow:aRow colAt:0
  2191     self invalidateVisibleRow:aRow colAt:0
  2203 !
  2192 !
  2204 
  2193 
  2205 invalidateVisibleRow:aRow colAt:aColNr
  2194 invalidateVisibleRow:aRow colAt:aColNr
  2206     "redraw either a single column in a row,
  2195     "redraw either a single column in a row,
  2238         idx := 0
  2227         idx := 0
  2239     ] ifFalse:[
  2228     ] ifFalse:[
  2240         (row := aRow) isNumber ifTrue:[
  2229         (row := aRow) isNumber ifTrue:[
  2241             (row := self at:aRow) isNil ifTrue:[ ^ self ]
  2230             (row := self at:aRow) isNil ifTrue:[ ^ self ]
  2242         ].
  2231         ].
  2243         idx := columnDescriptors 
  2232         idx := columnDescriptors
  2244                 findFirst:[:aCol| aCol description readSelector == aSelector]
  2233                 findFirst:[:aCol| aCol description readSelector == aSelector]
  2245     ].
  2234     ].
  2246     self invalidateVisibleRow:aRow colAt:idx
  2235     self invalidateVisibleRow:aRow colAt:idx
  2247 !
  2236 !
  2248 
  2237 
  2270     columnDescriptors isEmpty ifTrue:[
  2259     columnDescriptors isEmpty ifTrue:[
  2271         ^ gc fillRectangleX:x y:y width:w height:h
  2260         ^ gc fillRectangleX:x y:y width:w height:h
  2272     ].
  2261     ].
  2273 
  2262 
  2274     size  := list size.
  2263     size  := list size.
  2275     yTop  := margin - viewOrigin y.                   
  2264     yTop  := margin - viewOrigin y.
  2276     c0    := y - yTop max:0.
  2265     c0    := y - yTop max:0.
  2277     start := (c0 // rowHeight) + 1.
  2266     start := (c0 // rowHeight) + 1.
  2278     stop  := (((c0 + h - 1) // rowHeight) + 1) min:size.
  2267     stop  := (((c0 + h - 1) // rowHeight) + 1) min:size.
  2279 
  2268 
  2280     stop < start ifTrue:[
  2269     stop < start ifTrue:[
  2299             (x1 > x and:[x0 < maxX]) ifTrue:[
  2288             (x1 > x and:[x0 < maxX]) ifTrue:[
  2300                 |left right rect|
  2289                 |left right rect|
  2301                 left  := x0 max:x.
  2290                 left  := x0 max:x.
  2302                 right := x1 min:maxX.
  2291                 right := x1 min:maxX.
  2303                 rect  := Rectangle left:left top:y width:(right - left) height:h.
  2292                 rect  := Rectangle left:left top:y width:(right - left) height:h.
  2304             
  2293 
  2305                 self clippingBounds:nil.
  2294                 self clippingBounds:nil.
  2306                 self clippingBounds:rect.
  2295                 self clippingBounds:rect.
  2307                 aCol redrawX:x0 y:yTop h:clHg  from:start to:stop.
  2296                 aCol redrawX:x0 y:yTop h:clHg  from:start to:stop.
  2308             ].
  2297             ].
  2309             x0 := x1
  2298             x0 := x1
  2353             gc paint:lineColor.
  2342             gc paint:lineColor.
  2354             gc displayLineFromX:x y:yVis toX:width y:yVis.
  2343             gc displayLineFromX:x y:yVis toX:width y:yVis.
  2355             yVis := yVis+rowHeight -1.
  2344             yVis := yVis+rowHeight -1.
  2356             gc displayLineFromX:x y:yVis toX:width y:yVis.
  2345             gc displayLineFromX:x y:yVis toX:width y:yVis.
  2357         ].
  2346         ].
  2358     ].     
  2347     ].
  2359 
  2348 
  2360     "Modified: / 21-01-2011 / 15:58:11 / cg"
  2349     "Modified: / 21-01-2011 / 15:58:11 / cg"
  2361 ! !
  2350 ! !
  2362 
  2351 
  2363 !DSVColumnView methodsFor:'drawing interactors'!
  2352 !DSVColumnView methodsFor:'drawing interactors'!
  2377             h > minRowHeight ifTrue:[
  2366             h > minRowHeight ifTrue:[
  2378                 minRowHeight := h.
  2367                 minRowHeight := h.
  2379 
  2368 
  2380                 cachedPreferredExtent notNil ifTrue:[
  2369                 cachedPreferredExtent notNil ifTrue:[
  2381 "/                    rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2.
  2370 "/                    rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2.
  2382                     cachedPreferredExtent := Point 
  2371                     cachedPreferredExtent := Point
  2383                                             x: cachedPreferredExtent x
  2372                                             x: cachedPreferredExtent x
  2384                                             y: (list size * rowHeight).
  2373                                             y: (list size * rowHeight).
  2385                     self contentsChanged.
  2374                     self contentsChanged.
  2386                 ].
  2375                 ].
  2387                 self class stopRedrawSignal raiseRequest.
  2376                 self class stopRedrawSignal raiseRequest.
  2422             ^ self
  2411             ^ self
  2423         ].
  2412         ].
  2424         gc paint:fgColor on:bgColor.
  2413         gc paint:fgColor on:bgColor.
  2425         form := checkToggleForm
  2414         form := checkToggleForm
  2426     ] ifFalse:[
  2415     ] ifFalse:[
  2427         form := state 
  2416         form := state
  2428                     ifTrue:[checkToggleActiveImage]
  2417                     ifTrue:[checkToggleActiveImage]
  2429                     ifFalse:[checkTogglePassiveImage].
  2418                     ifFalse:[checkTogglePassiveImage].
  2430     ].
  2419     ].
  2431     e := (checkToggleExtent - form extent) // 2.
  2420     e := (checkToggleExtent - form extent) // 2.
  2432     gc displayForm:form x:(x + e x) y:(y + e y).
  2421     gc displayForm:form x:(x + e x) y:(y + e y).
  2452     self drawEdgesAtX:x   y:y width:w height:h level:comboButtonLevel on:self.
  2441     self drawEdgesAtX:x   y:y width:w height:h level:comboButtonLevel on:self.
  2453     gc paint:fgColor on:bgColor.
  2442     gc paint:fgColor on:bgColor.
  2454     gc displayForm:comboButtonForm x:(x + e x) y:(y + e y)
  2443     gc displayForm:comboButtonForm x:(x + e x) y:(y + e y)
  2455 !
  2444 !
  2456 
  2445 
  2457 drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC 
  2446 drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC
  2458     "draw edges for a cell or label"
  2447     "draw edges for a cell or label"
  2459     
  2448 
  2460     aGC 
  2449     aGC
  2461         drawEdgesForX:x
  2450         drawEdgesForX:x
  2462         y:y
  2451         y:y
  2463         width:w
  2452         width:w
  2464         height:h
  2453         height:h
  2465         level:aLevel
  2454         level:aLevel
  2483     h := radioButtonActiveImage extent y.
  2472     h := radioButtonActiveImage extent y.
  2484     y := yTop + ((rowHeight - h) // 2).
  2473     y := yTop + ((rowHeight - h) // 2).
  2485     x := xLeft + ((cellWidth - w) // 2).
  2474     x := xLeft + ((cellWidth - w) // 2).
  2486     h odd ifTrue:[y := y + 1].
  2475     h odd ifTrue:[y := y + 1].
  2487 
  2476 
  2488     image := (aBooleanOrNil == true) 
  2477     image := (aBooleanOrNil == true)
  2489                 ifTrue:[radioButtonActiveImage]
  2478                 ifTrue:[radioButtonActiveImage]
  2490                 ifFalse:[radioButtonPassiveImage].
  2479                 ifFalse:[radioButtonPassiveImage].
  2491 
  2480 
  2492     image := image onDevice:device.
  2481     image := image onDevice:device.
  2493 
  2482 
  2498 
  2487 
  2499 !DSVColumnView methodsFor:'enumerating columns'!
  2488 !DSVColumnView methodsFor:'enumerating columns'!
  2500 
  2489 
  2501 columnsDo:aOneArgBlock
  2490 columnsDo:aOneArgBlock
  2502     "evaluate the argument, aOneArgBlock for every columnDescriptor"
  2491     "evaluate the argument, aOneArgBlock for every columnDescriptor"
  2503     
  2492 
  2504     columnDescriptors do:aOneArgBlock
  2493     columnDescriptors do:aOneArgBlock
  2505 !
  2494 !
  2506 
  2495 
  2507 columnsFrom:start to:stop do:aOneArgBlock 
  2496 columnsFrom:start to:stop do:aOneArgBlock
  2508     "evaluate the argument, aOneArgBlock for the columns with index start to
  2497     "evaluate the argument, aOneArgBlock for the columns with index start to
  2509      stop in the collection of column descriptors"
  2498      stop in the collection of column descriptors"
  2510     
  2499 
  2511     columnDescriptors 
  2500     columnDescriptors
  2512         from:start
  2501         from:start
  2513         to:stop
  2502         to:stop
  2514         do:aOneArgBlock
  2503         do:aOneArgBlock
  2515 ! !
  2504 ! !
  2516 
  2505 
  2538 
  2527 
  2539     prvRow := aRowNr.
  2528     prvRow := aRowNr.
  2540     chgSet := IdentitySet new.
  2529     chgSet := IdentitySet new.
  2541     doAdd  := isSelected not.
  2530     doAdd  := isSelected not.
  2542 
  2531 
  2543     buttonMotionAction := [:p| 
  2532     buttonMotionAction := [:p|
  2544         |rowNr mustRestore step f|
  2533         |rowNr mustRestore step f|
  2545 
  2534 
  2546         rowNr := self yVisibleToRowNr:(p y).
  2535         rowNr := self yVisibleToRowNr:(p y).
  2547         (rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[
  2536         (rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[
  2548             rowNr == aRowNr ifTrue:[
  2537             rowNr == aRowNr ifTrue:[
  2579     ].
  2568     ].
  2580 
  2569 
  2581     "Modified: / 21-07-2007 / 22:00:27 / cg"
  2570     "Modified: / 21-07-2007 / 22:00:27 / cg"
  2582 !
  2571 !
  2583 
  2572 
  2584 buttonMotion:buttonMask x:x y:y 
  2573 buttonMotion:buttonMask x:x y:y
  2585     "mouse-move while button was pressed - handle multiple selection changes"
  2574     "mouse-move while button was pressed - handle multiple selection changes"
  2586     
  2575 
  2587     self isEnabled ifFalse:[
  2576     self isEnabled ifFalse:[
  2588         ^ self
  2577         ^ self
  2589     ].
  2578     ].
  2590 
  2579 
  2591     buttonMotionAction notNil ifTrue:[
  2580     buttonMotionAction notNil ifTrue:[
  2643     rowNr := self yVisibleToRowNr:y.
  2632     rowNr := self yVisibleToRowNr:y.
  2644     colNr := self xVisibleToColNr:x.
  2633     colNr := self xVisibleToColNr:x.
  2645 
  2634 
  2646     (button == 2) ifTrue:[ |openMenu|
  2635     (button == 2) ifTrue:[ |openMenu|
  2647         openMenu := false.
  2636         openMenu := false.
  2648         
  2637 
  2649         UserPreferences current selectOnRightClick ifFalse:[
  2638         UserPreferences current selectOnRightClick ifFalse:[
  2650             openMenu := true.
  2639             openMenu := true.
  2651         ] ifTrue:[
  2640         ] ifTrue:[
  2652             UserPreferences current showRightButtonMenuOnRelease ifFalse:[
  2641             UserPreferences current showRightButtonMenuOnRelease ifFalse:[
  2653                 (rowNr notNil and:[colNr notNil and:[self isRowSelectable:rowNr]]) ifTrue:[
  2642                 (rowNr notNil and:[colNr notNil and:[self isRowSelectable:rowNr]]) ifTrue:[
  2656                 openMenu := true.
  2645                 openMenu := true.
  2657             ].
  2646             ].
  2658         ].
  2647         ].
  2659         openMenu ifTrue:[ |menu|
  2648         openMenu ifTrue:[ |menu|
  2660             menu := self findMenuForSelection.
  2649             menu := self findMenuForSelection.
  2661             menu notNil ifTrue:[ 
  2650             menu notNil ifTrue:[
  2662                 self startUpMenu:menu.
  2651                 self startUpMenu:menu.
  2663             ] ifFalse:[
  2652             ] ifFalse:[
  2664                 super buttonPress:button x:x y:y.
  2653                 super buttonPress:button x:x y:y.
  2665             ].
  2654             ].
  2666             ^ self
  2655             ^ self
  2667         ].
  2656         ].
  2668     ].
  2657     ].
  2669     
  2658 
  2670     (rowNr isNil or:[colNr isNil]) ifTrue:[
  2659     (rowNr isNil or:[colNr isNil]) ifTrue:[
  2671         self deselect.
  2660         self deselect.
  2672         super buttonPress:button x:x y:y.
  2661         super buttonPress:button x:x y:y.
  2673         ^ self
  2662         ^ self
  2674     ].
  2663     ].
  2693             ^ self
  2682             ^ self
  2694         ].
  2683         ].
  2695         self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
  2684         self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
  2696 
  2685 
  2697         ((button == 2) and:[UserPreferences current selectOnRightClick]) ifTrue:[
  2686         ((button == 2) and:[UserPreferences current selectOnRightClick]) ifTrue:[
  2698             self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true 
  2687             self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true
  2699         ] ifFalse:[
  2688         ] ifFalse:[
  2700             buttonReleaseAction := 
  2689             buttonReleaseAction :=
  2701                 [ 
  2690                 [
  2702                     self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true 
  2691                     self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true
  2703                 ].
  2692                 ].
  2704 
  2693 
  2705             buttonMotionAction := 
  2694             buttonMotionAction :=
  2706                 [:aPoint|
  2695                 [:aPoint|
  2707                     (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
  2696                     (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
  2708                         self startDragAt:aPoint
  2697                         self startDragAt:aPoint
  2709                     ]
  2698                     ]
  2710                 ].
  2699                 ].
  2711         ].
  2700         ].
  2712         ^ self
  2701         ^ self
  2713     ].
  2702     ].
  2714 
  2703 
  2715     ((button == 2) and:[UserPreferences current selectOnRightClick]) ifFalse:[
  2704     ((button == 2) and:[UserPreferences current selectOnRightClick]) ifFalse:[
  2716         buttonReleaseAction := 
  2705         buttonReleaseAction :=
  2717             [
  2706             [
  2718                 self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true.
  2707                 self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true.
  2719             ].
  2708             ].
  2720 
  2709 
  2721         "/ normally, we select on button release; however, any editor is shown immediately
  2710         "/ normally, we select on button release; however, any editor is shown immediately
  2722         ((column := self columnDescriptorAt:colNr) notNil 
  2711         ((column := self columnDescriptorAt:colNr) notNil
  2723         and:[ (columnEditorType := column description editorType) notNil
  2712         and:[ (columnEditorType := column description editorType) notNil
  2724         and:[ columnEditorType ~~ #None ]]) ifTrue:[
  2713         and:[ columnEditorType ~~ #None ]]) ifTrue:[
  2725             buttonReleaseAction value.
  2714             buttonReleaseAction value.
  2726             buttonReleaseAction := nil.
  2715             buttonReleaseAction := nil.
  2727             editView notNil ifTrue:[
  2716             editView notNil ifTrue:[
  2737             ]
  2726             ]
  2738         ]
  2727         ]
  2739     ].
  2728     ].
  2740 
  2729 
  2741     clickedIntoSelection := self isInSelection:rowNr.
  2730     clickedIntoSelection := self isInSelection:rowNr.
  2742     clickedIntoSelection ifTrue:[ 
  2731     clickedIntoSelection ifTrue:[
  2743         |selColIdx|
  2732         |selColIdx|
  2744 
  2733 
  2745         selColIdx := self selectedColIndex.
  2734         selColIdx := self selectedColIndex.
  2746 
  2735 
  2747         (selColIdx ~~ 0 and:[selColIdx ~~ colNr]) ifTrue:[
  2736         (selColIdx ~~ 0 and:[selColIdx ~~ colNr]) ifTrue:[
  2751 
  2740 
  2752     clickedIntoSelection ifFalse:[
  2741     clickedIntoSelection ifFalse:[
  2753         self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
  2742         self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
  2754     ] ifTrue:[
  2743     ] ifTrue:[
  2755         self canDrag ifTrue:[
  2744         self canDrag ifTrue:[
  2756             buttonMotionAction := 
  2745             buttonMotionAction :=
  2757                 [:aPoint|
  2746                 [:aPoint|
  2758                     (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
  2747                     (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
  2759                         self startDragAt:aPoint
  2748                         self startDragAt:aPoint
  2760                     ]
  2749                     ]
  2761                 ].
  2750                 ].
  2762             ^ self
  2751             ^ self
  2763         ]
  2752         ]
  2764     ].
  2753     ].
  2765 
  2754 
  2766     buttonMotionAction := [:p|
  2755     buttonMotionAction := [:p|
  2767         (self bounds containsPoint:p) ifTrue:[ 
  2756         (self bounds containsPoint:p) ifTrue:[
  2768             |rowUnderPoint|
  2757             |rowUnderPoint|
  2769 
  2758 
  2770             rowUnderPoint := self yVisibleToRowNr:(p y).
  2759             rowUnderPoint := self yVisibleToRowNr:(p y).
  2771 
  2760 
  2772             rowUnderPoint notNil ifTrue:[
  2761             rowUnderPoint notNil ifTrue:[
  2773                 buttonReleaseAction notNil ifTrue:[
  2762                 buttonReleaseAction notNil ifTrue:[
  2774                     rowUnderPoint == rowNr ifFalse:[ 
  2763                     rowUnderPoint == rowNr ifFalse:[
  2775                         buttonReleaseAction := nil
  2764                         buttonReleaseAction := nil
  2776                     ].
  2765                     ].
  2777                 ].
  2766                 ].
  2778                 buttonReleaseAction isNil ifTrue:[
  2767                 buttonReleaseAction isNil ifTrue:[
  2779                     self selectRowFrom:rowNr to:rowUnderPoint.
  2768                     self selectRowFrom:rowNr to:rowUnderPoint.
  2827 
  2816 
  2828     |colNr rowNr lsize found column|
  2817     |colNr rowNr lsize found column|
  2829 
  2818 
  2830     lsize  := list size.
  2819     lsize  := list size.
  2831 
  2820 
  2832 "/    (rowIfAbsentBlock notNil 
  2821 "/    (rowIfAbsentBlock notNil
  2833 "/     or:[x isNil
  2822 "/     or:[x isNil
  2834 "/     or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[
  2823 "/     or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[
  2835 "/        ^ self
  2824 "/        ^ self
  2836 "/    ].
  2825 "/    ].
  2837     colNr := self findFirstColumnWithStringFrom:1 to:lsize.
  2826     colNr := self findFirstColumnWithStringFrom:1 to:lsize.
  2857     "Modified: / 21.5.1998 / 03:30:22 / cg"
  2846     "Modified: / 21.5.1998 / 03:30:22 / cg"
  2858 !
  2847 !
  2859 
  2848 
  2860 contentsChanged
  2849 contentsChanged
  2861     "size of contents changed - move origin up if possible"
  2850     "size of contents changed - move origin up if possible"
  2862     
  2851 
  2863     |y|
  2852     |y|
  2864 
  2853 
  2865     shown ifTrue:[
  2854     shown ifTrue:[
  2866         self recomputeHeightOfContents.
  2855         self recomputeHeightOfContents.
  2867         y := self maxViewOriginY.
  2856         y := self maxViewOriginY.
  2938     self selectColIndex:selColNr rowIndex:selRowNr
  2927     self selectColIndex:selColNr rowIndex:selRowNr
  2939 !
  2928 !
  2940 
  2929 
  2941 doubleClicked
  2930 doubleClicked
  2942     "handle a double click"
  2931     "handle a double click"
  2943     
  2932 
  2944     |col sel idx|
  2933     |col sel idx|
  2945 
  2934 
  2946     self hasSelection ifTrue:[
  2935     self hasSelection ifTrue:[
  2947         idx := self firstIndexSelected.
  2936         idx := self firstIndexSelected.
  2948         col := self selectedColumn.
  2937         col := self selectedColumn.
  2956     ]
  2945     ]
  2957 !
  2946 !
  2958 
  2947 
  2959 findMenuForSelection
  2948 findMenuForSelection
  2960     "find the middle button menu for the current selection; returns the menu or nil"
  2949     "find the middle button menu for the current selection; returns the menu or nil"
  2961     
  2950 
  2962     |col row menu|
  2951     |col row menu|
  2963 
  2952 
  2964     self numberOfSelections == 1 ifTrue:[
  2953     self numberOfSelections == 1 ifTrue:[
  2965         row := self at:(self firstIndexSelected).
  2954         row := self at:(self firstIndexSelected).
  2966         col := self selectedColumn.
  2955         col := self selectedColumn.
  2967         col notNil ifTrue:[
  2956         col notNil ifTrue:[
  2968             menu := col menuForRow:row orAdaptor:columnAdaptor.
  2957             menu := col menuForRow:row orAdaptor:columnAdaptor.
  2969             menu notNil ifTrue:[ ^ menu ].
  2958             menu notNil ifTrue:[ ^ menu ].
  2970         ].
  2959         ].
  2971 
  2960 
  2972         col := columnDescriptors 
  2961         col := columnDescriptors
  2973                         detect:[:c | c rendererType == #rowSelector ]
  2962                         detect:[:c | c rendererType == #rowSelector ]
  2974                         ifNone:[ nil ].
  2963                         ifNone:[ nil ].
  2975         col notNil ifTrue:[
  2964         col notNil ifTrue:[
  2976             ^ col menuForRow:row inApplication:(self application)
  2965             ^ col menuForRow:row inApplication:(self application)
  2977         ]
  2966         ]
  2984 
  2973 
  2985     <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
  2974     <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
  2986                           #BeginOfText #EndOfText #ScrollUp #ScrollDown
  2975                           #BeginOfText #EndOfText #ScrollUp #ScrollDown
  2987                           #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)>
  2976                           #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)>
  2988 
  2977 
  2989     |maxColNr firstSelRowNr selRowNr selColNr 
  2978     |maxColNr firstSelRowNr selRowNr selColNr
  2990      key column isTab listSize hasSelectables rawKey|
  2979      key column isTab listSize hasSelectables rawKey|
  2991 
  2980 
  2992     self isEnabled ifFalse:[^ self].
  2981     self isEnabled ifFalse:[^ self].
  2993 
  2982 
  2994     (listSize := list size) == 0 ifTrue:[
  2983     (listSize := list size) == 0 ifTrue:[
  2998         ^ self characterPress:aKey x:x y:y
  2987         ^ self characterPress:aKey x:x y:y
  2999     ].
  2988     ].
  3000 
  2989 
  3001     (aKey == #SelectAll) ifTrue:[
  2990     (aKey == #SelectAll) ifTrue:[
  3002         multipleSelectOk ifTrue:[
  2991         multipleSelectOk ifTrue:[
  3003             self selectAllRows. 
  2992             self selectAllRows.
  3004         ].
  2993         ].
  3005         ^ self
  2994         ^ self
  3006     ].
  2995     ].
  3007 
  2996 
  3008     aKey == #PreviousPage ifTrue:[^ self pageUp].
  2997     aKey == #PreviousPage ifTrue:[^ self pageUp].
  3009     aKey == #NextPage     ifTrue:[^ self pageDown].
  2998     aKey == #NextPage     ifTrue:[^ self pageDown].
  3010     aKey == #HalfPageUp   ifTrue:[^ self halfPageUp].
  2999     aKey == #HalfPageUp   ifTrue:[^ self halfPageUp].
  3011     aKey == #HalfPageDown ifTrue:[^ self halfPageDown].
  3000     aKey == #HalfPageDown ifTrue:[^ self halfPageDown].
  3012     aKey == #BeginOfText  ifTrue:[^ self scrollToTop].
  3001     aKey == #BeginOfText  ifTrue:[^ self scrollToTop].
  3013     aKey == #EndOfText    ifTrue:[^ self scrollToBottom].
  3002     aKey == #EndOfText    ifTrue:[^ self scrollToBottom].
  3014     aKey == #ScrollUp     ifTrue:[^ self scrollUp]. 
  3003     aKey == #ScrollUp     ifTrue:[^ self scrollUp].
  3015     aKey == #ScrollDown   ifTrue:[^ self scrollDown]. 
  3004     aKey == #ScrollDown   ifTrue:[^ self scrollDown].
  3016 
  3005 
  3017     aKey == #Return ifTrue:[   
  3006     aKey == #Return ifTrue:[
  3018         editView notNil ifTrue:[
  3007         editView notNil ifTrue:[
  3019             (self selectedRowIndex size == 1
  3008             (self selectedRowIndex size == 1
  3020             and:[self selectedRowIndex first == listSize]) ifTrue:[
  3009             and:[self selectedRowIndex first == listSize]) ifTrue:[
  3021                 self selectRowIndex:nil.
  3010                 self selectRowIndex:nil.
  3022             ] ifFalse:[
  3011             ] ifFalse:[
  3032 
  3021 
  3033     hasSelectables := self hasSelectables.
  3022     hasSelectables := self hasSelectables.
  3034 
  3023 
  3035     rawKey := (WindowGroup lastEventQuerySignal query) rawKey.
  3024     rawKey := (WindowGroup lastEventQuerySignal query) rawKey.
  3036 
  3025 
  3037     (aKey == #CursorUp 
  3026     (aKey == #CursorUp
  3038     or:[aKey == #CursorDown
  3027     or:[aKey == #CursorDown
  3039     or:[rawKey == #Home
  3028     or:[rawKey == #Home
  3040     or:[rawKey == #End]]]) 
  3029     or:[rawKey == #End]]])
  3041     ifTrue:[
  3030     ifTrue:[
  3042         self cursorKey:aKey rawKey:rawKey.
  3031         self cursorKey:aKey rawKey:rawKey.
  3043         ^ self
  3032         ^ self
  3044     ].
  3033     ].
  3045 
  3034 
  3055         tabIntern ifFalse:[
  3044         tabIntern ifFalse:[
  3056             ^ super keyPress:aKey x:x y:y
  3045             ^ super keyPress:aKey x:x y:y
  3057         ].
  3046         ].
  3058 
  3047 
  3059         (aKey includesString:'Tab') ifTrue:[
  3048         (aKey includesString:'Tab') ifTrue:[
  3060             key := (aKey = #BackTab or:[self sensor shiftDown or:[aKey includesString:'Left']]) 
  3049             key := (aKey = #BackTab or:[self sensor shiftDown or:[aKey includesString:'Left']])
  3061                         ifTrue:[#CursorLeft]
  3050                         ifTrue:[#CursorLeft]
  3062                         ifFalse:[#CursorRight]
  3051                         ifFalse:[#CursorRight]
  3063         ] ifFalse:[
  3052         ] ifFalse:[
  3064             (aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[
  3053             (aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[
  3065                 ^ super keyPress:aKey x:x y:y
  3054                 ^ super keyPress:aKey x:x y:y
  3160     ].
  3149     ].
  3161 
  3150 
  3162     self font:(font asSize:newSize).
  3151     self font:(font asSize:newSize).
  3163 !
  3152 !
  3164 
  3153 
  3165 originChanged:delta 
  3154 originChanged:delta
  3166     "this one is sent, after the origin of my contents has changed -
  3155     "this one is sent, after the origin of my contents has changed -
  3167      tell dependents (i.e. scrollers) about this"
  3156      tell dependents (i.e. scrollers) about this"
  3168     
  3157 
  3169     super originChanged:delta.
  3158     super originChanged:delta.
  3170     self updateEditViewOrigin.
  3159     self updateEditViewOrigin.
  3171 !
  3160 !
  3172 
  3161 
  3173 sizeChanged:how
  3162 sizeChanged:how
  3184 
  3173 
  3185     previousExtent := self extent.
  3174     previousExtent := self extent.
  3186 
  3175 
  3187     "/ no - must compute even if not visible.
  3176     "/ no - must compute even if not visible.
  3188     "/ (could be invisible in a notebook ...)
  3177     "/ (could be invisible in a notebook ...)
  3189     realized ifTrue:[                   "used to be: shown" 
  3178     realized ifTrue:[                   "used to be: shown"
  3190 "/        labelView isVisible ifTrue:[
  3179 "/        labelView isVisible ifTrue:[
  3191 "/            lyt := labelView layout.
  3180 "/            lyt := labelView layout.
  3192 "/            lyt  leftOffset:(layout leftOffset).
  3181 "/            lyt  leftOffset:(layout leftOffset).
  3193 "/            lyt rightOffset:(layout rightOffset).
  3182 "/            lyt rightOffset:(layout rightOffset).
  3194 "/            labelView layout:lyt.
  3183 "/            labelView layout:lyt.
  3243     "Modified: / 08-08-2010 / 14:41:00 / cg"
  3232     "Modified: / 08-08-2010 / 14:41:00 / cg"
  3244 ! !
  3233 ! !
  3245 
  3234 
  3246 !DSVColumnView methodsFor:'gc operations'!
  3235 !DSVColumnView methodsFor:'gc operations'!
  3247 
  3236 
  3248 imageOnMyDevice:anImage 
  3237 imageOnMyDevice:anImage
  3249     "associate image to device and returns the new image."
  3238     "associate image to device and returns the new image."
  3250 
  3239 
  3251     anImage isNil ifTrue:[^ nil].
  3240     anImage isNil ifTrue:[^ nil].
  3252     ^ anImage onDevice:device.
  3241     ^ anImage onDevice:device.
  3253 !
  3242 !
  3254 
  3243 
  3255 registerImage:anImage key:aKey 
  3244 registerImage:anImage key:aKey
  3256     "any row can register an image with a unique identifier a key symbol"
  3245     "any row can register an image with a unique identifier a key symbol"
  3257     
  3246 
  3258     |img|
  3247     |img|
  3259 
  3248 
  3260     (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
  3249     (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
  3261         ^ img
  3250         ^ img
  3262     ].
  3251     ].
  3263     img := self imageOnMyDevice:anImage.
  3252     img := self imageOnMyDevice:anImage.
  3264     registererImages at:aKey put:img.
  3253     registererImages at:aKey put:img.
  3265     ^ img
  3254     ^ img
  3266 !
  3255 !
  3267 
  3256 
  3268 registeredImageAt:aKey 
  3257 registeredImageAt:aKey
  3269     "any row can register an image with a unique identifier"
  3258     "any row can register an image with a unique identifier"
  3270     
  3259 
  3271     ^ registererImages at:aKey ifAbsent:nil
  3260     ^ registererImages at:aKey ifAbsent:nil
  3272 !
  3261 !
  3273 
  3262 
  3274 releaseAllRegisteredImages
  3263 releaseAllRegisteredImages
  3275     "release all registered images"
  3264     "release all registered images"
  3276     
  3265 
  3277     registererImages := IdentityDictionary new.
  3266     registererImages := IdentityDictionary new.
  3278 ! !
  3267 ! !
  3279 
  3268 
  3280 !DSVColumnView methodsFor:'help'!
  3269 !DSVColumnView methodsFor:'help'!
  3281 
  3270 
  3394             ].
  3383             ].
  3395         ].
  3384         ].
  3396     ].
  3385     ].
  3397     selectionFrameColorNoFocus isNil ifTrue:[
  3386     selectionFrameColorNoFocus isNil ifTrue:[
  3398         selectionFrameColor notNil ifTrue:[
  3387         selectionFrameColor notNil ifTrue:[
  3399             selectionFrameColorNoFocus := selectionFrameColor lightened.  
  3388             selectionFrameColorNoFocus := selectionFrameColor lightened.
  3400             "/ selectionFrameColorNoFocus := Color brightness:(selectionFrameColor "lightened" brightness).   "/ asGray
  3389             "/ selectionFrameColorNoFocus := Color brightness:(selectionFrameColor "lightened" brightness).   "/ asGray
  3401         ]
  3390         ]
  3402     ].
  3391     ].
  3403 
  3392 
  3404     rowSelectorForm         := self class rowSelectorImage.
  3393     rowSelectorForm         := self class rowSelectorImage.
  3457     rowFontAscent      := fontOnDevice ascent.
  3446     rowFontAscent      := fontOnDevice ascent.
  3458     rowHeight          := verticalSpacing + (fontOnDevice height) + verticalSpacing + separatorSize.
  3447     rowHeight          := verticalSpacing + (fontOnDevice height) + verticalSpacing + separatorSize.
  3459     minRowHeight       := rowHeight.
  3448     minRowHeight       := rowHeight.
  3460     multipleSelectOk   := false.                        "/ multiselect disabled
  3449     multipleSelectOk   := false.                        "/ multiselect disabled
  3461     selectedRowIndex   := 0.                            "/ no selection
  3450     selectedRowIndex   := 0.                            "/ no selection
  3462     self selectedColIndex:0.    
  3451     self selectedColIndex:0.
  3463     registererImages   := Dictionary new.
  3452     registererImages   := Dictionary new.
  3464     columnDescriptors  := #().
  3453     columnDescriptors  := #().
  3465     beDependentOfRows  := false.
  3454     beDependentOfRows  := false.
  3466     colorMap           := Dictionary new.
  3455     colorMap           := Dictionary new.
  3467     catchChangeEvents  := false.
  3456     catchChangeEvents  := false.
  3468     selectRowOnDefault := true.
  3457     selectRowOnDefault := true.
  3469     autoScroll         := true.
  3458     autoScroll         := true.
  3470     autoScrollToColumn := true.
  3459     autoScrollToColumn := true.
  3471     scrollRowWise      := false.
  3460     scrollRowWise      := false.
  3472     sortListInPlace    := false.    "/ when false (default for backward compatibility): 
  3461     sortListInPlace    := false.    "/ when false (default for backward compatibility):
  3473                                     "/ if sorting, create a copy
  3462                                     "/ if sorting, create a copy
  3474                                     "/ of the list, which is wrong when useIndex is on,
  3463                                     "/ of the list, which is wrong when useIndex is on,
  3475                                     "/ as the application will get the index in the sorted
  3464                                     "/ as the application will get the index in the sorted
  3476                                     "/ list, which is probably different from tha apps list mode.
  3465                                     "/ list, which is probably different from tha apps list mode.
  3477                                     "/ When true (should be default, but that might break many
  3466                                     "/ When true (should be default, but that might break many
  3478                                     "/ users), the passed in list is sorted in place (i.e. possibly
  3467                                     "/ users), the passed in list is sorted in place (i.e. possibly
  3479                                     "/ sorting the application's list).
  3468                                     "/ sorting the application's list).
  3480 
  3469 
  3481     updateListHolderWhenSorting := false.
  3470     updateListHolderWhenSorting := false.
  3482                                     "/ when false (default for backward compatibility): 
  3471                                     "/ when false (default for backward compatibility):
  3483                                     "/ if sorting, do not write back the sorted list into the listHolder
  3472                                     "/ if sorting, do not write back the sorted list into the listHolder
  3484                                     "/ When true (should be default, but that might break many
  3473                                     "/ When true (should be default, but that might break many
  3485                                     "/ users), the sorted list is written back into the listHolder,
  3474                                     "/ users), the sorted list is written back into the listHolder,
  3486                                     "/ but only if sortListInPlace is false.
  3475                                     "/ but only if sortListInPlace is false.
  3487 
  3476 
  3491     "Modified: / 13-09-2017 / 16:08:34 / cg"
  3480     "Modified: / 13-09-2017 / 16:08:34 / cg"
  3492 !
  3481 !
  3493 
  3482 
  3494 mapped
  3483 mapped
  3495     "set selection (if any) after mapping"
  3484     "set selection (if any) after mapping"
  3496     
  3485 
  3497     |idx|
  3486     |idx|
  3498 
  3487 
  3499     super mapped.
  3488     super mapped.
  3500     needFitColumns == true ifTrue:[
  3489     needFitColumns == true ifTrue:[
  3501         self fitColumns
  3490         self fitColumns
  3505     ].
  3494     ].
  3506 !
  3495 !
  3507 
  3496 
  3508 realize
  3497 realize
  3509     "recompute contents and fit columns to view"
  3498     "recompute contents and fit columns to view"
  3510     
  3499 
  3511     |selection|
  3500     |selection|
  3512 
  3501 
  3513     self bitGravity:#NorthWest.
  3502     self bitGravity:#NorthWest.
  3514     self recomputeHeightOfContents.
  3503     self recomputeHeightOfContents.
  3515     selection := 0.
  3504     selection := 0.
  3527     self fitColumns.
  3516     self fitColumns.
  3528 !
  3517 !
  3529 
  3518 
  3530 release
  3519 release
  3531     "remove dependencies"
  3520     "remove dependencies"
  3532     
  3521 
  3533     self columnHolder:nil.
  3522     self columnHolder:nil.
  3534 
  3523 
  3535     beDependentOfRows ifTrue:[self makeIndependentOfRows].
  3524     beDependentOfRows ifTrue:[self makeIndependentOfRows].
  3536     listHolder notNil ifTrue:[
  3525     listHolder notNil ifTrue:[
  3537         listHolder removeDependent:self.
  3526         listHolder removeDependent:self.
  3552     ^ self has3Dseparators
  3541     ^ self has3Dseparators
  3553 !
  3542 !
  3554 
  3543 
  3555 has3Dsepartors:aBool
  3544 has3Dsepartors:aBool
  3556     <resource: #obsolete>
  3545     <resource: #obsolete>
  3557  
  3546 
  3558     "shouldn't be used any more"
  3547     "shouldn't be used any more"
  3559     
  3548 
  3560     self obsoleteMethodWarning.
  3549     self obsoleteMethodWarning.
  3561     self has3Dseparators:aBool
  3550     self has3Dseparators:aBool
  3562 ! !
  3551 ! !
  3563 
  3552 
  3564 !DSVColumnView methodsFor:'private'!
  3553 !DSVColumnView methodsFor:'private'!
  3606             winGroup focusView:focusView.
  3595             winGroup focusView:focusView.
  3607         ]
  3596         ]
  3608     ].
  3597     ].
  3609 !
  3598 !
  3610 
  3599 
  3611 detectViewAt:aPoint in:aView 
  3600 detectViewAt:aPoint in:aView
  3612     "returns the view at a point"
  3601     "returns the view at a point"
  3613     
  3602 
  3614     aView isNil ifTrue:[
  3603     aView isNil ifTrue:[
  3615         ^ nil
  3604         ^ nil
  3616     ].
  3605     ].
  3617     ^ aView detectViewAt:aPoint.
  3606     ^ aView detectViewAt:aPoint.
  3618 !
  3607 !
  3619 
  3608 
  3620 fitColumns
  3609 fitColumns
  3621     "fit columns to view; "
  3610     "fit columns to view; "
  3622 
  3611 
  3623     |selectedColumn columnsWithRelativeWidth 
  3612     |selectedColumn columnsWithRelativeWidth
  3624      overallMinWidth restWidth anyChange oldOrgX newOrgX oldWidth|
  3613      overallMinWidth restWidth anyChange oldOrgX newOrgX oldWidth|
  3625 
  3614 
  3626     realized ifFalse:[
  3615     realized ifFalse:[
  3627         needFitColumns := true.
  3616         needFitColumns := true.
  3628         ^ self
  3617         ^ self
  3676                 each setWidth:wEach.
  3665                 each setWidth:wEach.
  3677             ].
  3666             ].
  3678         ]
  3667         ]
  3679     ] ifFalse:[
  3668     ] ifFalse:[
  3680         anyChange ifTrue:[
  3669         anyChange ifTrue:[
  3681             | resizableColumns numberOfResizeable additionalOffsetX |
  3670             | resizableColumns numberOfResizable additionalOffsetX |
  3682 
  3671 
  3683             overallMinWidth  := 0.
  3672             overallMinWidth  := 0.
  3684             resizableColumns := OrderedCollection new.
  3673             resizableColumns := OrderedCollection new.
  3685 
  3674 
  3686             columnDescriptors do:[: eachColumn |
  3675             columnDescriptors do:[: eachColumn |
  3687                 eachColumn canResize ifTrue:[ resizableColumns add: eachColumn ].
  3676                 eachColumn canResize ifTrue:[ resizableColumns add: eachColumn ].
  3688                 eachColumn width: nil. "force a recomputation of width"
  3677                 eachColumn width: nil. "force a recomputation of width"
  3689                 overallMinWidth := overallMinWidth + eachColumn width.
  3678                 overallMinWidth := overallMinWidth + eachColumn width.
  3690             ].
  3679             ].
  3691             numberOfResizeable := resizableColumns size.
  3680             numberOfResizable := resizableColumns size.
  3692             numberOfResizeable > 0 ifTrue:[
  3681             numberOfResizable > 0 ifTrue:[
  3693                 restWidth := self innerWidth - overallMinWidth.
  3682                 restWidth := self innerWidth - overallMinWidth.
  3694 
  3683 
  3695                 restWidth > numberOfResizeable ifTrue:[
  3684                 restWidth > numberOfResizable ifTrue:[
  3696                     additionalOffsetX := restWidth // numberOfResizeable.
  3685                     additionalOffsetX := restWidth // numberOfResizable.
  3697                     resizableColumns do:[:aCol| aCol growWidth:additionalOffsetX ].
  3686                     resizableColumns do:[:aCol| aCol growWidth:additionalOffsetX ].
  3698                     restWidth := restWidth - (additionalOffsetX * numberOfResizeable).
  3687                     restWidth := restWidth - (additionalOffsetX * numberOfResizable).
  3699                 ].
  3688                 ].
  3700                 restWidth > 0 ifTrue:[ resizableColumns last growWidth:restWidth ].
  3689                 restWidth > 0 ifTrue:[ resizableColumns last growWidth:restWidth ].
  3701             ].
  3690             ].
  3702         ].
  3691         ].
  3703     ].
  3692     ].
  3744         ].
  3733         ].
  3745         oldWidth ~= self preferredWidth ifTrue:[
  3734         oldWidth ~= self preferredWidth ifTrue:[
  3746             self contentsChanged.
  3735             self contentsChanged.
  3747         ].
  3736         ].
  3748     ].
  3737     ].
       
  3738 
       
  3739     "Modified (format): / 15-03-2018 / 11:40:25 / mawalch"
  3749 !
  3740 !
  3750 
  3741 
  3751 hasSelectables
  3742 hasSelectables
  3752     columnDescriptors do:[:aCol|
  3743     columnDescriptors do:[:aCol|
  3753         (aCol rendererType == #rowSelector) ifFalse:[
  3744         (aCol rendererType == #rowSelector) ifFalse:[
  3757     ^ false.
  3748     ^ false.
  3758 !
  3749 !
  3759 
  3750 
  3760 maxViewOriginY
  3751 maxViewOriginY
  3761     "returns the maximum possible y of the view origin"
  3752     "returns the maximum possible y of the view origin"
  3762     
  3753 
  3763     |y|
  3754     |y|
  3764 
  3755 
  3765     y := self heightOfContents - self innerHeight.
  3756     y := self heightOfContents - self innerHeight.
  3766     ^ y max:0
  3757     ^ y max:0
  3767 !
  3758 !
  3768 
  3759 
  3769 updateEditViewOrigin
  3760 updateEditViewOrigin
  3770     "update origin of the editView"
  3761     "update origin of the editView"
  3771     
  3762 
  3772     |x y|
  3763     |x y|
  3773 
  3764 
  3774     editView notNil ifTrue:[
  3765     editView notNil ifTrue:[
  3775         y := self yVisibleOfRowNr:(self firstIndexSelected).
  3766         y := self yVisibleOfRowNr:(self firstIndexSelected).
  3776         x := self xVisibleOfColNr:self selectedColIndex.
  3767         x := self xVisibleOfColNr:self selectedColIndex.
  3777         editView origin:(x @ y + separatorSize).
  3768         editView origin:(x @ y + separatorSize).
  3778     ].
  3769     ].
  3779 !
  3770 !
  3780 
  3771 
  3781 xVisibleOfColNr:aColNr 
  3772 xVisibleOfColNr:aColNr
  3782     "returns visible x assigned to a column number"
  3773     "returns visible x assigned to a column number"
  3783     
  3774 
  3784     |x 
  3775     |x
  3785      end "{ Class:SmallInteger }"|
  3776      end "{ Class:SmallInteger }"|
  3786 
  3777 
  3787     x := margin - viewOrigin x.
  3778     x := margin - viewOrigin x.
  3788     aColNr > 1 ifTrue:[
  3779     aColNr > 1 ifTrue:[
  3789         end := aColNr - 1.
  3780         end := aColNr - 1.
  3790         columnDescriptors 
  3781         columnDescriptors
  3791             from:1
  3782             from:1
  3792             to:end
  3783             to:end
  3793             do:[:aCol | x := x + aCol width ]
  3784             do:[:aCol | x := x + aCol width ]
  3794     ].
  3785     ].
  3795     ^ x
  3786     ^ x
  3796 !
  3787 !
  3797 
  3788 
  3798 xVisibleToColNr:x 
  3789 xVisibleToColNr:x
  3799     "returns the column number for a physical x position.
  3790     "returns the column number for a physical x position.
  3800      Returns nil if x is beyond the last column."
  3791      Returns nil if x is beyond the last column."
  3801     
  3792 
  3802     |x0|
  3793     |x0|
  3803 
  3794 
  3804     x0 := x + viewOrigin x - margin.
  3795     x0 := x + viewOrigin x - margin.
  3805     columnDescriptors keysAndValuesDo:[:index :aCol | 
  3796     columnDescriptors keysAndValuesDo:[:index :aCol |
  3806         x0 := x0 - aCol width.
  3797         x0 := x0 - aCol width.
  3807         x0 <= 0 ifTrue:[ ^ index ].
  3798         x0 <= 0 ifTrue:[ ^ index ].
  3808     ].
  3799     ].
  3809     ^ nil.
  3800     ^ nil.
  3810 
  3801 
  3811     "Modified: / 26-03-2007 / 15:22:01 / cg"
  3802     "Modified: / 26-03-2007 / 15:22:01 / cg"
  3812 !
  3803 !
  3813 
  3804 
  3814 yVisibleOfRowNr:aRowNr 
  3805 yVisibleOfRowNr:aRowNr
  3815     "returns visible y assigned to the row number"
  3806     "returns visible y assigned to the row number"
  3816     
  3807 
  3817     ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y
  3808     ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y
  3818 !
  3809 !
  3819 
  3810 
  3820 yVisibleToRowNr:y 
  3811 yVisibleToRowNr:y
  3821     "returns the row number assigned to a physical y or nil"
  3812     "returns the row number assigned to a physical y or nil"
  3822     
  3813 
  3823     |rowNr|
  3814     |rowNr|
  3824 
  3815 
  3825     rowNr := (y + viewOrigin y - margin) // rowHeight + 1.
  3816     rowNr := (y + viewOrigin y - margin) // rowHeight + 1.
  3826     (rowNr between:1 and:(list size)) ifTrue:[
  3817     (rowNr between:1 and:(list size)) ifTrue:[
  3827         ^ rowNr
  3818         ^ rowNr
  3841     ^ editView notNil
  3832     ^ editView notNil
  3842 !
  3833 !
  3843 
  3834 
  3844 indexOfFirstRowShown
  3835 indexOfFirstRowShown
  3845     "returns the index of the first shown row"
  3836     "returns the index of the first shown row"
  3846     
  3837 
  3847     |idx|
  3838     |idx|
  3848 
  3839 
  3849     idx := (viewOrigin y // rowHeight) + 1.
  3840     idx := (viewOrigin y // rowHeight) + 1.
  3850     ^ (idx max:1)
  3841     ^ (idx max:1)
  3851 !
  3842 !
  3852 
  3843 
  3853 indexOfLastRowShown
  3844 indexOfLastRowShown
  3854     "returns the index of the last shown row"
  3845     "returns the index of the last shown row"
  3855     
  3846 
  3856     |idx|
  3847     |idx|
  3857 
  3848 
  3858     idx := (viewOrigin y + height - 1 // rowHeight) + 1.
  3849     idx := (viewOrigin y + height - 1 // rowHeight) + 1.
  3859     ^ (idx min:list size)
  3850     ^ (idx min:list size)
  3860 !
  3851 !
  3861 
  3852 
  3862 isEnabled
  3853 isEnabled
  3863     ^ enableChannel value ~~ false
  3854     ^ enableChannel value ~~ false
  3864 !
  3855 !
  3865 
  3856 
  3866 isRowSelectable:aRowNumber 
  3857 isRowSelectable:aRowNumber
  3867     "returne true if a row number is selectable"
  3858     "returne true if a row number is selectable"
  3868     
  3859 
  3869     (aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[
  3860     (aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[
  3870         selectConditionBlock isNil ifTrue:[
  3861         selectConditionBlock isNil ifTrue:[
  3871             ^ true
  3862             ^ true
  3872         ].
  3863         ].
  3873         ^ (selectConditionBlock value:aRowNumber)
  3864         ^ (selectConditionBlock value:aRowNumber)
  3875     ^ false
  3866     ^ false
  3876 !
  3867 !
  3877 
  3868 
  3878 numberOfColumns
  3869 numberOfColumns
  3879     "returns number of columns"
  3870     "returns number of columns"
  3880     
  3871 
  3881     ^ columnDescriptors size
  3872     ^ columnDescriptors size
  3882 !
  3873 !
  3883 
  3874 
  3884 numberOfRows
  3875 numberOfRows
  3885     "returns number of raws"
  3876     "returns number of rows"
  3886     
  3877 
  3887     ^ list size
  3878     ^ list size
       
  3879 
       
  3880     "Modified (comment): / 15-03-2018 / 12:23:01 / mawalch"
  3888 !
  3881 !
  3889 
  3882 
  3890 rowHeight
  3883 rowHeight
  3891     "get the height of the highest row in pixels"
  3884     "get the height of the highest row in pixels"
  3892     
  3885 
  3893     ^ rowHeight
  3886     ^ rowHeight
  3894 !
  3887 !
  3895 
  3888 
  3896 separatorSize
  3889 separatorSize
  3897     "returns vertical/horizontal size of a separator dependent on the
  3890     "returns vertical/horizontal size of a separator dependent on the
  3898      3D effect."
  3891      3D effect."
  3899     
  3892 
  3900     ^ separatorSize
  3893     ^ separatorSize
  3901 !
  3894 !
  3902 
  3895 
  3903 size
  3896 size
  3904     "returns number of raws"
  3897     "returns number of rows"
  3905     
  3898 
  3906     ^ list size
  3899     ^ list size
       
  3900 
       
  3901     "Modified (comment): / 15-03-2018 / 12:24:18 / mawalch"
  3907 !
  3902 !
  3908 
  3903 
  3909 yVisibleToLineNr:yVisible
  3904 yVisibleToLineNr:yVisible
  3910     ^ self yVisibleToRowNr:yVisible.
  3905     ^ self yVisibleToRowNr:yVisible.
  3911 ! !
  3906 ! !
  3912 
  3907 
  3913 !DSVColumnView methodsFor:'recomputation'!
  3908 !DSVColumnView methodsFor:'recomputation'!
  3914 
  3909 
  3915 computeRowHeight
  3910 computeRowHeight
  3916     |minHeight|
  3911     |minHeight|
  3917     
  3912 
  3918     minHeight := self font height.
  3913     minHeight := self font height.
  3919 
  3914 
  3920     columnDescriptors do:[:aCol | 
  3915     columnDescriptors do:[:aCol |
  3921         minHeight := (aCol heightOfHighestRow) max:minHeight.
  3916         minHeight := (aCol heightOfHighestRow) max:minHeight.
  3922     ].
  3917     ].
  3923     
  3918 
  3924     "/ to fix a double bug which compensated for not computing things correctly
  3919     "/ to fix a double bug which compensated for not computing things correctly
  3925     "/ (verticalSpacing was always computed as 2 intothe height, even if changed later,
  3920     "/ (verticalSpacing was always computed as 2 intothe height, even if changed later,
  3926     "/  it was stil in the max-of-col-heights, because minHeight was never reset, but always
  3921     "/  it was stil in the max-of-col-heights, because minHeight was never reset, but always
  3927     "/  carried on in the minRowHeight)
  3922     "/  carried on in the minRowHeight)
  3928     minHeight := 2 + minHeight + 2.
  3923     minHeight := 2 + minHeight + 2.
  3929     
  3924 
  3930     rowHeight := (verticalSpacing + minHeight + verticalSpacing + separatorSize).
  3925     rowHeight := (verticalSpacing + minHeight + verticalSpacing + separatorSize).
  3931     minRowHeight := rowHeight.
  3926     minRowHeight := rowHeight.
  3932 
  3927 
  3933     "Created: / 13-09-2017 / 15:32:28 / cg"
  3928     "Created: / 13-09-2017 / 15:32:28 / cg"
  3934 !
  3929 !
  3935 
  3930 
  3936 hasPreferredExtent
  3931 hasPreferredExtent
  3937     "returns true if preferred extent is accumulated"
  3932     "returns true if preferred extent is accumulated"
  3938     
  3933 
  3939     ^ cachedPreferredExtent notNil
  3934     ^ cachedPreferredExtent notNil
  3940 !
  3935 !
  3941 
  3936 
  3942 preferredExtent
  3937 preferredExtent
  3943     "return my preferred extent"
  3938     "return my preferred extent"
  3956     ].
  3951     ].
  3957     cachedPreferredExtent notNil ifTrue:[
  3952     cachedPreferredExtent notNil ifTrue:[
  3958         ^ cachedPreferredExtent
  3953         ^ cachedPreferredExtent
  3959     ].
  3954     ].
  3960     self computeRowHeight.
  3955     self computeRowHeight.
  3961     
  3956 
  3962     prefWidth := (columnDescriptors size - 1) max:0.  "/ for the separators
  3957     prefWidth := (columnDescriptors size - 1) max:0.  "/ for the separators
  3963     columnDescriptors do:[:aCol | 
  3958     columnDescriptors do:[:aCol |
  3964         prefWidth := prefWidth + (aCol minWidth max:5).
  3959         prefWidth := prefWidth + (aCol minWidth max:5).
  3965     ].
  3960     ].
  3966     numRows := list size.
  3961     numRows := list size.
  3967 
  3962 
  3968     "/ no need for a separator after the last row.
  3963     "/ no need for a separator after the last row.
  3974     "Modified: / 13-09-2017 / 15:53:27 / cg"
  3969     "Modified: / 13-09-2017 / 15:53:27 / cg"
  3975 !
  3970 !
  3976 
  3971 
  3977 preferredExtentChanged
  3972 preferredExtentChanged
  3978     "called if the preferred extent changed"
  3973     "called if the preferred extent changed"
  3979     
  3974 
  3980     |x "{ Class:SmallInteger }"
  3975     |x "{ Class:SmallInteger }"
  3981      y "{ Class:SmallInteger }"|
  3976      y "{ Class:SmallInteger }"|
  3982 
  3977 
  3983     y := viewOrigin y.
  3978     y := viewOrigin y.
  3984     x := viewOrigin x.
  3979     x := viewOrigin x.
  4003 
  3998 
  4004 !DSVColumnView methodsFor:'scroller interface'!
  3999 !DSVColumnView methodsFor:'scroller interface'!
  4005 
  4000 
  4006 innerHeight
  4001 innerHeight
  4007     "returns the inner height of the contents shown"
  4002     "returns the inner height of the contents shown"
  4008     
  4003 
  4009     ^ height - margin - margin
  4004     ^ height - margin - margin
  4010 !
  4005 !
  4011 
  4006 
  4012 verticalScrollStep
  4007 verticalScrollStep
  4013     "return the amount to scroll when stepping up/down (also used for mouseWheel)."
  4008     "return the amount to scroll when stepping up/down (also used for mouseWheel)."
  4014     
  4009 
  4015     ^ rowHeight
  4010     ^ rowHeight
  4016 !
  4011 !
  4017 
  4012 
  4018 viewOrigin
  4013 viewOrigin
  4019     "return the viewOrigin; 
  4014     "return the viewOrigin;
  4020      that's the coordinate of the contents which is shown topLeft in the view."
  4015      that's the coordinate of the contents which is shown topLeft in the view."
  4021     
  4016 
  4022     ^ viewOrigin
  4017     ^ viewOrigin
  4023 !
  4018 !
  4024 
  4019 
  4025 widthOfContents
  4020 widthOfContents
  4026     "return the width of the contents in pixels"
  4021     "return the width of the contents in pixels"
  4027     
  4022 
  4028     cachedPreferredExtent isNil ifTrue:[
  4023     cachedPreferredExtent isNil ifTrue:[
  4029         self preferredExtent
  4024         self preferredExtent
  4030     ].
  4025     ].
  4031     ^ cachedPreferredExtent x
  4026     ^ cachedPreferredExtent x
  4032 !
  4027 !
  4033 
  4028 
  4034 xOriginOfContents
  4029 xOriginOfContents
  4035     "return the horizontal origin of the contents in pixels"
  4030     "return the horizontal origin of the contents in pixels"
  4036     
  4031 
  4037     ^ viewOrigin x
  4032     ^ viewOrigin x
  4038 !
  4033 !
  4039 
  4034 
  4040 yOriginOfContents
  4035 yOriginOfContents
  4041     "return the vertical origin of the contents in pixels"
  4036     "return the vertical origin of the contents in pixels"
  4042     
  4037 
  4043     ^ viewOrigin y
  4038     ^ viewOrigin y
  4044 ! !
  4039 ! !
  4045 
  4040 
  4046 !DSVColumnView methodsFor:'scrolling'!
  4041 !DSVColumnView methodsFor:'scrolling'!
  4047 
  4042 
  4130             w  := width - dX.
  4125             w  := width - dX.
  4131             lMargin := labelView margin.
  4126             lMargin := labelView margin.
  4132 
  4127 
  4133             dltOrg x < 0 ifTrue:[
  4128             dltOrg x < 0 ifTrue:[
  4134                 " ->"
  4129                 " ->"
  4135                 x0 := x := margin. 
  4130                 x0 := x := margin.
  4136                 self copyFrom:self x:margin y:margin toX:margin+dX y:margin width:innerWT-dX height:innerHG async:false.
  4131                 self copyFrom:self x:margin y:margin toX:margin+dX y:margin width:innerWT-dX height:innerHG async:false.
  4137                 self invalidateX:margin y:margin width:dX height:innerHG.
  4132                 self invalidateX:margin y:margin width:dX height:innerHG.
  4138 
  4133 
  4139                 labelView notNil ifTrue:[
  4134                 labelView notNil ifTrue:[
  4140                     labelView copyFrom:labelView x:lMargin y:lMargin toX:lMargin+dX y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false.
  4135                     labelView copyFrom:labelView x:lMargin y:lMargin toX:lMargin+dX y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false.
  4256         self compressMotionEvents:false.
  4251         self compressMotionEvents:false.
  4257     ].
  4252     ].
  4258 
  4253 
  4259     timeDelta := 0.5 / (aDistance abs).
  4254     timeDelta := 0.5 / (aDistance abs).
  4260 
  4255 
  4261     scrollBlock := 
  4256     scrollBlock :=
  4262         [
  4257         [
  4263             aSelectorOrBlock isSymbol ifTrue:[
  4258             aSelectorOrBlock isSymbol ifTrue:[
  4264                 self perform:aSelectorOrBlock.
  4259                 self perform:aSelectorOrBlock.
  4265             ] ifFalse:[
  4260             ] ifFalse:[
  4266                 aSelectorOrBlock value
  4261                 aSelectorOrBlock value
  4285 ! !
  4280 ! !
  4286 
  4281 
  4287 !DSVColumnView methodsFor:'searching'!
  4282 !DSVColumnView methodsFor:'searching'!
  4288 
  4283 
  4289 findFirstColumnWithStringFrom:start to:stop
  4284 findFirstColumnWithStringFrom:start to:stop
  4290     start to:stop do:[:eachNr| 
  4285     start to:stop do:[:eachNr|
  4291         |row lbl|
  4286         |row lbl|
  4292 
  4287 
  4293         row := self at:eachNr.
  4288         row := self at:eachNr.
  4294         columnDescriptors keysAndValuesDo:[:colNr :col |    
  4289         columnDescriptors keysAndValuesDo:[:colNr :col |
  4295             lbl := col shownValueForRow:row rowNr:eachNr.
  4290             lbl := col shownValueForRow:row rowNr:eachNr.
  4296 
  4291 
  4297             lbl isNonByteCollection ifTrue:[
  4292             lbl isNonByteCollection ifTrue:[
  4298                 lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
  4293                 lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
  4299             ].
  4294             ].
  4317     aString isEmptyOrNil ifTrue:[
  4312     aString isEmptyOrNil ifTrue:[
  4318         ^ self
  4313         ^ self
  4319     ].
  4314     ].
  4320     stringToMatch := '*', aString, '*'.
  4315     stringToMatch := '*', aString, '*'.
  4321 
  4316 
  4322     start to:stop by:step do:[:rowNr| 
  4317     start to:stop by:step do:[:rowNr|
  4323         |row lbl|
  4318         |row lbl|
  4324 
  4319 
  4325         row := self at:rowNr.
  4320         row := self at:rowNr.
  4326         columnDescriptors keysAndValuesDo:[:colNr :col |    
  4321         columnDescriptors keysAndValuesDo:[:colNr :col |
  4327             lbl := col shownValueForRow:row rowNr:rowNr.
  4322             lbl := col shownValueForRow:row rowNr:rowNr.
  4328 
  4323 
  4329             lbl isNonByteCollection ifTrue:[
  4324             lbl isNonByteCollection ifTrue:[
  4330                 lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
  4325                 lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
  4331             ].
  4326             ].
  4334             ].
  4329             ].
  4335             lbl isNumber ifTrue:[
  4330             lbl isNumber ifTrue:[
  4336                 lbl := lbl printString.
  4331                 lbl := lbl printString.
  4337             ].
  4332             ].
  4338 
  4333 
  4339             (lbl size ~~ 0 
  4334             (lbl size ~~ 0
  4340                 and:[(lbl at:1) isCharacter 
  4335                 and:[(lbl at:1) isCharacter
  4341                 and:[stringToMatch match:lbl caseSensitive:ignoreCase not
  4336                 and:[stringToMatch match:lbl caseSensitive:ignoreCase not
  4342             ]]) ifTrue:[
  4337             ]]) ifTrue:[
  4343                 ^ rowNr
  4338                 ^ rowNr
  4344             ]
  4339             ]
  4345         ]
  4340         ]
  4354     ^ self findFirstRowWithString:aString from:start to:stop by:1 ignoreCase:ignoreCase
  4349     ^ self findFirstRowWithString:aString from:start to:stop by:1 ignoreCase:ignoreCase
  4355 ! !
  4350 ! !
  4356 
  4351 
  4357 !DSVColumnView methodsFor:'selection'!
  4352 !DSVColumnView methodsFor:'selection'!
  4358 
  4353 
  4359 addRowToSelection:aRowNr 
  4354 addRowToSelection:aRowNr
  4360     "add a row to the selection
  4355     "add a row to the selection
  4361      if a column is selected, the column will be closed"
  4356      if a column is selected, the column will be closed"
  4362     
  4357 
  4363     |newSelection|
  4358     |newSelection|
  4364 
  4359 
  4365     (self isRowSelectable:aRowNr) ifFalse:[
  4360     (self isRowSelectable:aRowNr) ifFalse:[
  4366         ^ self
  4361         ^ self
  4367     ].
  4362     ].
  4402     ^ 0
  4397     ^ 0
  4403 !
  4398 !
  4404 
  4399 
  4405 forceAcceptInEditor
  4400 forceAcceptInEditor
  4406     editView notNil ifTrue:[
  4401     editView notNil ifTrue:[
  4407         editView 
  4402         editView
  4408             allSubViewsDo:[:aSubView | 
  4403             allSubViewsDo:[:aSubView |
  4409                 (aSubView respondsTo:#accept) ifTrue:[
  4404                 (aSubView respondsTo:#accept) ifTrue:[
  4410                     aSubView accept
  4405                     aSubView accept
  4411                 ].
  4406                 ].
  4412             ]
  4407             ]
  4413     ]
  4408     ]
  4414 !
  4409 !
  4415 
  4410 
  4416 hasRowSelection
  4411 hasRowSelection
  4417     "returns true if a selection exists, and its a complete row
  4412     "returns true if a selection exists, and its a complete row
  4418      (as opposed to either no selection, or a columnSelection)"
  4413      (as opposed to either no selection, or a columnSelection)"
  4419     
  4414 
  4420     ^ self hasSelection and:[ self selectedColIndex == 0 ]
  4415     ^ self hasSelection and:[ self selectedColIndex == 0 ]
  4421 !
  4416 !
  4422 
  4417 
  4423 hasSelection
  4418 hasSelection
  4424     "returns true if a selection exists"
  4419     "returns true if a selection exists"
  4438         ]
  4433         ]
  4439     ].
  4434     ].
  4440     ^ false
  4435     ^ false
  4441 !
  4436 !
  4442 
  4437 
  4443 isRowSelected:aRowNr 
  4438 isRowSelected:aRowNr
  4444     "returns true, if row is in the selection"
  4439     "returns true, if row is in the selection"
  4445     
  4440 
  4446     self selectedColIndex == 0 ifTrue:[
  4441     self selectedColIndex == 0 ifTrue:[
  4447         ^ self isInSelection:aRowNr
  4442         ^ self isInSelection:aRowNr
  4448     ].
  4443     ].
  4449     ^ false
  4444     ^ false
  4450 !
  4445 !
  4456     y := self yVisibleOfRowNr:aRowNr.
  4451     y := self yVisibleOfRowNr:aRowNr.
  4457 
  4452 
  4458     y < margin ifTrue:[
  4453     y < margin ifTrue:[
  4459         (h := h + y) <= margin ifTrue:[
  4454         (h := h + y) <= margin ifTrue:[
  4460             ^ false
  4455             ^ false
  4461         ].                                            
  4456         ].
  4462     ] ifFalse:[
  4457     ] ifFalse:[
  4463         y >= (height-margin) ifTrue:[^ false].
  4458         y >= (height-margin) ifTrue:[^ false].
  4464     ].
  4459     ].
  4465     ^ true
  4460     ^ true
  4466 !
  4461 !
  4467 
  4462 
  4468 isSelected:aRowNr inColumn:aColNr 
  4463 isSelected:aRowNr inColumn:aColNr
  4469     "returns true if cell in a row; a row number, in a column, a column
  4464     "returns true if cell in a row; a row number, in a column, a column
  4470      number is selected."
  4465      number is selected."
  4471     
  4466 
  4472     multipleSelectOk ifFalse:[
  4467     multipleSelectOk ifFalse:[
  4473         aRowNr ~~ selectedRowIndex ifTrue:[
  4468         aRowNr ~~ selectedRowIndex ifTrue:[
  4474             ^ false
  4469             ^ false
  4475         ]
  4470         ]
  4476     ] ifTrue:[
  4471     ] ifTrue:[
  4501         ^ selectedRowIndex last
  4496         ^ selectedRowIndex last
  4502     ].
  4497     ].
  4503     ^ 0
  4498     ^ 0
  4504 !
  4499 !
  4505 
  4500 
  4506 makeLineVisible:aLine 
  4501 makeLineVisible:aLine
  4507     "scroll to make aLine visible"
  4502     "scroll to make aLine visible"
  4508     
  4503 
  4509     |colNr|
  4504     |colNr|
  4510 
  4505 
  4511     aLine == 0 ifTrue:[
  4506     aLine == 0 ifTrue:[
  4512         ^ self
  4507         ^ self
  4513     ].
  4508     ].
  4520     self scrollToRowAt:aLine colAt:colNr
  4515     self scrollToRowAt:aLine colAt:colNr
  4521 !
  4516 !
  4522 
  4517 
  4523 makeSelectionVisible
  4518 makeSelectionVisible
  4524     "scroll to make the selection line visible"
  4519     "scroll to make the selection line visible"
  4525     
  4520 
  4526     |rowNr colNr|
  4521     |rowNr colNr|
  4527 
  4522 
  4528     rowNr := self firstIndexSelected.
  4523     rowNr := self firstIndexSelected.
  4529     rowNr == 0 ifTrue:[
  4524     rowNr == 0 ifTrue:[
  4530         ^ self
  4525         ^ self
  4587 
  4582 
  4588     rowIdx isSequenceable ifTrue:[
  4583     rowIdx isSequenceable ifTrue:[
  4589         rowIdx := rowIdx at:1 ifAbsent:[ ^ self ].
  4584         rowIdx := rowIdx at:1 ifAbsent:[ ^ self ].
  4590     ].
  4585     ].
  4591 
  4586 
  4592     editorAndModel := column editorForRowAt:rowIdx.      
  4587     editorAndModel := column editorForRowAt:rowIdx.
  4593     editorAndModel isNil ifTrue:[^ self].
  4588     editorAndModel isNil ifTrue:[^ self].
  4594 
  4589 
  4595     autoScrollToColumn == true ifTrue:[
  4590     autoScrollToColumn == true ifTrue:[
  4596         self scrollToRowAt:rowIdx colAt:colIdx.
  4591         self scrollToRowAt:rowIdx colAt:colIdx.
  4597     ].
  4592     ].
  4598 
  4593 
  4599     editView := SimpleView 
  4594     editView := SimpleView
  4600                 extent:((column width - (2 * separatorSize)) 
  4595                 extent:((column width - (2 * separatorSize))
  4601                         @ (rowHeight - (2 * separatorSize)))
  4596                         @ (rowHeight - (2 * separatorSize)))
  4602                 in:self.
  4597                 in:self.
  4603 
  4598 
  4604     self updateEditViewOrigin.
  4599     self updateEditViewOrigin.
  4605 
  4600 
  4627         ] ifFalse:[
  4622         ] ifFalse:[
  4628             "/ steal TAB, RETURN and Curosr Keys from the editor
  4623             "/ steal TAB, RETURN and Curosr Keys from the editor
  4629             filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown #Return ) includes:aKey ]
  4624             filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown #Return ) includes:aKey ]
  4630         ].
  4625         ].
  4631     ].
  4626     ].
  4632     keyBrdFwd := KeyboardForwarder 
  4627     keyBrdFwd := KeyboardForwarder
  4633                 toView:self
  4628                 toView:self
  4634                 condition:nil
  4629                 condition:nil
  4635                 filter:filter.
  4630                 filter:filter.
  4636     editView 
  4631     editView
  4637         withAllSubViewsDo:[:aView | 
  4632         withAllSubViewsDo:[:aView |
  4638             aView delegate:keyBrdFwd.
  4633             aView delegate:keyBrdFwd.
  4639             aView font:self font.
  4634             aView font:self font.
  4640         ].
  4635         ].
  4641 
  4636 
  4642     (editValue := editorAndModel model) notNil ifTrue:[
  4637     (editValue := editorAndModel model) notNil ifTrue:[
  4654 
  4649 
  4655 processAllExposeEvents
  4650 processAllExposeEvents
  4656     |sensor|
  4651     |sensor|
  4657 
  4652 
  4658     sensor := self sensor.
  4653     sensor := self sensor.
  4659     [ 
  4654     [
  4660         sensor hasExposeEventFor:nil
  4655         sensor hasExposeEventFor:nil
  4661     ] whileTrue:[
  4656     ] whileTrue:[
  4662         self windowGroup processExposeEvents
  4657         self windowGroup processExposeEvents
  4663     ].
  4658     ].
  4664 
  4659 
  4716     oldCol := self selectedColIndex.
  4711     oldCol := self selectedColIndex.
  4717     oldRow := self selectedRowIndex.
  4712     oldRow := self selectedRowIndex.
  4718 
  4713 
  4719     self setSelectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor.
  4714     self setSelectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor.
  4720 
  4715 
  4721     (oldCol ~~ self selectedColIndex 
  4716     (oldCol ~~ self selectedColIndex
  4722     or:[oldRow ~= self selectedRowIndex
  4717     or:[oldRow ~= self selectedRowIndex
  4723     or:[ignoreReselect == false]]) ifTrue:[
  4718     or:[ignoreReselect == false]]) ifTrue:[
  4724         self selectionChanged:aColNr
  4719         self selectionChanged:aColNr
  4725     ].
  4720     ].
  4726 !
  4721 !
  4765     ].
  4760     ].
  4766 
  4761 
  4767     shouldClick ifTrue:[
  4762     shouldClick ifTrue:[
  4768         "/ simulate clicking into the editor
  4763         "/ simulate clicking into the editor
  4769         self breakPoint:#ca.
  4764         self breakPoint:#ca.
  4770         (view ~~ self and:[view notNil]) ifTrue:[ 
  4765         (view ~~ self and:[view notNil]) ifTrue:[
  4771             p := device translatePoint:aPoint fromView:self toView:view.
  4766             p := device translatePoint:aPoint fromView:self toView:view.
  4772             self sensor 
  4767             self sensor
  4773                     pushEvent:(WindowEvent   buttonPress:1 x:p x y:p y view:view);
  4768                     pushEvent:(WindowEvent   buttonPress:1 x:p x y:p y view:view);
  4774                     pushEvent:(WindowEvent buttonRelease:1 x:p x y:p y view:view).
  4769                     pushEvent:(WindowEvent buttonRelease:1 x:p x y:p y view:view).
  4775 
  4770 
  4776 "/        "/ a very special hack for radioButtons:
  4771 "/        "/ a very special hack for radioButtons:
  4777 "/        "/ if the button is now on, all other cells must be turned off !!
  4772 "/        "/ if the button is now on, all other cells must be turned off !!
  4787 
  4782 
  4788     "Modified: / 07-09-2011 / 16:08:45 / cg"
  4783     "Modified: / 07-09-2011 / 16:08:45 / cg"
  4789     "Modified: / 15-03-2017 / 21:09:54 / stefan"
  4784     "Modified: / 15-03-2017 / 21:09:54 / stefan"
  4790 !
  4785 !
  4791 
  4786 
  4792 selectRowFrom:start to:stop 
  4787 selectRowFrom:start to:stop
  4793     |step oldSelection newSelection|
  4788     |step oldSelection newSelection|
  4794 
  4789 
  4795     start == stop ifTrue:[
  4790     start == stop ifTrue:[
  4796         self selectColIndex:0 rowIndex:start.
  4791         self selectColIndex:0 rowIndex:start.
  4797         ^ self
  4792         ^ self
  4798     ].
  4793     ].
  4799     step := (start <= stop) ifTrue:1 ifFalse:-1.
  4794     step := (start <= stop) ifTrue:1 ifFalse:-1.
  4800     newSelection := (start to:stop by:step) 
  4795     newSelection := (start to:stop by:step)
  4801                 select:[:idx | self isRowSelectable:idx ].
  4796                 select:[:idx | self isRowSelectable:idx ].
  4802     self selectedColIndex ~~ 0 ifTrue:[
  4797     self selectedColIndex ~~ 0 ifTrue:[
  4803         self selectColIndex:0 rowIndex:newSelection.
  4798         self selectColIndex:0 rowIndex:newSelection.
  4804         ^ self
  4799         ^ self
  4805     ].
  4800     ].
  4806     oldSelection := selectedRowIndex ? #().
  4801     oldSelection := selectedRowIndex ? #().
  4807     selectedRowIndex := newSelection.
  4802     selectedRowIndex := newSelection.
  4808     newSelection 
  4803     newSelection
  4809         select:[:i | (oldSelection includes:i) not ]
  4804         select:[:i | (oldSelection includes:i) not ]
  4810         thenDo:[:i | self invalidateRowAt:i ].
  4805         thenDo:[:i | self invalidateRowAt:i ].
  4811     oldSelection 
  4806     oldSelection
  4812         select:[:i | (newSelection includes:i) not ]
  4807         select:[:i | (newSelection includes:i) not ]
  4813         thenDo:[:i | self invalidateRowAt:i ].
  4808         thenDo:[:i | self invalidateRowAt:i ].
  4814     self selectionChanged.
  4809     self selectionChanged.
  4815 !
  4810 !
  4816 
  4811 
  4817 selectRowIndex:something 
  4812 selectRowIndex:something
  4818     "set selection of rows"
  4813     "set selection of rows"
  4819     
  4814 
  4820     self selectColIndex:self selectedColIndex rowIndex:something
  4815     self selectColIndex:self selectedColIndex rowIndex:something
  4821 !
  4816 !
  4822 
  4817 
  4823 selectedColIndex
  4818 selectedColIndex
  4824     "returns selected column number or 0"
  4819     "returns selected column number or 0"
  4826     ^ self selectedColIndexHolder value
  4821     ^ self selectedColIndexHolder value
  4827 !
  4822 !
  4828 
  4823 
  4829 selectedColumn
  4824 selectedColumn
  4830     "returns selected column or nil"
  4825     "returns selected column or nil"
  4831     
  4826 
  4832     ^ columnDescriptors at:self selectedColIndex ifAbsent:nil.
  4827     ^ columnDescriptors at:self selectedColIndex ifAbsent:nil.
  4833 !
  4828 !
  4834 
  4829 
  4835 selectedRow
  4830 selectedRow
  4836     "returns the selected row (or collection if multiple selection) or nil"
  4831     "returns the selected row (or collection if multiple selection) or nil"
  4837     
  4832 
  4838     multipleSelectOk ifFalse:[
  4833     multipleSelectOk ifFalse:[
  4839         ^ self at:selectedRowIndex ifAbsent:nil
  4834         ^ self at:selectedRowIndex ifAbsent:nil
  4840     ].
  4835     ].
  4841     selectedRowIndex size ~~ 0 ifTrue:[
  4836     selectedRowIndex size ~~ 0 ifTrue:[
  4842         ^ selectedRowIndex collect:[:i | self at:i ]
  4837         ^ selectedRowIndex collect:[:i | self at:i ]
  4843     ].
  4838     ].
  4844     ^ nil
  4839     ^ nil
  4845 !
  4840 !
  4846 
  4841 
  4847 selectedRow:something 
  4842 selectedRow:something
  4848     "select something"
  4843     "select something"
  4849     
  4844 
  4850     self selectedRowIndex:something
  4845     self selectedRowIndex:something
  4851 !
  4846 !
  4852 
  4847 
  4853 selectedRowIndex
  4848 selectedRowIndex
  4854     "returns selected row number or 0"
  4849     "returns selected row number or 0"
  4855     
  4850 
  4856     ^ selectedRowIndex
  4851     ^ selectedRowIndex
  4857 !
  4852 !
  4858 
  4853 
  4859 selectedRowIndex:rowOrCollectionOfRows 
  4854 selectedRowIndex:rowOrCollectionOfRows
  4860     "set the row selection (single or multiple rows);
  4855     "set the row selection (single or multiple rows);
  4861      does NOT change the selected column."
  4856      does NOT change the selected column."
  4862     
  4857 
  4863     self selectColIndex:(self selectedColIndex) rowIndex:rowOrCollectionOfRows
  4858     self selectColIndex:(self selectedColIndex) rowIndex:rowOrCollectionOfRows
  4864 !
  4859 !
  4865 
  4860 
  4866 selectionChanged
  4861 selectionChanged
  4867     "selection has changed"
  4862     "selection has changed"
  4868     
  4863 
  4869     self selectionChanged:nil
  4864     self selectionChanged:nil
  4870 !
  4865 !
  4871 
  4866 
  4872 selectionChanged:colNrOrNil
  4867 selectionChanged:colNrOrNil
  4873     "selection has changed"
  4868     "selection has changed"
  4874     
  4869 
  4875     |val|
  4870     |val|
  4876 
  4871 
  4877     model notNil ifTrue:[
  4872     model notNil ifTrue:[
  4878         val := self selectedRowIndex copy.
  4873         val := self selectedRowIndex copy.
  4879         (model respondsTo:#selectionIndex:) ifTrue:[
  4874         (model respondsTo:#selectionIndex:) ifTrue:[
  4896             actionBlock valueWithOptionalArgument:(self selectedRowIndex) and:colNrOrNil
  4891             actionBlock valueWithOptionalArgument:(self selectedRowIndex) and:colNrOrNil
  4897         ].
  4892         ].
  4898     ]
  4893     ]
  4899 !
  4894 !
  4900 
  4895 
  4901 selectionIndicesDo:aOneArgBlock 
  4896 selectionIndicesDo:aOneArgBlock
  4902     "evaluate block on each row selected; the argument to the row
  4897     "evaluate block on each row selected; the argument to the row
  4903      is the index of the selected row"
  4898      is the index of the selected row"
  4904     
  4899 
  4905     multipleSelectOk ifFalse:[
  4900     multipleSelectOk ifFalse:[
  4906         selectedRowIndex ~~ 0 ifTrue:[
  4901         selectedRowIndex ~~ 0 ifTrue:[
  4907             aOneArgBlock value:selectedRowIndex
  4902             aOneArgBlock value:selectedRowIndex
  4908         ]
  4903         ]
  4909     ] ifTrue:[
  4904     ] ifTrue:[
  4911             selectedRowIndex do:aOneArgBlock
  4906             selectedRowIndex do:aOneArgBlock
  4912         ]
  4907         ]
  4913     ]
  4908     ]
  4914 !
  4909 !
  4915 
  4910 
  4916 setSelectColIndex:colNrArg rowIndex:rowNrArg 
  4911 setSelectColIndex:colNrArg rowIndex:rowNrArg
  4917     "change selection without notification"
  4912     "change selection without notification"
  4918 
  4913 
  4919     self setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:true
  4914     self setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:true
  4920 !
  4915 !
  4921 
  4916 
  4924 
  4919 
  4925     |rowNr colNr newCol oldCol oldRow sglSelRow oldSz winGroup|
  4920     |rowNr colNr newCol oldCol oldRow sglSelRow oldSz winGroup|
  4926 
  4921 
  4927     rowNr := self validateSelection:rowNrArg.
  4922     rowNr := self validateSelection:rowNrArg.
  4928     rowNr isNil ifTrue:[
  4923     rowNr isNil ifTrue:[
  4929         rowNr := multipleSelectOk ifTrue:[#()] ifFalse:[0].        
  4924         rowNr := multipleSelectOk ifTrue:[#()] ifFalse:[0].
  4930     ].
  4925     ].
  4931 
  4926 
  4932     colNr := colNrArg.
  4927     colNr := colNrArg.
  4933     rowNr == 0 ifTrue:[
  4928     rowNr == 0 ifTrue:[
  4934         colNr := 0.
  4929         colNr := 0.
  4987     winGroup := self windowGroup.
  4982     winGroup := self windowGroup.
  4988     winGroup isNil ifTrue:[^ self ].
  4983     winGroup isNil ifTrue:[^ self ].
  4989 
  4984 
  4990     oldSz > 1 ifTrue:[
  4985     oldSz > 1 ifTrue:[
  4991         "/ redraw old selection
  4986         "/ redraw old selection
  4992         oldRow do:[:aRowNr | 
  4987         oldRow do:[:aRowNr |
  4993             "/ unselected if visible
  4988             "/ unselected if visible
  4994             self invalidateRowAt:aRowNr colAt:0
  4989             self invalidateRowAt:aRowNr colAt:0
  4995         ]
  4990         ]
  4996     ] ifFalse:[
  4991     ] ifFalse:[
  4997         oldSz == 1 ifTrue:[
  4992         oldSz == 1 ifTrue:[
  5082     "
  5077     "
  5083     aSelection size ~~ 0 ifTrue:[
  5078     aSelection size ~~ 0 ifTrue:[
  5084         aSelection first isInteger ifTrue:[
  5079         aSelection first isInteger ifTrue:[
  5085             newSel := aSelection select:[:idx| self isRowSelectable:idx ].
  5080             newSel := aSelection select:[:idx| self isRowSelectable:idx ].
  5086         ] ifFalse:[
  5081         ] ifFalse:[
  5087             newSel := aSelection 
  5082             newSel := aSelection
  5088                             collect:[:el| self identityIndexOfRow:el ]
  5083                             collect:[:el| self identityIndexOfRow:el ]
  5089                             thenSelect:[:idx| self isRowSelectable:idx ].
  5084                             thenSelect:[:idx| self isRowSelectable:idx ].
  5090         ].
  5085         ].
  5091         newSel notEmpty ifTrue:[
  5086         newSel notEmpty ifTrue:[
  5092             ^ newSel
  5087             ^ newSel