DSVColumnView.st
author Claus Gittinger <cg@exept.de>
Sat, 02 May 2020 19:50:29 +0200
changeset 6244 2050c2ab251c
parent 6236 ddfc83270532
permissions -rw-r--r--
#REFACTORING by cg class: HierarchicalItem::Example changed: #children (send #label:icon: instead of #labeled:icon:, send #label: instead of #labeled:) class: HierarchicalItem::Example class added: #label: #label:icon: changed: #labeled: #labeled:icon:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6236
ddfc83270532 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6220
diff changeset
     1
"{ Encoding: utf8 }"
ddfc83270532 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6220
diff changeset
     2
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     3
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     4
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     5
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     6
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    12
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    13
"
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
    15
4772
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
    16
"{ NameSpace: Smalltalk }"
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
    17
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    18
View subclass:#DSVColumnView
6054
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    19
	instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    20
		selectedColIndexHolder selectedRowIndex selectRowOnDefault
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    21
		buttonMotionAction buttonReleaseAction rowHeight minRowHeight
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    22
		columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    23
		rowIfAbsentBlock columnHolder registererImages list fgColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    24
		separatorSize catchChangeEvents beDependentOfRows bgColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    25
		actionBlock builder tabIntern doubleClickActionBlock
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    26
		verticalSpacing horizontalSpacing rowSelectorForm
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    27
		buttonLightColor buttonShadowColor buttonHalfLightColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    28
		buttonHalfShadowColor checkToggleExtent checkToggleForm
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    29
		checkToggleActiveImage checkTogglePassiveImage
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    30
		checkToggleDisabledActiveImage checkToggleDisabledPassiveImage
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    31
		checkToggleLevel radioButtonActiveImage radioButtonPassiveImage
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    32
		radioButtonDisabledActiveImage radioButtonDisabledPassiveImage
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    33
		comboButtonExtent comboButtonForm comboButtonDisabledForm
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    34
		comboButtonLevel dropSource columnAdaptor tabAtEndAction
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    35
		tabAtStartAction modifiedChannel autoScroll autoScrollBlock
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    36
		needFitColumns scrollWhenUpdating separatorOneDColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    37
		selectionForegroundColor selectionForegroundColorNoFocus
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    38
		selectionBackgroundColor selectionBackgroundColorNoFocus
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    39
		selectionFrameColor selectionFrameColorNoFocus previousExtent
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    40
		selectConditionBlock scrollRowWise autoScrollToColumn
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    41
		cachedPreferredExtent sortListInPlace labelFgColor labelBgColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    42
		updateListHolderWhenSorting ignoreReselect didEditWithDialog'
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    43
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    44
		DefaultHilightForegroundColor DefaultHilightBackgroundColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    45
		DefaultHilightFrameColor ButtonLightColor ButtonShadowColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    46
		CheckToggleActiveImage CheckTogglePassiveImage
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    47
		CheckToggleDisabledActiveImage CheckToggleDisabledPassiveImage
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    48
		ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    49
		CheckToggleForm CheckToggleLevel CheckToggleExtent
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    50
		ComboButtonForm ComboButtonDisabledForm ComboButtonLevel
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    51
		ComboButtonExtent StopRedrawSignal RadioButtonActiveImage
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    52
		RadioButtonPassiveImage RadioButtonDisabledActiveImage
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    53
		RadioButtonDisabledPassiveImage PreselectAllWhenOpeningEditor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    54
		DefaultHilightForegroundColorNoFocus
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    55
		DefaultHilightBackgroundColorNoFocus DefaultLabelForegroundColor
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    56
		DefaultLabelBackgroundColor'
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    57
	poolDictionaries:''
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
    58
	category:'Views-DataSet'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    59
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    60
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    61
!DSVColumnView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    62
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    63
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    64
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    65
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    66
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    67
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    68
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    69
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    70
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    71
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    72
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    73
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    74
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    75
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    76
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    77
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    78
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    79
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    80
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    81
"
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    82
    ColumnView part of a DataSetView.
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    83
    implements a scrollable selection view based on rows and columns.
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    84
    Used as the contents-part of a DataSetView.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    85
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    86
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    87
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    88
        editValue               <Model>                 current editing model
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    89
        editView                <View>                  current editing component
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    90
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    91
        buttonReleaseAction     <Action or nil>         called if the mouse button is released
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    92
        buttonMotionAction      <Action or nil>         called during mouse motion with one
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    93
                                                        argument the point under the mouse.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    94
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    95
        multipleSelectOk        <Boolean>               multiple selection enabled/disabled
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    96
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    97
        selectedColIndex        <Integer>               selected column index or 0
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    98
        selectedRowIndex        <Integer>               selected row    index or 0
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    99
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   100
        rowHeight               <Integer>               maximum height of any row
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   101
        minRowHeight            <Integer>               minimum height of all displayed labels
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   102
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   103
        columnDescriptors       <SequancableCollection> list of column descriptors
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   104
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   105
        viewOrigin              <Point>                 current view origin
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   106
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   107
        colorMap                <Dictionary>            store and register used colors on device
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   108
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   109
        rowFontAscent           <SmallInteger>          inset of a printable text in a row
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   110
                                                        including separator and font ascent.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   111
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   112
        lockRowIndex            <SmallInteger>          internal used to indicate a row which has
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   113
                                                        changed its contents but no redraw should be
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   114
                                                        done( at:put: ).
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   115
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   116
        columnHolder            <ValueHolder>           holder which keeps the list of column descriptors.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   117
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   118
        registererImages        <IdentityDictionary>    list of images registered on the device
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   119
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   120
        list                    <SequancableCollection> list of rows
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   121
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   122
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   123
        catchChangeEvents       <Boolean>               internal used to discard change notifications
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   124
6220
146bef92a240 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6180
diff changeset
   125
        beDependentOfRows       <Boolean>               keep rows dependent; by default is disabled.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   126
                                                        in case of enabled a row can raise a change
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   127
                                                        notification whithout a parameter which
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   128
                                                        will force a redraw of the row or the
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   129
                                                        readSelector of the column which will
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   130
                                                        redraw the cell in the row only.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   131
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   132
        fgColor                 <Color>                 foreground color
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   133
        bgColor                 <Color>                 background color
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   134
        hgLgFgColor             <Color>                 highlight foreground color (selected)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   135
        hgLgBgColor             <Color>                 highlight background color (selected)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   136
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   137
        buttonLightColor        <Color>                 LightColor      ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   138
        buttonShadowColor       <Color>                 ShadowColor     ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   139
        buttonHalfLightColor    <Color>                 HalfLightColor  ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   140
        buttonHalfShadowColor   <Color>                 HalfShadowColor ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   141
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   142
        actionBlock             <a OneArgBlock>         action block performed on select
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   143
        doubleClickActionBlock  <a OneArgBlock>         action block performed on double click
5308
4e35010e00be #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5279
diff changeset
   144
        rowIfAbsentBlock        <a OneArgBlock>         this block is performed on an empty list entry
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   145
                                                        to retrive the item from the application. The
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   146
                                                        argument to the block is the index into the list.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   147
                                                        The block should return the row instance which
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   148
                                                        is put to the list under the index.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   149
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   150
        builder                 <UIBuilder>             builder set by application
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   151
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   152
        verticalSpacing         <SmallInteger>          vertical   row spacing( top  & bottom )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   153
        horizontalSpacing       <SmallInteger>          horizontal row spacing( left & right )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   154
        separatorSize           <SmallInteger>          line width of a vertical or horizontal separator
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   155
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   156
        rowSelectorForm         <Form>                  form used by a row selector
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   157
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   158
        checkToggleForm         <Form>                  form used by a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   159
        checkToggleExtent       <Point>                 extent of a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   160
        checkToggleLevel        <SmallInteger>          level used to draw a check toggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   161
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   162
        comboButtonForm         <Form>                  form used by a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   163
        comboButtonExtent       <Point>                 extent of a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   164
        comboButtonLevel        <SmallInteger>          level used to draw a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   165
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   166
        dropTarget              <DropTarget>            drag & drop target
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   167
        dropSource              <DropSource>            drag & drop source
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   168
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   169
    [author:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   170
        Claus Atzkern
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   171
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   172
    [see also:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   173
        DataSetColumnSpec
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   174
        DataSetColumn
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   175
        DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   176
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   177
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   178
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   179
!DSVColumnView class methodsFor:'defaults'!
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   180
1844
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   181
defaultFont
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   182
    ^ SelectionInListView defaultFont
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   183
!
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   184
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   185
horizontalSpacing
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   186
    "returns the default horizontal space between rows
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   187
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   188
    ^ 4
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   189
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   190
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   191
3961
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   192
preselectAllWhenOpeningEditor:aBoolean
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   193
    PreselectAllWhenOpeningEditor := aBoolean
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   194
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   195
    "Created: / 02-11-2010 / 22:00:28 / cg"
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   196
!
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   197
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   198
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   199
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   200
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   201
    <resource: #style (#textForegroundColor
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   202
                       #'scrollableView.backgroundColor'
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   203
                       #'button.lightColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   204
                       #'button.shadowColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   205
                       #'button.halfLightColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   206
                       #'button.halfShadowColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   207
                       #'button.edgeStyle'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   208
                       #'checkToggle.activeImage'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   209
                       #'checkToggle.passiveImage'
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   210
                       #'radioButton.activeImage'
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   211
                       #'radioButton.passiveImage'
582
222fc7c63af0 new resource naming
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   212
                       #'selection.hilightForegroundColor'
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   213
                       #'selection.hilightBackgroundColor'
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   214
                       #'selection.hilightFrameColor'
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   215
                       #'dataSet.labelView.foregroundColor'
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   216
                       #'dataSet.labelView.backgroundColor'
3988
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   217
    )>
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   218
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   219
    DefaultForegroundColor        := StyleSheet colorAt:#'textForegroundColor' default:(Color black).
3986
163354e9ee4c changed: #updateStyleCache
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
   220
    "/ DefaultBackgroundColor        := StyleSheet colorAt:#'scrollableView.backgroundColor' default:DefaultViewBackgroundColor.
163354e9ee4c changed: #updateStyleCache
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
   221
    DefaultBackgroundColor        := StyleSheet colorAt:#'selection.backgroundColor' default:DefaultViewBackgroundColor.
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   222
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   223
    DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   224
    DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor.
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
   225
    DefaultHilightForegroundColorNoFocus := StyleSheet colorAt:#'selection.hilightForegroundColorNoFocus'.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
   226
    DefaultHilightBackgroundColorNoFocus := StyleSheet colorAt:#'selection.hilightBackgroundColorNoFocus'.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   227
    DefaultHilightFrameColor      := StyleSheet colorAt:#'selection.hilightFrameColor'. "/ no default; nil means: no frame
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   228
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   229
    DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   230
        DefaultHilightBackgroundColor := Color black
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   231
    ].
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   232
    ButtonLightColor       := StyleSheet colorAt:#'button.lightColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   233
    ButtonShadowColor      := StyleSheet colorAt:#'button.shadowColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   234
    ButtonHalfLightColor   := StyleSheet colorAt:#'button.halfLightColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   235
    ButtonHalfShadowColor  := StyleSheet colorAt:#'button.halfShadowColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   236
    ButtonEdgeStyle        := StyleSheet at:#'button.edgeStyle'.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   237
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   238
    CheckToggleActiveImage := StyleSheet at:#'checkToggle.activeImage'.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   239
    CheckToggleActiveImage isNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   240
        CheckTogglePassiveImage := nil
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   241
    ] ifFalse:[
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   242
        CheckTogglePassiveImage := StyleSheet at:#'checkToggle.passiveImage'.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   243
        CheckTogglePassiveImage isNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   244
            CheckToggleActiveImage := nil
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   245
        ]
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   246
    ].
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   247
    "/ CheckToggleDisabledActiveImage := StyleSheet at:#'checkToggle.disabledActiveImage'.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   248
    "/ CheckToggleDisabledPassiveImage := StyleSheet at:#'checkToggle.disabledPassiveImage'.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   249
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   250
    CheckToggleForm   := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   251
    CheckToggleLevel  := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   252
    CheckToggleExtent := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   253
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   254
    RadioButtonActiveImage := StyleSheet at:#'radioButton.activeImage'.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   255
    RadioButtonPassiveImage := StyleSheet at:#'radioButton.passiveImage'.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   256
    "/ RadioButtonDisabledActiveImage := StyleSheet at:#'radioButton.disabledActiveImage'.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   257
    "/ RadioButtonDisabledPassiveImage := StyleSheet at:#'radioButton.disabledPassiveImage'.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   258
    (RadioButtonActiveImage isNil or:[ RadioButtonPassiveImage isNil ]) ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   259
        RadioButtonActiveImage := RadioButton roundOnForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   260
        RadioButtonPassiveImage := RadioButton roundOffForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   261
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   262
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   263
    ComboButtonForm   := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   264
    ComboButtonLevel  := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   265
    ComboButtonExtent := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   266
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   267
    DefaultLabelBackgroundColor := StyleSheet at:#'dataSet.labelView.backgroundColor' default:nil.
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   268
    DefaultLabelForegroundColor := StyleSheet at:#'dataSet.labelView.foregroundColor' default:nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   269
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   270
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   271
     self updateStyleCache.
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   272
    "
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   273
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   274
    "Modified: / 20-01-2011 / 08:44:28 / cg"
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   275
    "Modified (comment): / 17-08-2018 / 17:06:46 / Claus Gittinger"
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   276
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   277
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   278
verticalSpacing
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   279
    "returns the default vertical space between rows
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   280
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   281
    ^ 2
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   282
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   283
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   284
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   285
!DSVColumnView class methodsFor:'image specs'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   286
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   287
dragIconMulti
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   288
    "This resource specification was automatically generated
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   289
     by the ImageEditor of ST/X."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   290
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   291
    "Do not manually edit this!! If it is corrupted,
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   292
     the ImageEditor may not be able to read the specification."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   293
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   294
    "
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   295
     self dragIconMulti inspect
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   296
     ImageEditor openOnClass:self andSelector:#dragIconMulti
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   297
     Icon flushCachedIcons
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   298
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   299
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   300
    <resource: #image>
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   301
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   302
    ^Icon
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   303
        constantNamed:'DSVColumnView class dragIconMulti'
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   304
        ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   305
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@<@@@@O@@@@C3??L@<??3@OO?<<C3??O@<??0@OO?<@C3???0<???<OO???C3???0<???<OO???@C?
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   306
??0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   307
            colorMapFromArray:#[0 0 0 255 255 255]
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   308
            mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   309
@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C????@????0O????C????0?????O????3?????????????????????????????????????????????
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   310
????????@????0O???<C????@????0@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself]
1926
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   311
!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   312
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   313
dragIconSingle
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   314
    "This resource specification was automatically generated
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   315
     by the ImageEditor of ST/X."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   316
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   317
    "Do not manually edit this!! If it is corrupted,
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   318
     the ImageEditor may not be able to read the specification."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   319
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   320
    "
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   321
     self dragIconSingle inspect
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   322
     ImageEditor openOnClass:self andSelector:#dragIconSingle
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   323
     Icon flushCachedIcons
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   324
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   325
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   326
    <resource: #image>
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   327
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   328
    ^Icon
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   329
        constantNamed:'DSVColumnView class dragIconSingle'
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   330
        ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   331
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C??
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   332
?0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   333
            colorMapFromArray:#[0 0 0 255 255 255]
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   334
            mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   335
@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O??
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   336
?<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself]
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   337
!
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   338
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   339
rowSelectorImage
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   340
    "This resource specification was automatically generated
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   341
     by the ImageEditor of ST/X."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   342
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   343
    "Do not manually edit this!! If it is corrupted,
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   344
     the ImageEditor may not be able to read the specification."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   345
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   346
    "
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   347
     self rowSelectorImage inspect
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   348
     ImageEditor openOnClass:self andSelector:#rowSelectorImage
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   349
     Icon flushCachedIcons
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   350
    "
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   351
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   352
    <resource: #image>
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   353
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   354
    ^Icon
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   355
        constantNamed:'DSVColumnView class rowSelectorImage'
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   356
        ifAbsentPut:[(Depth2Image width:11 height:11) bits:(ByteArray fromPackedString:'@ @@@#@@*#0@@C,@O>(0N*($J*$P@BT@*!!P@@!!@@@ @@')
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   357
            colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 255 255]
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   358
            mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'C@@N@@<@?8C?0O? ?<C? @<@C @L@@@a'); yourself); yourself]
1926
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   359
! !
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   360
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   361
!DSVColumnView class methodsFor:'signal constants'!
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   362
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   363
stopRedrawSignal
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   364
    "returns the signal which is raised during drawing if the
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   365
     required label height is less than the current rowHeight
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   366
    "
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   367
    StopRedrawSignal isNil ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   368
        StopRedrawSignal := Notification newSignalMayProceed:true.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   369
        StopRedrawSignal nameClass:self message:#stopRedrawSignal.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   370
    ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   371
    ^ StopRedrawSignal
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   372
! !
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   373
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   374
!DSVColumnView methodsFor:'accessing'!
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   375
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   376
builder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   377
    "get the builder (UIBuilder or nil)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   378
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   379
    ^ builder
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   380
!
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   381
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   382
builder:aBuilder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   383
    "set the builder (UIBuilder or nil)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   384
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   385
    builder := aBuilder
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   386
!
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   387
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   388
columnView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   389
    "returns self"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   390
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   391
    ^ self
1067
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   392
!
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   393
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   394
heightOfContents
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   395
    "return the height of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   396
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   397
    cachedPreferredExtent isNil ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   398
        self preferredExtent
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   399
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   400
    ^ cachedPreferredExtent y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   401
!
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   402
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   403
labelView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   404
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   405
    ^labelView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   406
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   407
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   408
labelView:aView
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   409
    labelView := aView for:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   410
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   411
    labelView layout:(LayoutFrame
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   412
                        leftFraction:0 offset:0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   413
                        rightFraction:1 offset:0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   414
                        topFraction:0 offset:0
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   415
                        bottomFraction:0 offset:[self preferredLabelViewHeight]).
1067
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   416
!
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   417
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   418
level:aLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   419
    "change the level and thus the level of the labelView"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   420
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   421
    aLevel ~~ level ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   422
        super level:aLevel.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   423
"/        labelView level:aLevel.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   424
    ]
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   425
!
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   426
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   427
preferredLabelViewHeight
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   428
    ^ labelView preferredHeight "/ + (labelView margin + self verticalSpacing * 2).
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   429
!
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   430
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   431
rowFontAscent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   432
    "returns the inset of a printable text in a row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   433
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   434
    ^ rowFontAscent
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   435
!
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   436
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   437
selectedColIndex:newSelectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   438
    self selectedColIndexHolder value:newSelectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   439
!
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   440
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   441
selectedColIndexHolder
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   442
    selectedColIndexHolder isNil ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   443
        selectedColIndexHolder := ValueHolder new.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   444
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   445
    ^ selectedColIndexHolder
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   446
! !
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   447
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   448
!DSVColumnView methodsFor:'accessing-actions'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   449
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   450
action:aOneArgAction
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   451
    "set the action block to be performed on select"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   452
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   453
    actionBlock := aOneArgAction
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   454
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   455
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   456
doubleClickAction:aOneArgAction
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   457
    "set the action block to be performed on doubleclick"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   458
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   459
    doubleClickActionBlock := aOneArgAction
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   460
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   461
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   462
rowIfAbsent:aOneArgAction
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   463
    "set the action block to be performed on each 'nil' entry into the
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   464
     list. The argument to the block is the index into the list. The
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   465
     block returns the row which is put to the list"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   466
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   467
    rowIfAbsentBlock := aOneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   468
!
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   469
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   470
selectConditionBlock
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   471
    "get the select-conditionBlock; this block is evaluated before
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   472
     any selection change is performed (passing the to-be-changed row number
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   473
     index as arg).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   474
     The change will not be done, if the block returns false. "
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   475
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   476
    ^ selectConditionBlock
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   477
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   478
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   479
selectConditionBlock:aOneArgBlockOrNil
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   480
    "set the select-conditionBlock; this block is evaluated before
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   481
     any selection change is performed (passing the to-be-changed row number
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   482
     index as arg).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   483
     The change will not be done, if the block returns false. "
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   484
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   485
    selectConditionBlock := aOneArgBlockOrNil.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   486
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   487
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   488
tabAtEndAction:aNoneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   489
    "set the action, called without any argument at end of the list entering
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   490
     tab next.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   491
     The default is to give the focus to the view after self in the focusSequence"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   492
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   493
    tabAtEndAction := aNoneArgAction
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   494
!
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   495
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   496
tabAtStartAction:aNoneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   497
    "set the action, called without any argument at start of the list entering
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   498
     tab previous.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   499
     The default is to give the focus to the view before self in the focusSequence"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   500
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   501
    tabAtStartAction := aNoneArgAction
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   502
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   503
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   504
!DSVColumnView methodsFor:'accessing-behavior'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   505
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   506
autoScrollToColumn
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   507
    "return true, if I scroll to the column, when one is selected."
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   508
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   509
    ^ autoScrollToColumn
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   510
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   511
    "Created: / 22-10-2006 / 11:01:25 / cg"
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   512
!
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   513
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   514
autoScrollToColumn:aBoolean
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   515
    "control, if I should scroll to the column, when one is selected.
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   516
     The default is true"
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   517
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   518
    autoScrollToColumn := aBoolean
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   519
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   520
    "Created: / 22-10-2006 / 11:01:46 / cg"
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   521
!
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   522
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   523
beDependentOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   524
    "make myself dependent of any row; in this case any change notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   525
     raised by a row is catched and the cell identified by the 'readSelector'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   526
     is redrawn. In case of a nil readSelector, the whole raw is redrawn.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   527
        -> row changed:'what'
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   528
     By default, the attribute is set to false (disabled)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   529
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   530
    ^ beDependentOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   531
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   532
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   533
beDependentOfRows:aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   534
    "make myself dependent of any row; in this case any change notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   535
     raised by a row is catched and the cell identified by the 'readSelector'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   536
     is redrawn. In case of a nil readSelector, the whole raw is redrawn.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   537
        -> row changed:'what'
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   538
     By default, the attribute is set to false (disabled)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   539
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   540
    aBool ~~ beDependentOfRows ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   541
        beDependentOfRows := aBool.
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   542
        aBool ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   543
            self makeDependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   544
        ] ifFalse:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   545
            self makeIndependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   546
        ].
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   547
    ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   548
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   549
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   550
enableChannel:aChannel
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   551
    enableChannel notNil ifTrue:[
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   552
        enableChannel removeDependent:self
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   553
    ].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   554
    (enableChannel := aChannel) notNil ifTrue:[
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   555
        enableChannel addDependent:self
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   556
    ].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   557
!
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   558
5664
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   559
ignoreReselect
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   560
    "controls if clicking on an already selected item should
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   561
     be ignored or should perform the select action again.
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   562
     By default, these are ignored"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   563
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   564
    ^ ignoreReselect
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   565
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   566
    "Created: / 22-10-2006 / 11:01:25 / cg"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   567
!
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   568
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   569
ignoreReselect:aBoolean
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   570
    "controls if clicking on an already selected item should
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   571
     be ignored or should perform the select action again.
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   572
     By default, these are ignored"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   573
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   574
    ignoreReselect := aBoolean
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   575
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   576
    "Created: / 22-10-2006 / 11:01:25 / cg"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   577
!
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   578
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   579
makeDependentOfRows
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   580
    "make myself dependent of any row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   581
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   582
    list size ~~ 0 ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   583
        list do:[:aRow |
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   584
            aRow notNil ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   585
                aRow addDependent:self
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   586
            ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   587
        ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   588
    ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   589
!
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   590
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   591
makeIndependentOfRows
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   592
    "make myself independent of any row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   593
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   594
    list size ~~ 0 ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   595
        list do:[:aRow |
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   596
            aRow notNil ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   597
                aRow removeDependent:self
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   598
            ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   599
        ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   600
    ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   601
!
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   602
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   603
multipleSelectOk
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   604
    "allow/disallow multiple row selections; the default is false"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   605
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   606
    ^ multipleSelectOk
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   607
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   608
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   609
multipleSelectOk:sBoolean
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   610
    "allow/disallow multiple row selections; the default is false"
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   611
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   612
    |colIdx rowIdx|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   613
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   614
    sBoolean == multipleSelectOk ifTrue:[^ self ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   615
    colIdx := rowIdx := 0.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   616
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   617
    self hasSelection ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   618
        colIdx := self selectedColIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   619
        rowIdx := self selectedRowIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   620
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   621
        rowIdx isSequenceable ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   622
            rowIdx := rowIdx at:1 ifAbsent:0
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   623
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   624
        self setSelectColIndex:0 rowIndex:0 openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   625
    ].
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   626
    multipleSelectOk := sBoolean.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   627
    self selectColIndex:colIdx rowIndex:rowIdx openEditor:false.
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   628
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   629
    "Modified (format): / 04-02-2017 / 21:31:30 / cg"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   630
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   631
1938
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   632
opaqueColumnResize
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   633
    ^ labelView opaqueColumnResize
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   634
!
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   635
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   636
opaqueColumnResize:aBoolean
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   637
    labelView opaqueColumnResize:aBoolean
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   638
!
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   639
1946
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   640
scrollWhenUpdating
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   641
    "return the scroll behavior, when I get a new text
1946
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   642
     (via the model or the #contents/#list)
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   643
     Possible returnValues are:
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   644
        #keep / nil     -> no change
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   645
        #endOfText      -> scroll to the end
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   646
        #beginOfText    -> scroll to the top
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   647
     The default is #beginOfText.
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   648
     This may be useful for fields which get new values assigned from
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   649
     the program (i.e. not from the user)"
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   650
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   651
    ^ scrollWhenUpdating
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   652
!
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   653
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   654
scrollWhenUpdating:aSymbolOrNil
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   655
    "define how to scroll, when I get a new text
1946
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   656
     (via the model or the #contents/#list)
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   657
     Allowed arguments are:
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   658
        #keep / nil     -> no change
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   659
        #endOfText      -> scroll to the end
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   660
        #beginOfText    -> scroll to the top
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   661
     The default is #beginOfText.
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   662
     This may be useful for fields which get new values assigned from
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   663
     the program (i.e. not from the user)"
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   664
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   665
    scrollWhenUpdating := aSymbolOrNil
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   666
!
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   667
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   668
selectRowOnDefault
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   669
    "if true, in case of selecting a none selectable cell, the row is selected.
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   670
     If false, nothing is selected. The default is true."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   671
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   672
    ^ selectRowOnDefault
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   673
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   674
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   675
selectRowOnDefault:aBool
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   676
    "if true, in case of selecting a none selectable cell, the row is selected.
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   677
     If false, nothing is selected. The default is true."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   678
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   679
    selectRowOnDefault := aBool
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   680
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   681
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   682
sortListInPlace
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   683
    "when false (default for backward compatibility):
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   684
     if sorting, create a copy
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   685
     of the list, which is wrong when useIndex is on,
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   686
     as the application will get the index in the sorted
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   687
     list, which is probably different from tha apps list mode.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   688
     When true (should be default, but that might break many
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   689
     users), the passed in list is sorted in place (i.e. possibly
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   690
     sorting the application's list)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   691
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   692
    ^ sortListInPlace
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   693
!
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   694
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   695
sortListInPlace:aBoolean
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   696
    "when false (default for backward compatibility):
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   697
     if sorting, create a copy
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   698
     of the list, which is wrong when useIndex is on,
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   699
     as the application will get the index in the sorted
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   700
     list, which is probably different from tha apps list mode.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   701
     When true (should be default, but that might break many
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   702
     users), the passed in list is sorted in place (i.e. possibly
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   703
     sorting the application's list)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   704
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   705
    sortListInPlace := aBoolean.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   706
!
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   707
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   708
tabIntern
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   709
    "returns true if tabing is supported in the widget"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   710
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   711
    ^ tabIntern
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   712
!
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   713
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   714
tabIntern:aBool
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   715
    "returns true if tabing is supported in the widget"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   716
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   717
    tabIntern := aBool ? true
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   718
!
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   719
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   720
updateListHolderWhenSorting
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   721
    "return true if the the listHolder's value are be updated,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   722
     when I sort a list.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   723
     By default, this is false so it must be set explicitly
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   724
     (for bug-backward compatibility,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   725
     and to avoid introducing new side effects)."
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   726
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   727
    ^ updateListHolderWhenSorting
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   728
!
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   729
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   730
updateListHolderWhenSorting:aBoolean
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   731
    "define if the the listHolder's value should be updated,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   732
     when I sort a list.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   733
     By default, this is false so it must be set explicitly
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   734
     (for bug-backward compatibility,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   735
     and to avoid introducing new side effects)."
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   736
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   737
    updateListHolderWhenSorting := aBoolean
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   738
!
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   739
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   740
useIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   741
    "specify, if the selected components value or its index in the
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   742
     list should be sent to the model. The default is its index."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   743
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   744
    ^ useIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   745
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   746
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   747
useIndex:aBool
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   748
    "specify, if the selected components value or its index in the
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   749
     list should be sent to the model. The default is its index."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   750
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   751
    useIndex := aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   752
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   753
5639
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   754
!DSVColumnView methodsFor:'accessing-channels'!
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   755
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   756
modifiedChannel
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   757
    ^ modifiedChannel
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   758
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   759
    "Created: / 30.1.2000 / 12:10:57 / cg"
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   760
!
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   761
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   762
modifiedChannel:something
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   763
    modifiedChannel := something.
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   764
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   765
    "Created: / 30.1.2000 / 12:10:57 / cg"
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   766
! !
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   767
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   768
!DSVColumnView methodsFor:'accessing-color & font'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   769
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   770
backgroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   771
    "get the background color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   772
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   773
    ^ bgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   774
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   775
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   776
backgroundColor:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   777
    "set the background color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   778
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   779
    bgColor ~~ aColor ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   780
        super viewBackground:bgColor.
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   781
        self realized ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   782
            bgColor := aColor onDevice:device.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   783
            self invalidate
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   784
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   785
            bgColor := aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   786
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   787
    ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   788
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   789
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   790
foregroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   791
    "return the foreground color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   792
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   793
    ^ fgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   794
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   795
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   796
foregroundColor:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   797
    "set the foreground color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   798
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   799
    fgColor ~~ aColor ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   800
        self realized ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   801
            fgColor := aColor onDevice:device.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   802
            self invalidate
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   803
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   804
            fgColor := aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   805
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   806
    ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   807
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   808
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   809
labelBackgroundColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   810
    "get the background color of the label row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   811
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   812
    ^ labelBgColor ? bgColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   813
!
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   814
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   815
labelForegroundColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   816
    "get the foreground color of the label row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   817
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   818
    ^ labelFgColor ? fgColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   819
!
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   820
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   821
selectionBackgroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   822
    "returns the background color of a selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   823
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   824
    self hasFocus ifTrue:[
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   825
        ^ selectionBackgroundColor
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   826
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   827
    ^ selectionBackgroundColorNoFocus.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   828
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   829
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   830
selectionForegroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   831
    "returns the foreground color of a selected row"
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   832
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   833
    self hasFocus ifTrue:[
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   834
        ^ selectionForegroundColor
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   835
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   836
    ^ selectionForegroundColorNoFocus.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   837
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   838
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   839
selectionFrameColor
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   840
    "returns the frame color of a selected row"
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   841
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   842
    self hasFocus ifTrue:[
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   843
        ^ selectionFrameColor
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   844
    ].
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   845
    ^ selectionFrameColorNoFocus.
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   846
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   847
    "Created: / 20-01-2011 / 08:45:08 / cg"
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   848
!
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   849
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   850
separatorDarkColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   851
    "returns the dark color used for drawing a shadowed separator (3D)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   852
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   853
    ^ shadowColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   854
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   855
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   856
separatorLightColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   857
    "returns the light color used for drawing a shadowed separator (3D)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   858
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   859
    ^ lightColor
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   860
!
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   861
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   862
separatorOneDColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   863
    "returns the color used for drawing a oneD separator"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   864
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   865
    separatorOneDColor isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   866
        ^ fgColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   867
    ].
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   868
    ^ separatorOneDColor
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   869
!
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   870
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   871
separatorOneDColor:aColorOrNil
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   872
    "set the color used for drawing a oneD separator; if the color
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   873
     is nil, the current forgroundColor is used"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   874
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   875
    separatorOneDColor = aColorOrNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   876
        ^ self
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   877
    ].
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   878
    separatorOneDColor := aColorOrNil.
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   879
    self realized ifTrue:[
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   880
        separatorOneDColor notNil ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   881
            separatorOneDColor := separatorOneDColor onDevice:device.
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   882
        ].
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   883
        self invalidate.
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   884
    ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   885
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   886
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   887
!DSVColumnView methodsFor:'accessing-columns'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   888
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   889
columnAt:anIndex
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   890
    <resource: #obsolete>
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   891
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   892
    "returns the column at an index"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   893
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   894
    self obsoleteMethodWarning:'use columnDescriptorAt:'.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   895
    ^ self columnDescriptorAt:anIndex
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   896
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   897
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   898
columnDescriptorAt:anIndex
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   899
    "returns the columnDescriptor at an index"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   900
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   901
    ^ columnDescriptors at:anIndex ifAbsent:nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   902
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   903
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   904
columnDescriptors
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   905
    "returns list of column descriptors"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   906
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   907
    ^ columnDescriptors collect:[:aCol | aCol description ]
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   908
!
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   909
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   910
columnDescriptors:aColumnDescriptionList
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   911
    "set the columnDescriptors;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   912
     scroll to top and deselect"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   913
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   914
    self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:true
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   915
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   916
    "Modified: / 13-09-2017 / 15:05:05 / cg"
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   917
!
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   918
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   919
columnDescriptors:aColumnDescriptionList deselect:deselect scrollToTop:scrollToTop
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   920
    "set the columnDescriptors;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   921
     if deselect is true, then deselect;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   922
     if scrollToTop is true, then scroll to top;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   923
     otherwise, take the current selection and try to make it visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   924
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   925
    |delta indexOfFirstRow|
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   926
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   927
    deselect ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   928
        self deselect.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   929
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   930
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   931
    (viewOrigin x ~~ 0 or:[ viewOrigin y ~~ 0 ]) ifTrue:[
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   932
        scrollToTop ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   933
            delta := viewOrigin negated.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   934
            viewOrigin := 0 @ 0.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   935
            self originChanged:delta
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   936
        ] ifFalse:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   937
            indexOfFirstRow := self yVisibleToRowNr:0.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   938
        ].
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   939
    ].
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   940
    self setColumnDescriptors:aColumnDescriptionList.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   941
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   942
    indexOfFirstRow notNil ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   943
        self scrollToRowAt:indexOfFirstRow colAt:1.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   944
    ].
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   945
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   946
    "Created: / 13-09-2017 / 15:04:50 / cg"
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   947
!
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   948
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   949
columnDescriptors:aColumnDescriptionList scrollToTop:scrollToTop
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   950
    "set the columnDescriptors and deselect;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   951
     if scrollToTop is true, then scroll to top;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   952
     otherwise, take the current selection and try to make it visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   953
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   954
    self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:scrollToTop
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   955
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   956
    "Created: / 13-09-2017 / 15:03:15 / cg"
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   957
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   958
2703
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   959
dataSetColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   960
    "returns the list of DataSetColumns; each column represents a DataSetColumnSpec"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   961
2703
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   962
    ^ columnDescriptors
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   963
!
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   964
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   965
firstColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   966
    "returns the first column"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   967
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   968
    ^ columnDescriptors at:1
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   969
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   970
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   971
lastColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   972
    "returns the last column"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   973
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   974
    ^ columnDescriptors last
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   975
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   976
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   977
setColumnDescriptors:aColumnDescriptionList
5310
8b7aff55b666 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
   978
    "set the columnDescriptors; don't deselect and do not scroll to top"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   979
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   980
    |cid|
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   981
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   982
    cid := 0.
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   983
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   984
    aColumnDescriptionList isEmptyOrNil ifTrue:[
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   985
        columnDescriptors := OrderedCollection new.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   986
    ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   987
        columnDescriptors := aColumnDescriptionList
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   988
            collect:
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   989
                [:el||dsc lbl|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   990
                    dsc := el isSequenceable
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   991
                                ifTrue:[DataSetColumnSpec decodeFromLiteralArray:el]
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   992
                                ifFalse:[el].
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   993
                    cid := cid + 1.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   994
                    lbl := DataSetLabel new description:dsc builder:builder on:labelView.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   995
                    DataSetColumn new on:self description:dsc columnNumber:cid label:lbl
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   996
                ].
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   997
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   998
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   999
    cachedPreferredExtent := nil.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1000
    labelView columns:columnDescriptors.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1001
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1002
    self fitColumns.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1003
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1004
    "Modified: / 07-01-2012 / 16:46:59 / cg"
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1005
    "Modified (format): / 13-09-2017 / 15:04:01 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1006
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1007
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1008
!DSVColumnView methodsFor:'accessing-interactors'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1009
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1010
checkToggleActiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1011
    ^ checkToggleActiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1012
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1013
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1014
checkToggleExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1015
    "returns the extent of a checkToggle"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1016
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1017
    ^ checkToggleExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1018
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1019
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1020
checkToggleForm
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1021
    "returns the form of a checkToggle"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1022
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1023
    ^ checkToggleForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1024
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1025
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1026
checkToggleLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1027
    "returns the level of a checkToggle button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1028
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1029
    ^ checkToggleLevel
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1030
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1031
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1032
checkTogglePassiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1033
    ^ checkTogglePassiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1034
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1035
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1036
comboButtonExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1037
    "returns the extent of a comboList or -Box"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1038
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1039
    ^ comboButtonExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1040
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1041
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1042
comboButtonForm
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1043
    "returns the form of a comboList or -Box"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1044
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1045
    ^ comboButtonForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1046
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1047
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1048
comboButtonLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1049
    "returns the level of a comboList or -Box button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1050
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1051
    ^ comboButtonLevel
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1052
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1053
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1054
radioButtonExtent
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1055
    "returns the extent of a radio button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1056
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1057
    ^ radioButtonActiveImage extent
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1058
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1059
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1060
rowSelectorExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1061
    "returns the bitmap of a selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1062
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1063
    ^ rowSelectorForm extent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1064
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1065
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1066
rowSelectorForm
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1067
    "returns the (arrow-) image shown for a selected row.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1068
     (the arrow shown in the first column)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1069
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1070
    ^ rowSelectorForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1071
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1072
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1073
!DSVColumnView methodsFor:'accessing-mvc'!
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1074
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1075
columnAdaptor
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1076
    "return the value of the instance variable 'columnAdaptor' (automatically generated)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1077
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1078
    columnAdaptor isValueModel ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1079
        ^ columnAdaptor value
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1080
    ].
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1081
    ^ columnAdaptor
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1082
!
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1083
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  1084
columnAdaptor:usuallyAnApplication
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1085
    "set the value of the instance variable 'columnAdaptor' (automatically generated)"
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1086
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1087
    columnAdaptor isValueModel ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1088
        columnAdaptor removeDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1089
    ].
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  1090
    (columnAdaptor := usuallyAnApplication) isValueModel ifTrue:[
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1091
        columnAdaptor addDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1092
    ].
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  1093
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  1094
    "Modified (format): / 21-11-2018 / 19:32:57 / Claus Gittinger"
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1095
!
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1096
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1097
columnHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1098
    "get the valueHolder, which keeps the list of column descriptions"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1099
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1100
    ^ columnHolder
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1101
!
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1102
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1103
columnHolder:aValueHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1104
    "set the valueHolder, which keeps the list of column descriptions"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1105
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1106
    |columns|
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1107
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1108
    columnHolder notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1109
        columnHolder removeDependent:self
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1110
    ].
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1111
    (columnHolder := aValueHolder) notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1112
        columnHolder addDependent:self.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1113
        columns := columnHolder value.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1114
        columns notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1115
            self columnDescriptors:columns
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1116
        ]
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1117
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1118
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1119
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1120
listAt:index put:newElement
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1121
    "kludge callback, when an element hs to be replaced
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1122
     due to a col-adaptor returning a new row element"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1123
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1124
    |list|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1125
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1126
    (list := listHolder value) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1127
        list at:index put:newElement
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1128
    ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1129
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1130
2318
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1131
listHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1132
    "get the valueHolder which holds the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1133
2318
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1134
    ^ listHolder
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1135
!
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1136
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1137
listHolder:aListHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1138
    "set the valueHolder which holds the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1139
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1140
    listHolder ~~ aListHolder ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1141
        listHolder notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1142
            listHolder removeDependent:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1143
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1144
        (listHolder := aListHolder) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1145
            listHolder addDependent:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1146
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1147
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1148
    self pushEvent:#list: with:(listHolder value).
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1149
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1150
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1151
model:aModel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1152
    "set the valueHolder which holds the selection and maybe the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1153
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1154
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1155
        model removeDependent:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1156
        (model respondsTo:#list) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1157
            (model list == listHolder) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1158
                self listHolder:nil
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1159
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1160
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1161
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1162
    (model := aModel) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1163
        model addDependent:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1164
        (aModel respondsTo:#list) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1165
            self listHolder:model list
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1166
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1167
    ]
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1168
! !
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1169
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1170
!DSVColumnView methodsFor:'accessing-rows'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1171
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1172
at:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1173
    "return the row at an index, aRowNr"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1174
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1175
    |row|
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1176
3994
f44c9cded11e changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3993
diff changeset
  1177
    list isNil ifTrue:[^ nil].
3757
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  1178
    (row := list at:aRowNr ifAbsent:nil) isNil ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1179
        lockRowIndex := aRowNr.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1180
1034
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1181
        (rowIfAbsentBlock notNil
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1182
        and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1183
            list at:aRowNr put:row.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1184
            beDependentOfRows ifTrue:[row addDependent:self].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1185
        ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1186
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1187
        lockRowIndex := 0
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1188
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1189
    ^ row
1034
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1190
3994
f44c9cded11e changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3993
diff changeset
  1191
    "Modified: / 22-01-2011 / 09:14:48 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1192
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1193
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1194
at:aRowNr ifAbsent:exceptionBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1195
    "return the row at a aRowNr. If the index is invalid, return the
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1196
     result of evaluating the exceptionblock"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1197
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1198
    (aRowNr between:1 and:list size) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1199
        ^ self at:aRowNr
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1200
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1201
    ^ exceptionBlock value
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1202
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1203
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1204
at:aRowNr put:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1205
    "change the row at an index. The added row is returned"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1206
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1207
    lockRowIndex ~~ aRowNr ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1208
        (aRowNr <= list size and:[ (list at:aRowNr) == aRow ]) ifTrue:[
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1209
            self invalidateRowAt:aRowNr
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1210
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1211
            self
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1212
                replaceFrom:aRowNr
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1213
                to:aRowNr
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1214
                with:(Array with:aRow)
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1215
                startingAt:1.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1216
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1217
    ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1218
    ^ aRow
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1219
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1220
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1221
first
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1222
    "return the first row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1223
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1224
    ^ self at:1
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1225
!
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1226
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1227
identityIndexOfRow:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1228
    "returns index of a row or 0"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1229
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1230
    (list size ~~ 0 and:[ aRow notNil ]) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1231
        ^ list identityIndexOf:aRow
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1232
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1233
    ^ 0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1234
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1235
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1236
last
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1237
    "return the last row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1238
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1239
    ^ self at:(list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1240
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1241
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1242
list
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1243
    "get the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1244
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1245
    ^ list
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1246
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1247
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1248
list:aRawList
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1249
    "set the list of rows"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1250
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1251
    |newList selectionHasChanged sortColNr sortSelectorOrBlock sortBlockSelector sortBlock|
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
  1252
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1253
    "/ remove selection without redraw
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1254
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1255
    selectionHasChanged := self hasSelection.
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1256
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  1257
    self destroyEditView.
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1258
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  1259
    self selectedColIndex:0.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1260
    selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1261
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1262
    shown ifFalse:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1263
        cachedPreferredExtent := nil
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1264
    ] ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1265
        aRawList size == 0 ifTrue:[
2834
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1266
            "/ keep old column-width information
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1267
        ] ifFalse:[
2524
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1268
            columnDescriptors notNil ifTrue:[
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1269
                columnDescriptors do:[:aCol| aCol invalidate ].
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1270
            ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1271
            cachedPreferredExtent := nil.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1272
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1273
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1274
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1275
    beDependentOfRows ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1276
        self makeIndependentOfRows
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
  1277
    ].
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  1278
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1279
    aRawList size == 0 ifTrue:[
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1280
        list := nil.
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1281
        viewOrigin := 0 @ 0.
2834
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1282
    ] ifFalse:[
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1283
        "/ list := OrderedCollection withAll:aRawList.
4613
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1284
        sortListInPlace ifTrue:[
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1285
            newList := aRawList
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1286
        ] ifFalse:[
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1287
            newList := aRawList copyAsOrderedCollection.
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1288
        ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1289
        (sortColNr := labelView indexOfSortColumn) notNil ifTrue:[
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1290
            sortBlockSelector := (columnDescriptors at:sortColNr) sortBlockSelector.
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1291
            sortBlockSelector notNil ifTrue:[
3964
df77ea0f171d changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1292
                sortBlock := self application aspectFor:sortBlockSelector.
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1293
                newList sort:sortBlock
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1294
            ] ifFalse:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1295
                sortSelectorOrBlock := (columnDescriptors at:sortColNr) sortSelector.
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1296
                sortSelectorOrBlock notNil ifTrue:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1297
                    sortSelectorOrBlock isBlock ifTrue:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1298
                        newList sort:sortSelectorOrBlock
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1299
                    ] ifFalse:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1300
                        newList sort:[:a :b | (a perform:sortSelectorOrBlock) < (b perform:sortSelectorOrBlock)]
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1301
                    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1302
                ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1303
            ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1304
            labelView reverseSort ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1305
                newList reverse.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1306
            ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1307
        ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1308
        list := newList.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1309
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1310
        sortListInPlace ifFalse:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1311
            listHolder notNil ifTrue:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1312
                updateListHolderWhenSorting ifTrue:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1313
                    listHolder value:newList withoutNotifying:self.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1314
                ].
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1315
            ].
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1316
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1317
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1318
        beDependentOfRows ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1319
            self makeDependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1320
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1321
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1322
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1323
    shown ifTrue:[
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  1324
        self fitColumns
1949
0d9451776275 delayed fitColumns if not shown while list is changed.
ps
parents: 1948
diff changeset
  1325
    ] ifFalse:[
0d9451776275 delayed fitColumns if not shown while list is changed.
ps
parents: 1948
diff changeset
  1326
        needFitColumns := true
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1327
    ].
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1328
    selectionHasChanged ifTrue:[
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1329
        self selectionChanged.
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1330
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1331
    cachedPreferredExtent := nil.
2044
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1332
    self contentsChanged.
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1333
3964
df77ea0f171d changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1334
    "Modified: / 08-11-2010 / 22:07:49 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1335
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1336
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1337
!DSVColumnView methodsFor:'accessing-visibility'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1338
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1339
font:aFont
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1340
    "set the font for all shown rows."
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1341
    |newGCFont|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1342
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1343
    (aFont isNil or:[aFont = self font]) ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1344
        ^ self
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1345
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1346
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1347
    columnDescriptors isEmptyOrNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  1348
        super font:aFont.
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1349
        self labelView font:aFont.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1350
        rowFontAscent := self font ascent.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1351
        rowHeight     := verticalSpacing + (self font height) + verticalSpacing + separatorSize.
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1352
        minRowHeight  := rowHeight.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1353
        ^ self
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1354
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1355
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1356
    "/ close current editor if open
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1357
    self destroyEditView.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1358
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1359
    newGCFont := aFont.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1360
    realized ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1361
        |visibleColumns font oldSize newSize factor minimum|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1362
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1363
        newGCFont := aFont onDevice:self graphicsDevice.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1364
        factor := (newGCFont height / gc font height) asFloat.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1365
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1366
        minimum := self separatorSize + (2 * self horizontalSpacing).
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1367
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1368
        factor = 1 ifFalse:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1369
            "/ there are columns which are more or less invisible (exlude rowSelector)
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1370
            visibleColumns := columnDescriptors select:[:eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1371
                (eachColumn rendererType ~~ #rowSelector and:[eachColumn width > minimum])
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1372
            ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1373
        ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1374
        visibleColumns notEmptyOrNil ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1375
            factor < 1 ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1376
                "/ check if zoomOut is allowed
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1377
                visibleColumns do:[: eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1378
                    (eachColumn width * factor) > (minimum+1) ifFalse:[^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1379
                ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1380
            ].
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1381
            visibleColumns do:[:eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1382
                eachColumn setDescWidth:(eachColumn width * factor) rounded.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1383
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1384
                font := eachColumn label font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1385
                font notNil ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1386
                    font sizeUnit ~~ #px ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1387
                        oldSize := font size.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1388
                        newSize := (oldSize * factor) rounded.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1389
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1390
                        (newSize ~= oldSize and:[newSize >= 4]) ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1391
                            font := font asSize:newSize.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1392
                            font notNil ifTrue:[eachColumn label font:font].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1393
                        ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1394
                    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1395
                ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1396
            ].
1842
402a364ee001 delegate font to labelView
martin
parents: 1818
diff changeset
  1397
        ].
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1398
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1399
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1400
    super font:newGCFont.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1401
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1402
    rowFontAscent := self font ascent.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1403
    rowHeight     := verticalSpacing + self font height + verticalSpacing + separatorSize.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1404
    minRowHeight  := rowHeight.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1405
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1406
    columnDescriptors do:[:eachColumn| eachColumn invalidate].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1407
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1408
    labelView font:self font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1409
    self labelView fontChanged.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1410
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1411
    cachedPreferredExtent := nil.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1412
    viewOrigin := 0 @ 0.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1413
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1414
    realized ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1415
        self fitColumns.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1416
        superView recomputeLayouts.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1417
        self invalidate.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1418
        self labelView invalidate.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1419
        self contentsChanged.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1420
        self makeSelectionVisible.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1421
    ].
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1422
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1423
    "Modified (format): / 13-09-2017 / 15:34:22 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1424
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1425
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1426
has3Dseparators
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1427
    "returns true if shown in 3D mode"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1428
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1429
    ^ separatorSize ~~ 1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1430
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1431
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1432
has3Dseparators:aBool
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1433
    "enable or disable 3D mode"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1434
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1435
    |newSepSize|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1436
3672
ff861e62db1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
  1437
    newSepSize := aBool ifTrue:[2] ifFalse:[1].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1438
    newSepSize ~~ separatorSize ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1439
        separatorSize := newSepSize.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1440
        realized ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1441
            columnDescriptors do:[:aCol |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1442
                aCol invalidate
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1443
            ].
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1444
            self preferredExtentChanged.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1445
            self invalidate.
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1446
            self contentsChanged
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  1447
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1448
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1449
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1450
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1451
horizontalSpacing
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1452
    "horizontal spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1453
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1454
    ^ horizontalSpacing
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1455
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1456
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1457
horizontalSpacing:aNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1458
    "horizontal spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1459
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1460
    horizontalSpacing ~~ aNumber ifTrue:[
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1461
        horizontalSpacing := aNumber.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1462
        self preferredExtentChanged.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1463
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1464
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1465
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1466
showLabels
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1467
    "control the labels view to be visible or unvisible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1468
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1469
    ^ labelView isVisible
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1470
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1471
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1472
showLabels:aBoolean
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1473
    "control the labels view to be visible or unvisible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1474
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1475
    labelView isVisible:aBoolean
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1476
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1477
    "Modified (format): / 04-02-2017 / 21:31:43 / cg"
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1478
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1479
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1480
verticalSpacing
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1481
    "vertical spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1482
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1483
    ^ verticalSpacing
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1484
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1485
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1486
verticalSpacing:aNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1487
    "vertical spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1488
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1489
    verticalSpacing ~~ aNumber ifTrue:[
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1490
        verticalSpacing := aNumber.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1491
        self preferredExtentChanged.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1492
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1493
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1494
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1495
!DSVColumnView methodsFor:'adding & removing rows'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1496
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1497
add:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1498
    "insert row at end"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1499
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1500
    ^ self add:aRow beforeIndex:(1 + list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1501
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1502
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1503
add:aRow afterIndex:aRowNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1504
    "add a new row after slot aRowNr and redisplay; returns nil in case
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1505
     of an invalid index or the row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1506
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1507
    ^ self add:aRow beforeIndex:(aRowNr + 1)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1508
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1509
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1510
add:aRow beforeIndex:aRowNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1511
    "add a new row before slot aRowNr and redisplay; returns nil in case
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1512
     of an invalid index or the row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1513
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1514
    self addAll:(Array with:aRow) beforeIndex:aRowNr.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1515
    ^ aRow.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1516
!
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1517
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1518
addAll:aList beforeIndex:start
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1519
    "add a collection of rows before slot start and redisplay"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1520
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1521
    |y0 y1 yD h dH size noSel|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1522
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1523
    (size := aList size) == 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1524
        ^ self
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1525
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1526
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1527
    beDependentOfRows ifTrue:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1528
        aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1529
    ].
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1530
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1531
    list isNil ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1532
        self list:aList.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1533
    ] ifFalse:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1534
        noSel := self numberOfSelections.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1535
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1536
        noSel ~~ 0 ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1537
            multipleSelectOk ifFalse:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1538
                selectedRowIndex >= start ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1539
                    selectedRowIndex := selectedRowIndex + size
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1540
                ]
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1541
            ] ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1542
                1 to:noSel do:[:i||v|
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1543
                    (v := selectedRowIndex at:i) >= start ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1544
                        selectedRowIndex at:i put:(v + size)
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1545
                    ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1546
                ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1547
            ]
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1548
        ].
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1549
        list addAll:aList beforeIndex:start.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1550
    ].
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1551
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1552
    self recomputeHeightOfContents.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1553
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1554
    y0 := (start - 1) * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1555
    yD := size * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1556
    y1 := y0 + yD.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1557
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1558
    y0 < viewOrigin y ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1559
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1560
        viewOrigin := viewOrigin x @ (yD + viewOrigin y).
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1561
        "/ viewOrigin y:(yD + viewOrigin y).
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1562
        self originChanged:(0 @ yD).
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1563
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1564
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1565
    (shown not or:[self sensor hasDamageFor:self]) ifTrue:[
2044
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1566
        self invalidate.
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1567
        self contentsChanged.
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1568
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1569
    ].
645
53c78cc2ee08 redraw twice in case of expose event during adding a new entry
ca
parents: 643
diff changeset
  1570
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1571
    y0 := self yVisibleOfRowNr:start.
1258
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1572
    h  := height - margin.
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1573
    y1 := y0 + yD min:h.
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1574
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1575
    (y1 > margin and:[y0 < h]) ifTrue:[
1952
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1576
        "/ cg: if I have a non-solid background color,
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1577
        "/ or individual items have a bgColor selector,
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1578
        "/ invalidate the area (and readraw) instead of a scroll.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1579
        (viewBackground isImageOrForm
1952
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1580
        or:[ self anyColumnHasPotentialNonConstantBackground ])
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1581
        ifTrue:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1582
            "/ do not scroll but invalidate ...
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1583
            self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1584
        ] ifFalse:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1585
            h  := h - y1.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1586
            y0 := y0 max:margin.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1587
            dH := y1 - y0.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1588
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1589
            start == list size ifFalse:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1590
                self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:h async:false
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1591
            ].
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1592
            self invalidateX:margin y:y0 width:width - margin - margin height:dH.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1593
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1594
    ].
3478
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1595
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1596
    self contentsChanged.
3478
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1597
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1598
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1599
        self scrollToBottom.
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1600
    ].
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  1601
!
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  1602
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1603
addFirst:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1604
    "insert a row at start"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1605
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1606
    ^ self add:aRow beforeIndex:1
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1607
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1608
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1609
remove:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1610
    "remove a row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1611
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1612
    |idx|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1613
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1614
    idx := list identityIndexOf:aRow.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1615
    idx ~~ 0 ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1616
        self removeFrom:idx to:idx.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1617
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1618
    ^ aRow
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1619
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1620
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1621
removeFirst
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1622
    "remove first row; returns the removed row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1623
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1624
    ^ self removeIndex:1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1625
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1626
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1627
removeFrom:startIndex to:stopIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1628
    "remove rows from start to stop"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1629
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1630
    |coll noRedraw
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1631
     noSel "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1632
     size  "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1633
     start "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1634
     stop  "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1635
     y0    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1636
     y1    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1637
     oY    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1638
     dY    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1639
     yB    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1640
     h     "{ Class: SmallInteger }"
6094
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1641
     myList|
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1642
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1643
    myList := list.
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1644
    
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1645
    (    (start := startIndex) < 1
6094
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1646
     or:[(stop := stopIndex) > myList size]
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1647
    ) ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1648
        ^ self subscriptBoundsError:start
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1649
    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1650
    size := stop - start + 1.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1651
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1652
    beDependentOfRows ifTrue:[
6094
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1653
        myList from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1654
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1655
    noSel := self numberOfSelections.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1656
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1657
    noSel ~~ 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1658
        noSel == 1 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1659
            noSel := self firstIndexSelected.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1660
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1661
            noSel < start ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1662
                noSel > stop ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1663
                    noSel := noSel - size.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1664
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1665
                    multipleSelectOk ifFalse:[selectedRowIndex := noSel]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1666
                                      ifTrue:[selectedRowIndex at:1 put:noSel]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1667
                ] ifFalse:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1668
                    editValue notNil ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1669
                        editValue removeDependent:self.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1670
                        editValue := nil.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1671
                    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1672
                    self deselect.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1673
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1674
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1675
        ] ifFalse:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1676
            coll := OrderedCollection new:noSel.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1677
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1678
            selectedRowIndex do:[:i|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1679
                i < start ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1680
                    coll add:i
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1681
                ] ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1682
                    i > stop ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1683
                        coll add:(i - size)
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1684
                    ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1685
                ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1686
            ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1687
            coll size == 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1688
                self deselect
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1689
            ] ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1690
                selectedRowIndex := coll
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1691
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1692
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1693
    ].
6094
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1694
    myList removeFrom:start to:stop.
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1695
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1696
    y0 := (start - 1) * rowHeight.
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1697
    dY := size * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1698
    y1 := dY + y0.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1699
    yB := y1 + margin - viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1700
    self recomputeHeightOfContents.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1701
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1702
    y0 < (oY := viewOrigin y) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1703
        (noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY]
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1704
                                ifTrue:[dY := dY negated].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1705
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1706
        viewOrigin := viewOrigin x @ (dY + oY).
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1707
        "/ viewOrigin y:(dY + oY).
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1708
        self originChanged:(0 @ dY).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1709
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1710
        noRedraw := y0 > (height + viewOrigin y)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1711
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1712
1483
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1713
    (shown not or:[self sensor hasDamageFor:self]) ifTrue:[
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1714
          self invalidate.
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1715
        ^ self contentsChanged.
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1716
    ].
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1717
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1718
    (noRedraw or:[shown not]) ifFalse:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1719
        y0 := self yVisibleOfRowNr:start.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1720
        y0 := y0 max:margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1721
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1722
        "/ cg: if I have a non-solid background color,
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1723
        "/ or individual items have a bgColor selector,
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1724
        "/ invalidate the area (and readraw) instead of a scroll.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1725
        (viewBackground isImageOrForm
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1726
        or:[ self anyColumnHasPotentialNonConstantBackground ])
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1727
        ifTrue:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1728
            "/ do not scroll but invalidate ...
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1729
        ] ifFalse:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1730
            y1 := yB.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1731
            h  := height - margin - yB.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1732
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1733
            h > 0 ifTrue:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1734
                self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:false
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1735
            ].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1736
            y0 := y0 + h.
561
43b62e424d52 check height is positive before copy
ca
parents: 556
diff changeset
  1737
        ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1738
        self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1739
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1740
    self contentsChanged.
6094
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1741
fda155fd4f93 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6072
diff changeset
  1742
    "Modified: / 23-07-2019 / 11:38:00 / Claus Gittinger"
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1743
!
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1744
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1745
removeIndex:aRowNr
6072
f62d23bf936f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6054
diff changeset
  1746
    "remove row at an index.
f62d23bf936f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6054
diff changeset
  1747
     Returns the removed row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1748
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1749
    |row|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1750
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1751
    row := list at:aRowNr ifAbsent:nil.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1752
    self removeFrom:aRowNr to:aRowNr.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1753
    ^ row
6072
f62d23bf936f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6054
diff changeset
  1754
f62d23bf936f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6054
diff changeset
  1755
    "Modified (comment): / 24-06-2019 / 12:47:34 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1756
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1757
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1758
removeLast
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1759
    "remove last row; the row is returned"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1760
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1761
    ^ self removeIndex:(list size)
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1762
!
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1763
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1764
replaceFrom:start to:stop with:aCollection startingAt:repStart
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1765
    "replace elements in the receiver between index start and stop,
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1766
     with elements  taken from replacementCollection starting at repStart.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1767
     Return the receiver."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1768
2032
6eb610caad85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1769
    |inSelList listSize repStop run|
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1770
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1771
    inSelList := OrderedCollection new.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1772
    listSize  := list size.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1773
    repStop   := repStart + (stop - start).
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1774
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1775
    list isNil ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1776
        list := OrderedCollection new
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1777
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1778
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1779
    [listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1780
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1781
    start to:stop do:[:i| |aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1782
        aRow := list at:i ifAbsent:nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1783
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1784
        aRow notNil ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1785
            beDependentOfRows ifTrue:[aRow removeDependent:self].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1786
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1787
            (self isInSelection:i) ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1788
                inSelList add:i
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1789
            ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1790
            list at:i put:nil.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1791
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1792
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1793
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1794
    beDependentOfRows ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1795
        aCollection from:repStart to:repStop do:[:aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1796
            aRow notNil ifTrue:[aRow addDependent:self]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1797
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1798
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1799
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1800
    run := start.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1801
    aCollection from:repStart to:repStop do:[:aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1802
        list at:run put:aRow.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1803
        run := run + 1.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1804
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1805
    self invalidateRowsFrom:start to:stop.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1806
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1807
    inSelList size ~~ 0 ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1808
        self numberOfSelections == inSelList size ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1809
            self deselect
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1810
        ] ifFalse:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1811
            selectedRowIndex := selectedRowIndex select:[:i| (inSelList identityIndexOf:i) == 0 ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1812
            self selectionChanged.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1813
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1814
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1815
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1816
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1817
!DSVColumnView methodsFor:'change & update'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1818
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1819
changeWidthOfColumn:aColumn deltaX:aDeltaX
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1820
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1821
    aColumn setDescWidth:(aColumn width + aDeltaX).
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1822
    cachedPreferredExtent notNil ifTrue:[self fitColumns]
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1823
!
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1824
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1825
update:what with:aPara from:chgObj
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1826
    "one of my rows/cells changed its value"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1827
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1828
    |row listHoldersList arg1 arg2 col|
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1829
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1830
    chgObj == columnHolder ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1831
        cachedPreferredExtent := nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1832
        self columnDescriptors:(columnHolder value).
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1833
        ^ self.
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1834
    ].
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1835
    chgObj == columnAdaptor ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1836
        col := columnAdaptor value.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1837
        columnDescriptors do:[:aCol |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1838
            aCol columnAdaptor:col
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1839
        ].
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1840
        self invalidate.
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1841
        ^ self
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1842
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1843
    chgObj == editValue ifTrue:[
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1844
        self updateColumnFromEditValue.
1227
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1845
        ^ self
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1846
    ].
6053
88091f958e67 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6051
diff changeset
  1847
    chgObj == enableChannel ifTrue:[
6054
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
  1848
        enableChannel value ifFalse:[
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
  1849
            self deselect.  "Selected Checkboxes can still be edited, so deselect"
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
  1850
        ].        
6053
88091f958e67 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6051
diff changeset
  1851
        self invalidate.
88091f958e67 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6051
diff changeset
  1852
        ^ self
88091f958e67 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6051
diff changeset
  1853
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1854
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1855
    chgObj == model ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1856
        (what == #selectionIndex or:[ what == #selection ]) ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1857
            self selectRowIndex:(model selectionIndex copy).
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1858
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1859
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1860
        what == #list ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1861
            cachedPreferredExtent := nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1862
            self listHolder:model list.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1863
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1864
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1865
        what == #value ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1866
            model == listHolder ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1867
                cachedPreferredExtent := nil.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1868
                self list:(listHolder value)
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1869
            ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1870
                useIndex ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1871
                    self selectRowIndex:model value
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1872
                ] ifFalse:[
6051
d7240d502ea7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
  1873
                    |myList newSel|
d7240d502ea7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
  1874
d7240d502ea7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
  1875
                    myList := self list ? #().
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1876
                    multipleSelectOk ifTrue:[
6051
d7240d502ea7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
  1877
                        newSel := (model value ? #()) 
d7240d502ea7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
  1878
                                    collect:[:each | myList indexOf:each]
d7240d502ea7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
  1879
                                    thenSelect:[:eachIdx | eachIdx ~~ 0].
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1880
                    ] ifFalse:[
6051
d7240d502ea7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
  1881
                        newSel := myList indexOf:model value
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1882
                    ].
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1883
                    self selectRowIndex:newSel
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1884
                ].
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1885
            ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1886
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1887
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1888
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1889
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  1890
    (chgObj == listHolder) ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1891
        cachedPreferredExtent := nil.
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
  1892
        listHoldersList := listHolder value.
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  1893
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1894
        what == #value ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1895
            self list:listHoldersList.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1896
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1897
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1898
        aPara isCollection ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1899
            arg1 := aPara at:1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1900
            arg2 := aPara at:2.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1901
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1902
            arg1 := arg2 := aPara
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1903
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1904
        what == #at: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1905
            self at:arg1 put:(listHoldersList at:arg1).
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1906
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1907
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1908
        what == #insert: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1909
            self add:(listHoldersList at:arg1) beforeIndex:arg1.
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1910
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1911
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1912
        what == #remove: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1913
            self removeFrom:arg1 to:arg1.
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1914
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1915
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1916
        what == #removeFrom: ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1917
            listHoldersList size == 0 ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1918
                self list:nil
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1919
            ] ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1920
                self removeFrom:arg1 to:arg2
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1921
            ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1922
            ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1923
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1924
        what == #insertCollection: ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1925
            arg2 ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1926
                self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1))
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1927
                    beforeIndex:arg1
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1928
            ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1929
            ^ self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1930
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1931
        what == #replace: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1932
            self
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1933
                replaceFrom:arg1 to:arg2
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1934
                with:listHoldersList startingAt:arg1.
2537
cf1b9b6eeb41 change update:with:from: - ask cg
penk
parents: 2535
diff changeset
  1935
            ^ self
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1936
        ].
2537
cf1b9b6eeb41 change update:with:from: - ask cg
penk
parents: 2535
diff changeset
  1937
        self list:listHoldersList.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1938
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1939
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1940
1593
2188ae28557e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
  1941
    arg1 := aPara ? what.
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  1942
    row := (what isNumber) ifTrue:[what] ifFalse:[chgObj].
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  1943
    self invalidateVisibleRow:row readSelector:arg1.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1944
    editView notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1945
        (self isInSelection:(self identityIndexOfRow:row)) ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1946
            self updateEditorFromChangedRow
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1947
        ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1948
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1949
5719
d53bae9fd8b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5718
diff changeset
  1950
    "Modified: / 30-01-2000 / 12:16:49 / cg"
d53bae9fd8b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5718
diff changeset
  1951
    "Modified: / 08-03-2018 / 18:06:19 / stefan"
6051
d7240d502ea7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6043
diff changeset
  1952
    "Modified: / 21-05-2019 / 17:22:20 / Claus Gittinger"
6054
8b6b5de90065 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6053
diff changeset
  1953
    "Modified: / 22-05-2019 / 16:26:57 / Stefan Vogel"
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1954
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1955
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1956
updateColumnFromEditValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1957
    |editValueBefore firstSelectedIndex newValue realValue col|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1958
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1959
    editValueBefore := editValue.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1960
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1961
    firstSelectedIndex := self firstIndexSelected.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1962
    newValue := editValue value.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1963
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1964
    col := self selectedColumn.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1965
    col at:firstSelectedIndex put:newValue.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1966
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1967
    col editorType == #RadioButton ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1968
        "/ turn off the other column
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1969
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1970
        1 to:list size do:[:rowNr |
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1971
            rowNr ~~ firstSelectedIndex ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1972
                (col at:rowNr) ~~ false ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1973
                    col at:rowNr put:false.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1974
                    self invalidateRowAt:rowNr colAt:col columnNumber.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1975
                ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1976
            ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1977
        ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1978
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1979
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1980
    realValue := col at:firstSelectedIndex.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1981
    (realValue ~= newValue) ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1982
        "/ some validation by the row-object; the stored value
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1983
        "/ is different from what I think.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1984
        "/ update my input fields modelValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1985
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1986
        "/ just in case someone nilled or changed the editValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1987
        "/ Q: is this CA's paranoia or could this really be done in the at:put: above ???
3518
ab2b4b5cfda0 Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  1988
        "/ A (sv): it me happen, if the set method specified in the column descriptor did not set the
ab2b4b5cfda0 Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  1989
        "/         model.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1990
        (editValueBefore == editValue) ifTrue:[
3518
ab2b4b5cfda0 Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  1991
            editValue value:realValue withoutNotifying:self.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1992
        ].
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1993
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1994
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1995
    modifiedChannel notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1996
        modifiedChannel value:true.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1997
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1998
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1999
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  2000
updateEditorFromChangedRow
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  2001
    |rowsValue rowNr|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  2002
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  2003
    (rowNr := selectedRowIndex) isNumber ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  2004
        rowNr := rowNr first.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  2005
    ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2006
    rowsValue := (self columnDescriptorAt:self selectedColIndex) at:rowNr.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2007
    (editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2008
        editValue value:rowsValue withoutNotifying:self.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2009
        editView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2010
            withAllSubViewsDo:[:v |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2011
                v isInputField ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2012
                    v flash.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2013
                ]
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  2014
            ]
2702
35892dc4449a bugfix: test whether editValue notNil
ca
parents: 2695
diff changeset
  2015
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2016
!
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2017
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2018
updateList
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2019
    listHolder notNil ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2020
        self list:listHolder value.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2021
        ^ self
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2022
    ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2023
    model notNil ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2024
        self list:model value.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2025
        ^ self
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2026
    ].
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2027
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2028
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2029
!DSVColumnView methodsFor:'drag & drop'!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2030
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2031
canDrag
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2032
    "returns true if dragging is enabled"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2033
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2034
    ^ dropSource notNil
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2035
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2036
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2037
canStartDragAt:aPoint clickedAt:clickPoint
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2038
    self canDrag ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2039
        ^ false
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2040
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2041
    ^ (aPoint dist:clickPoint) > (UserPreferences current motionDistanceToStartDrag)
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2042
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2043
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2044
dragAutoScroll:aDropContext
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2045
    "called by the DragAndDropManager to scroll during a drag/drop operation
5805
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2046
     if required (decided by the widget itself). 
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2047
     If a scroll is done, return true;
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2048
     otherwise false (used to restore the background)"
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2049
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2050
    |yInset absLnNr y|
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2051
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2052
    (super dragAutoScroll:aDropContext) ifTrue:[^ true].
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2053
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2054
    y := aDropContext targetPoint y.
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2055
    yInset := margin + rowHeight.
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2056
    y > yInset ifTrue:[
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2057
        y >= (height - yInset) ifFalse:[^ false].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2058
    ].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2059
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2060
    absLnNr := self yVisibleToRowNr:y.
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2061
    absLnNr isNil ifTrue:[^ false].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2062
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2063
    (absLnNr > 1 and:[absLnNr < self size]) ifFalse:[
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2064
        ^ false
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2065
    ].
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2066
    aDropContext contentsWillChange.
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2067
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2068
    y > yInset
2580
aea885fae0de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2069
        ifTrue:[self scrollDown:rowHeight]
aea885fae0de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2070
        ifFalse:[self scrollUp:rowHeight].
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2071
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2072
    ^ true
5805
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2073
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2074
    "Modified: / 14-06-2018 / 11:21:13 / Claus Gittinger"
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2075
!
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2076
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2077
dropSource
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2078
    "returns the dropSource or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2079
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2080
    ^ dropSource
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2081
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2082
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2083
dropSource:aDropSourceOrNil
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2084
    "set the dropSource or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2085
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2086
    dropSource := aDropSourceOrNil.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2087
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2088
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2089
startDragAt:aPoint
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2090
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2091
    dropSource notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2092
        buttonReleaseAction := buttonMotionAction := nil.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2093
        dropSource startDragIn:self at:aPoint.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2094
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2095
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2096
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2097
!DSVColumnView methodsFor:'drawing'!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2098
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2099
colorOnDevice:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2100
    "returns color on device"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2101
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2102
    |col|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2103
641
tz
parents: 637
diff changeset
  2104
    aColor = Color noColor ifFalse:[
tz
parents: 637
diff changeset
  2105
        col := colorMap at:aColor ifAbsent:nil.
tz
parents: 637
diff changeset
  2106
        col isNil ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  2107
            colorMap at:aColor put:(col := aColor onDevice:device)
641
tz
parents: 637
diff changeset
  2108
        ].
tz
parents: 637
diff changeset
  2109
        ^ col
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2110
    ].
641
tz
parents: 637
diff changeset
  2111
    ^ bgColor
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2112
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2113
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2114
forceRedraw
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2115
    "a redraw forced by any other component"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2116
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2117
    shown ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2118
        self invalidate
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2119
    ]
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2120
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2121
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2122
invalidate
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2123
    "recompute extent before repair range"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2124
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2125
    self recomputeHeightOfContents.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2126
    super invalidate.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2127
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2128
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2129
invalidateRowAt:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2130
    "redraw total row at an index"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2131
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2132
    self invalidateRowAt:aRowNr colAt:0
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2133
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2134
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2135
invalidateRowAt:aRowNr colAt:aColNr
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2136
    "redraw either a single column in a row,
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2137
     or the complete visible row (in case of aColNr == 0).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2138
     If the row/column is hidden, no redraw is done"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2139
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2140
    |x "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2141
     y "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2142
     h "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2143
     w "{ Class:SmallInteger }"
2523
a7d71e57632f care for non-existing column
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
  2144
     col|
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2145
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2146
    (shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2147
        h := rowHeight.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2148
        y := self yVisibleOfRowNr:aRowNr.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2149
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2150
        y < margin ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2151
            (h := h + y) <= margin ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2152
                ^ self
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2153
            ].                                                  "/ row not visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2154
            h := h - margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2155
            y := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2156
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2157
            y >= height ifTrue:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2158
        ].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2159
        aColNr ~~ 0 ifTrue:[                                    "/ redraw column in row
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2160
            col := (self columnDescriptorAt:aColNr).
3672
ff861e62db1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
  2161
            w := col isNil ifTrue:[0] ifFalse:[col width].
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2162
            x := self xVisibleOfColNr:aColNr.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2163
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2164
            x < margin ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2165
                (w := w + x) <= margin ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2166
                    ^ self
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2167
                ].                                              "/ column not visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2168
                w := w - margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2169
                x := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2170
            ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2171
                x >= width ifTrue:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2172
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2173
        ] ifFalse:[                                             "/ redraw whole row
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2174
            x := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2175
            w := width.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2176
        ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2177
        self invalidateX:x y:y width:w height:h
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2178
    ]
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2179
!
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2180
2469
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2181
invalidateRows:aCollection
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2182
    "redraw some visible rows"
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2183
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2184
    shown ifTrue:[
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2185
        aCollection do:[:rowIndex |
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2186
            self invalidateRowAt:rowIndex
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2187
        ]
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2188
    ]
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2189
!
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2190
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2191
invalidateRowsFrom:aStart to:aStop
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2192
    "redraw visible row from start to stop"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2193
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2194
    |size start stop y0 y1|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2195
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2196
    shown ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2197
        size  := list size.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2198
        start := aStart notNil ifTrue:[aStart max:1]    ifFalse:[1].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2199
        stop  := aStop  notNil ifTrue:[aStop  min:size] ifFalse:[size].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2200
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2201
        start <= stop ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2202
            y0 := (self yVisibleOfRowNr:start)              max:margin.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2203
            y1 := ((self yVisibleOfRowNr:stop) + rowHeight) min:height.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2204
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2205
            y0 < y1 ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2206
                self invalidateX:margin y:y0 width:width height:(y1 - y0)
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2207
            ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2208
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2209
    ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2210
!
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2211
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2212
invalidateSelection
5214
1f88a970e4db #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5204
diff changeset
  2213
    "invalidate (force async redraw) the current selection"
1f88a970e4db #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5204
diff changeset
  2214
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2215
    |colIndex|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2216
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2217
    shown ifTrue:[
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2218
        colIndex := self selectedColIndex ? 0.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2219
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2220
        self selectionIndicesDo:[:aRowIndex|
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2221
            self invalidateRowAt:aRowIndex colAt:colIndex.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2222
        ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2223
    ]
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2224
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2225
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2226
invalidateVisibleRow:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2227
    "redraw row if visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2228
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2229
    self invalidateVisibleRow:aRow colAt:0
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2230
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2231
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2232
invalidateVisibleRow:aRow colAt:aColNr
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2233
    "redraw either a single column in a row,
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2234
     or the complete visible row (in case of aColNr == 0).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2235
     If the row/column is hidden, no redraw is done"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2236
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2237
    |start "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2238
     stop  "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2239
    |
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2240
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2241
    (start := self indexOfFirstRowShown) ~~ 0 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2242
        stop := (start + (height // rowHeight)) min:(list size).
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2243
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2244
        aRow isNumber ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2245
            (aRow between:start and:stop) ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2246
                self invalidateRowAt:aRow colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2247
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2248
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2249
            start to:stop do:[:i|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2250
                (self at:i) == aRow ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2251
                    ^ self invalidateRowAt:i colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2252
                ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2253
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2254
        ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2255
    ]
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2256
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2257
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2258
invalidateVisibleRow:aRow readSelector:aSelector
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2259
    "redraw a column identified by its read selector; if no column with
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2260
     the specified read selector is detected, the whole line is drawn."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2261
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2262
    |row idx|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2263
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2264
    aSelector isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2265
        idx := 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2266
    ] ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2267
        (row := aRow) isNumber ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2268
            (row := self at:aRow) isNil ifTrue:[ ^ self ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2269
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2270
        idx := columnDescriptors
4686
dda678ab83bf class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  2271
                findFirst:[:aCol| aCol description readSelector == aSelector]
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2272
    ].
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2273
    self invalidateVisibleRow:aRow colAt:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2274
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2275
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2276
redrawX:x y:y width:w height:h
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2277
    "redraw part of myself immediately, given logical coordinates "
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2278
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2279
    |c0 savClip stopRedraw selWidth
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2280
     start "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2281
     stop  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2282
     x0    "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2283
     x1    "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2284
     maxX  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2285
     yTop  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2286
     yBot  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2287
     clHg  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2288
     size  "{ Class:SmallInteger }"
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2289
     lineColor
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2290
    |
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2291
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2292
    shown ifFalse:[^ self].
3993
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2293
    self isReallyShown ifFalse:[^ self].
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2294
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2295
    gc paint:bgColor.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2296
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2297
    columnDescriptors isEmpty ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2298
        ^ gc fillRectangleX:x y:y width:w height:h
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2299
    ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2300
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2301
    size  := list size.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2302
    yTop  := margin - viewOrigin y.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2303
    c0    := y - yTop max:0.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2304
    start := (c0 // rowHeight) + 1.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2305
    stop  := (((c0 + h - 1) // rowHeight) + 1) min:size.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2306
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2307
    stop < start ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2308
        ^ gc fillRectangleX:x y:y width:w height:h
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2309
    ].
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  2310
    savClip := self clippingBoundsOrNil.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2311
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2312
    maxX := (x + w) min:(width - margin).
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2313
    x0   := margin - viewOrigin x.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2314
    yTop := yTop + ((start - 1) * rowHeight).
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2315
    clHg := (stop - start + 1) * rowHeight.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2316
    yBot := yTop + clHg.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2317
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2318
    stopRedraw := false.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2319
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2320
    self class stopRedrawSignal handle:[:ex |
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2321
        "/ redraw aborted due to too many changes while drawing.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2322
        stopRedraw := true.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2323
    ] do:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2324
        columnDescriptors do:[:aCol| |cw|
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2325
            x1 := x0 + aCol width.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2326
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2327
            (x1 > x and:[x0 < maxX]) ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2328
                |left right rect|
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2329
                left  := x0 max:x.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2330
                right := x1 min:maxX.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2331
                rect  := Rectangle left:left top:y width:(right - left) height:h.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2332
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2333
                "/ self clippingBounds:nil.
5204
fccb63f32188 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5195
diff changeset
  2334
                self clippingBounds:rect.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2335
                aCol redrawX:x0 y:yTop h:clHg  from:start to:stop.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2336
            ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2337
            x0 := x1
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2338
        ].
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2339
    ].
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2340
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2341
    "/ restore old clipping rectangle
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  2342
    self clippingBounds:savClip.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2343
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2344
    stopRedraw ifTrue:[
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2345
        "/ redraw aborted due to too many changes while drawing.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2346
        "/ try again after some grace period
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2347
        Processor addTimedBlock:[self invalidate] after:0.1 seconds.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2348
        "/  self invalidate.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2349
        "/ self makeSelectionVisible.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2350
        ^ self
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2351
    ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2352
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2353
    stop == size ifTrue:[
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2354
        yTop := y + h.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2355
        yBot < (yTop - margin) ifTrue:[
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2356
            "/ clear to bottom of screen
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2357
            gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2358
            gc fillRectangleX:x y:yBot width:w height:(yTop - yBot).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2359
        ]
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2360
    ].
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2361
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2362
    (c0 := w + x- x1) > 0 ifTrue:[
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2363
        "/ clear to right of screen
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2364
        gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2365
        gc fillRectangleX:x1 y:y width:c0 height:h.
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2366
    ].
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2367
    "/ if only rows are selected we have to draw
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2368
    "/  - the selection frame around the labels
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2369
    "/  - and to fill the selection area behind the table if not bound to the width of the view
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2370
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2371
    self hasRowSelection ifFalse:[ ^ self ].  "/ nothing to do
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2372
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2373
    selWidth := width-margin-x1.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2374
    lineColor := self selectionFrameColor.
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2375
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2376
    self selectionIndicesDo:[:rowNr |
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2377
        | yVis |
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2378
        yVis := self yVisibleOfRowNr:rowNr.
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2379
        selWidth > 0 ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2380
            gc paint:selectionBackgroundColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2381
            gc fillRectangleX:x1 y:yVis width:selWidth height:rowHeight.
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2382
        ].
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2383
        lineColor notNil ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2384
            gc paint:lineColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2385
            gc displayLineFromX:x y:yVis toX:width y:yVis.
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2386
            yVis := yVis+rowHeight -1.
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2387
            gc displayLineFromX:x y:yVis toX:width y:yVis.
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2388
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2389
    ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2390
3993
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2391
    "Modified: / 21-01-2011 / 15:58:11 / cg"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2392
! !
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2393
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2394
!DSVColumnView methodsFor:'drawing interactors'!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2395
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2396
displayLabel:aLabel x:xLeft y:yTop
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2397
    "display the label at x y; test whether the height of the label matches to the current
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2398
     rowHeight. If not, an exception is raised and the rowHeight is recomputed"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2399
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2400
    |y h |
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2401
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2402
    aLabel notNil ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2403
        aLabel isString ifTrue:[
2593
24ddc48c5ad4 bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents: 2592
diff changeset
  2404
            y := yTop + self rowFontAscent.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2405
        ] ifFalse:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2406
            h := aLabel heightOn:self.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2407
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2408
            h > minRowHeight ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2409
                minRowHeight := h.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2410
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2411
                cachedPreferredExtent notNil ifTrue:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2412
"/                    rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2413
                    cachedPreferredExtent := Point
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2414
                                            x: cachedPreferredExtent x
3172
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2415
                                            y: (list size * rowHeight).
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2416
                    self contentsChanged.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2417
                ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2418
                self class stopRedrawSignal raiseRequest.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2419
            ].
2593
24ddc48c5ad4 bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents: 2592
diff changeset
  2420
            y := yTop + (aLabel ascentOn:self).
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2421
        ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2422
        aLabel displayOn:self x:xLeft y:y.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2423
    ].
3172
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2424
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2425
    "Modified: / 05-02-2007 / 09:07:10 / cg"
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2426
!
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2427
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2428
drawCheckToggleAtX:xLeft y:yTop w:cellWidth state:cellValue
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2429
    "draw a check toggle button"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2430
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2431
    |e form
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2432
     y "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2433
     x "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2434
     h "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2435
     w "{ Class:SmallInteger }"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2436
     state|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2437
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2438
    state := (cellValue ? false).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2439
    state isBoolean ifFalse:[ state := false ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2440
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2441
    w := checkToggleExtent x.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2442
    h := checkToggleExtent y.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2443
    y := yTop + ((rowHeight - h) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2444
    x := xLeft + ((cellWidth  - w) // 2).
1529
aa5e8fae6f23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  2445
    h odd ifTrue:[y := y + 1].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2446
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2447
    checkToggleActiveImage isNil ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2448
        gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2449
        gc fillRectangleX:x y:y width:w height:h.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2450
        self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2451
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2452
        state ifFalse:[
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2453
            ^ self
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2454
        ].
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2455
        gc paint:fgColor on:bgColor.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2456
        form := checkToggleForm
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2457
    ] ifFalse:[
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2458
        form := self isEnabled
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2459
                    ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2460
                        state
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2461
                            ifTrue:[checkToggleActiveImage]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2462
                            ifFalse:[checkTogglePassiveImage]] 
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2463
                    ifFalse:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2464
                        state
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2465
                            ifTrue:[(checkToggleDisabledActiveImage ? checkToggleActiveImage)]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2466
                            ifFalse:[(checkToggleDisabledPassiveImage ? checkTogglePassiveImage)]].
859
e63eb6f321e1 support List for columns
ca
parents: 833
diff changeset
  2467
    ].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2468
    e := (checkToggleExtent - form extent) // 2.
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2469
    gc displayForm:form x:(x + e x) y:(y + e y).
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2470
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2471
    "Modified: / 17-08-2018 / 17:33:03 / Claus Gittinger"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2472
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2473
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2474
drawComboButtonAtX:xTop y:yTop w:rowWidth
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2475
    "draw a combo button"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2476
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2477
    |e
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2478
     x "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2479
     y "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2480
     h "{ Class:SmallInteger }"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2481
     w "{ Class:SmallInteger }"|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2482
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2483
    w := comboButtonExtent x.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2484
    h := comboButtonExtent y.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2485
    y := yTop + ((rowHeight - h) // 2).
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2486
    x := xTop + (rowWidth  - w - separatorSize - 1).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2487
    e := (comboButtonExtent - comboButtonForm extent) // 2.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2488
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2489
    gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2490
    gc fillRectangleX:x y:y width:w height:h.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2491
    self drawEdgesAtX:x   y:y width:w height:h level:comboButtonLevel on:self.
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2492
    gc paint:fgColor on:bgColor.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2493
    gc 
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2494
        displayForm:
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2495
            (self isEnabled 
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2496
                ifTrue:[comboButtonForm]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2497
                ifFalse:[comboButtonDisabledForm ? comboButtonForm])
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2498
        x:(x + e x) 
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2499
        y:(y + e y)
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2500
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2501
    "Modified: / 17-08-2018 / 17:35:20 / Claus Gittinger"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2502
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2503
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2504
drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2505
    "draw edges for a cell or label"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2506
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2507
    aGC
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2508
        drawEdgesForX:x
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2509
        y:y
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2510
        width:w
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2511
        height:h
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2512
        level:aLevel
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2513
        shadow:buttonShadowColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2514
        light:buttonLightColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2515
        halfShadow:buttonHalfShadowColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2516
        halfLight:buttonHalfLightColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2517
        style:ButtonEdgeStyle.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2518
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2519
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2520
drawRadioButtonAtX:xLeft y:yTop w:cellWidth state:aBooleanOrNil
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2521
    "draw a radio button"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2522
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2523
    |image
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2524
     y "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2525
     x "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2526
     h "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2527
     w "{ Class:SmallInteger }"|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2528
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2529
    w := radioButtonActiveImage extent x.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2530
    h := radioButtonActiveImage extent y.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2531
    y := yTop + ((rowHeight - h) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2532
    x := xLeft + ((cellWidth - w) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2533
    h odd ifTrue:[y := y + 1].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2534
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2535
    image := self isEnabled
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2536
                ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2537
                    (aBooleanOrNil == true)
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2538
                        ifTrue:[radioButtonActiveImage]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2539
                        ifFalse:[radioButtonPassiveImage]]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2540
                ifFalse:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2541
                    (aBooleanOrNil == true)
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2542
                        ifTrue:[radioButtonDisabledActiveImage ? radioButtonActiveImage]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2543
                        ifFalse:[radioButtonDisabledPassiveImage ? radioButtonPassiveImage]].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2544
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  2545
    image := image onDevice:device.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2546
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2547
    self displayForm:image x:x y:y.
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2548
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2549
    "Modified (format): / 04-02-2017 / 21:31:16 / cg"
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2550
    "Modified: / 17-08-2018 / 17:36:23 / Claus Gittinger"
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2551
! !
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2552
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2553
!DSVColumnView methodsFor:'enumerating columns'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2554
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2555
columnsDo:aOneArgBlock
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2556
    "evaluate the argument, aOneArgBlock for every columnDescriptor"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2557
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2558
    columnDescriptors do:aOneArgBlock
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2559
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2560
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2561
columnsFrom:start to:stop do:aOneArgBlock
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2562
    "evaluate the argument, aOneArgBlock for the columns with index start to
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2563
     stop in the collection of column descriptors"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2564
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2565
    columnDescriptors
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2566
        from:start
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2567
        to:stop
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2568
        do:aOneArgBlock
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2569
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2570
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2571
!DSVColumnView methodsFor:'event handling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2572
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2573
buttonControlPressAt:clickPoint rowNr:aRowNr colNr:aColNr
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2574
    |isSelected prvRow doAdd chgSet|
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2575
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2576
    buttonMotionAction := buttonReleaseAction := nil.
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2577
    isSelected := self isInSelection:aRowNr.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2578
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2579
    multipleSelectOk ifFalse:[
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2580
        isSelected ifTrue:[
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2581
            self deselect.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2582
        ] ifFalse:[
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2583
            self selectRowAt:aRowNr colAt:aColNr atPoint:clickPoint openEditor:false.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2584
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2585
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2586
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2587
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2588
    isSelected ifTrue:[ self removeRowFromSelection:aRowNr ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2589
              ifFalse:[ self addRowToSelection:aRowNr ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2590
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2591
    multipleSelectOk ifFalse:[ ^ self ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2592
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2593
    prvRow := aRowNr.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2594
    chgSet := IdentitySet new.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2595
    doAdd  := isSelected not.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2596
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2597
    buttonMotionAction := [:p|
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2598
        |rowNr mustRestore step f|
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2599
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2600
        rowNr := self yVisibleToRowNr:(p y).
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2601
        (rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2602
            rowNr == aRowNr ifTrue:[
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2603
                mustRestore := true
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2604
            ] ifFalse:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2605
                rowNr > aRowNr ifTrue:[ mustRestore := (rowNr < prvRow) ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2606
                              ifFalse:[ mustRestore := (rowNr > prvRow) ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2607
            ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2608
            prvRow > rowNr ifTrue:[ step := -1 ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2609
                          ifFalse:[ step :=  1 ].
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2610
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2611
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2612
            mustRestore ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2613
                [ prvRow ~~ rowNr ] whileTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2614
                    (chgSet removeIdentical:prvRow ifAbsent:nil) notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2615
                        doAdd ifFalse:[ self addRowToSelection:prvRow ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2616
                               ifTrue:[ self removeRowFromSelection:prvRow ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2617
                    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2618
                    prvRow := prvRow + step.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2619
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2620
            ] ifFalse:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2621
                [ prvRow ~~ rowNr ] whileTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2622
                    prvRow := prvRow + step.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2623
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2624
                    doAdd ~~ (self isInSelection:rowNr) ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2625
                        chgSet add:prvRow.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2626
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2627
                        doAdd ifTrue:[ self addRowToSelection:prvRow ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2628
                             ifFalse:[ self removeRowFromSelection:prvRow ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2629
                    ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2630
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2631
            ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2632
        ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2633
    ].
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  2634
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2635
    "Modified: / 21-07-2007 / 22:00:27 / cg"
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2636
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2637
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2638
buttonMotion:buttonMask x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2639
    "mouse-move while button was pressed - handle multiple selection changes"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2640
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2641
    self isEnabled ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2642
        ^ self
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2643
    ].
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2644
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2645
    buttonMotionAction notNil ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2646
        buttonMotionAction value:(x @ y).
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2647
        buttonMotionAction notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2648
            autoScroll ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2649
                "/ if moved outside of view, start autoscroll
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2650
                (y < 0) ifTrue:[
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  2651
                    ^ self startAutoScroll:#scrollUp distance:y.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2652
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2653
                (y > height) ifTrue:[
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  2654
                    ^ self startAutoScroll:#scrollDown distance:(y - height).
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2655
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2656
            ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2657
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2658
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2659
    self stopAutoScroll.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2660
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2661
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2662
buttonMultiPress:button x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2663
    "a button was pressed twice - handle doubleclick here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2664
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2665
    |selectedCol|
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2666
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2667
    buttonMotionAction := buttonReleaseAction := nil.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2668
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2669
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2670
3742
a4bb22bc79e2 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  2671
    (button == 1) ifFalse:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2672
        ^ super buttonMultiPress:button x:x y:y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2673
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2674
    self numberOfSelections == 1 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2675
        self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2676
            selectedCol := self selectedColIndex.
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2677
            ( selectedCol == 0
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2678
              or:[selectedCol == (self xVisibleToColNr:x)]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2679
            ) ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2680
                self doubleClicked
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2681
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2682
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2683
    ]
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2684
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2685
    "Modified: / 26-03-2007 / 15:19:04 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2686
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2687
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2688
buttonPress:button x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2689
    "a button was pressed - handle selection here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2690
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2691
    |rowNr colNr sensor clickPoint clickedIntoSelection column columnEditorType|
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2692
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2693
    buttonMotionAction := buttonReleaseAction := nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2694
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2695
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2696
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2697
    rowNr := self yVisibleToRowNr:y.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2698
    colNr := self xVisibleToColNr:x.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2699
5895
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2700
    (button == 2) ifTrue:[ 
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2701
        |openMenu|
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2702
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2703
        openMenu := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2704
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2705
        UserPreferences current selectOnRightClick ifFalse:[
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2706
            openMenu := true.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2707
        ] ifTrue:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2708
            UserPreferences current showRightButtonMenuOnRelease ifFalse:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2709
                (rowNr notNil and:[colNr notNil and:[self isRowSelectable:rowNr]]) ifTrue:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2710
                    self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2711
                ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2712
                openMenu := true.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2713
            ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2714
        ].
5895
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2715
        openMenu ifTrue:[ 
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2716
            |menu|
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2717
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2718
            menu := self findMenuForSelection.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2719
            menu notNil ifTrue:[
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2720
                self startUpMenu:menu.
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2721
            ] ifFalse:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2722
                super buttonPress:button x:x y:y.
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2723
            ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2724
            ^ self
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2725
        ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2726
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2727
2804
8204b926377d oops - firstRow could be nil
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
  2728
    (rowNr isNil or:[colNr isNil]) ifTrue:[
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  2729
        self deselect.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2730
        super buttonPress:button x:x y:y.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2731
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2732
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2733
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  2734
    (self isRowSelectable:rowNr) ifFalse:[^ self ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  2735
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2736
    sensor     := self sensor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2737
    clickPoint := x @ y.
2813
74cfefd3a0a4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2812
diff changeset
  2738
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2739
    sensor shiftDown ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2740
        self buttonShiftPressAt:clickPoint rowNr:rowNr colNr:colNr.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2741
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2742
    ].
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2743
    sensor ctrlDown ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2744
        self buttonControlPressAt:clickPoint rowNr:rowNr colNr:colNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2745
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2746
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2747
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2748
    multipleSelectOk ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2749
        self canDrag ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2750
            self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2751
            ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2752
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2753
        self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2754
3923
d5c71ade2f43 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  2755
        ((button == 2) and:[UserPreferences current selectOnRightClick]) ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2756
            self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2757
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2758
            buttonReleaseAction :=
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2759
                [
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2760
                    buttonReleaseAction := nil.
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2761
                    self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true.
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2762
                ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2763
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2764
            buttonMotionAction :=
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2765
                [:aPoint|
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2766
                    (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2767
                        self startDragAt:aPoint
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2768
                    ]
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2769
                ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2770
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2771
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2772
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2773
3923
d5c71ade2f43 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  2774
    ((button == 2) and:[UserPreferences current selectOnRightClick]) ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2775
        buttonReleaseAction :=
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2776
            [
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2777
                buttonReleaseAction := nil.
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2778
                self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2779
            ].
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2780
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2781
        "/ normally, we select on button release; however, any editor is shown immediately
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2782
        ((column := self columnDescriptorAt:colNr) notNil
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2783
          and:[ (columnEditorType := column description editorType) notNil
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2784
          and:[ columnEditorType ~~ #None ]]
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2785
        ) ifTrue:[
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2786
            buttonReleaseAction value.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2787
            buttonReleaseAction := nil.
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2788
            (editView notNil and:[editView isDialogBox]) ifTrue:[
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2789
                editView := nil.
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2790
            ].    
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2791
            editView notNil ifTrue:[
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2792
                ^ self.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2793
            ]
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2794
        ]
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2795
    ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2796
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2797
    clickedIntoSelection := self isInSelection:rowNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2798
    clickedIntoSelection ifTrue:[
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2799
        |selColIdx|
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2800
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2801
        selColIdx := self selectedColIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2802
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2803
        (selColIdx ~~ 0 and:[selColIdx ~~ colNr]) ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2804
            clickedIntoSelection := (selectedRowIndex size > 1)
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2805
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2806
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2807
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2808
    clickedIntoSelection ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2809
        self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2810
    ] ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2811
        self canDrag ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2812
            buttonMotionAction :=
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2813
                [:aPoint|
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2814
                    (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2815
                        self startDragAt:aPoint
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2816
                    ]
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2817
                ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2818
            ^ self
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2819
        ]
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2820
    ].
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2821
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2822
    buttonMotionAction := [:p|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2823
        (self bounds containsPoint:p) ifTrue:[
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2824
            |rowUnderPoint|
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2825
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2826
            rowUnderPoint := self yVisibleToRowNr:(p y).
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2827
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2828
            rowUnderPoint notNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2829
                buttonReleaseAction notNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2830
                    rowUnderPoint == rowNr ifFalse:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2831
                        buttonReleaseAction := nil
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2832
                    ].
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2833
                ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2834
                buttonReleaseAction isNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2835
                    self selectRowFrom:rowNr to:rowUnderPoint.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2836
                ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2837
            ]
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2838
        ].
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2839
    ].
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2840
4056
36eb0b1137db changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4055
diff changeset
  2841
    "Modified: / 12-07-2011 / 14:54:45 / cg"
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  2842
    "Modified: / 23-04-2019 / 19:53:40 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2843
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2844
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2845
buttonRelease:button x:x y:y
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2846
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2847
    buttonMotionAction := nil.
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2848
    self stopAutoScroll.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2849
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2850
    buttonReleaseAction notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2851
        buttonReleaseAction value.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2852
        buttonReleaseAction := nil.
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2853
    ].
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2854
    super buttonRelease:button x:x y:y
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2855
!
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2856
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2857
buttonShiftPressAt:clickPoint rowNr:aRowNr colNr:aColNr
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2858
    |colIdx numSelRows|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2859
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2860
    buttonReleaseAction := buttonMotionAction := nil.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2861
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2862
    colIdx := aColNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2863
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2864
    (multipleSelectOk and:[(numSelRows := selectedRowIndex size) > 0]) ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2865
        (numSelRows == 1 and:[self isInSelection:aRowNr]) ifFalse:[ |min max|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2866
            min := max := aRowNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2867
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2868
            selectedRowIndex do:[:anIndex|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2869
                min := min min:anIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2870
                max := max max:anIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2871
            ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2872
            self selectRowFrom:min to:max.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2873
            ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2874
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2875
        self selectedColIndex ~~ 0 ifTrue:[     "/ toggle column selection
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2876
            colIdx := 0
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2877
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2878
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2879
    self selectRowAt:aRowNr colAt:colIdx atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2880
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2881
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2882
characterPress:aChar x:x y:y
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  2883
    "search row in column at x/y starting its printable label with character."
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2884
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2885
    |colNr rowNr lsize found column|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2886
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2887
    lsize  := list size.
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2888
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2889
"/    (rowIfAbsentBlock notNil
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2890
"/     or:[x isNil
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2891
"/     or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2892
"/        ^ self
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2893
"/    ].
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2894
    colNr := self findFirstColumnWithStringFrom:1 to:lsize.
2535
4df3f0a09b83 fixed: characterPressed: ... on non editable column
tm
parents: 2524
diff changeset
  2895
    colNr isNil ifTrue:[ ^ self ].
4df3f0a09b83 fixed: characterPressed: ... on non editable column
tm
parents: 2524
diff changeset
  2896
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2897
    rowNr  := self lastIndexSelected.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2898
    column := self columnDescriptorAt:colNr.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2899
    found  := 0.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2900
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2901
    lsize > rowNr ifTrue:[
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2902
        "/ search to end
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2903
        found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2904
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2905
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2906
    (found == 0 and:[rowNr > 1]) ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2907
     "/ search from begin
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2908
        found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1)
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2909
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2910
    found ~~ 0 ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2911
        self selectColIndex:colNr rowIndex:found.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2912
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2913
896
aa07612a7c04 care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2914
    "Modified: / 21.5.1998 / 03:30:22 / cg"
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2915
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2916
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2917
contentsChanged
4257
0740dae4df00 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  2918
    "size of contents changed - move origin up if possible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2919
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2920
    |y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2921
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2922
    shown ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2923
        self recomputeHeightOfContents.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2924
        y := self maxViewOriginY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2925
        viewOrigin y > y ifTrue:[
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2926
            scrollWhenUpdating ~~ false ifTrue:[
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2927
                self scrollTo:(viewOrigin x @ y)
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2928
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2929
        ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2930
            self updateEditViewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2931
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2932
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2933
    super contentsChanged
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2934
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2935
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2936
cursorKey:aKey rawKey:rawKey
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2937
    |hasSelectables step start minSelRowNr maxSelRowNr selColNr selRowNr listSize|
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2938
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2939
    hasSelectables := self hasSelectables.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2940
    listSize := list size.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2941
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2942
    (hasSelectables or:[selectRowOnDefault]) ifFalse:[ ^ self ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2943
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2944
    minSelRowNr := self minIndexSelected.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2945
    maxSelRowNr := self maxIndexSelected.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2946
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  2947
    selColNr := hasSelectables ifFalse:[0] ifTrue:[self selectedColIndex].
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2948
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2949
    aKey == #CursorUp ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2950
        selRowNr := minSelRowNr > 1 ifTrue:[minSelRowNr - 1] ifFalse:[listSize].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2951
        step := -1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2952
    ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2953
        aKey == #CursorDown ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2954
            selRowNr := maxSelRowNr < listSize ifTrue:[maxSelRowNr + 1] ifFalse:[1].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2955
            step := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2956
        ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2957
            ("aKey == #BeginOfLine or:[" rawKey == #Home "]") ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2958
                selRowNr := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2959
                step := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2960
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2961
                (rawKey == #End) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2962
                    selRowNr := listSize.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2963
                    step := -1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2964
                ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2965
            ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2966
        ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2967
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2968
    start := selRowNr.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2969
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2970
    [ self isRowSelectable:selRowNr ] whileFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2971
        selRowNr := selRowNr + step.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2972
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2973
        selRowNr == 0 ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2974
            selRowNr := listSize.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2975
        ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2976
            selRowNr > listSize ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2977
                selRowNr := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2978
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2979
        ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2980
        selRowNr == start ifTrue:[^ self ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2981
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2982
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2983
    ((aKey == #CursorUp) or:[aKey == #CursorDown]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2984
        (multipleSelectOk and:[self sensor shiftDown]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2985
            self addRowToSelection:selRowNr.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2986
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2987
            aKey == #CursorDown ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2988
                self makeLineVisible:((selRowNr+1) min:listSize)
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2989
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2990
                self makeLineVisible:((selRowNr-1) max:1)
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2991
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2992
            ^ self
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2993
        ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2994
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2995
    self selectColIndex:selColNr rowIndex:selRowNr
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2996
!
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2997
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2998
doubleClicked
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2999
    "handle a double click"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3000
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3001
    |col sel idx|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3002
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3003
    self hasSelection ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3004
        idx := self firstIndexSelected.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3005
        col := self selectedColumn.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3006
        (col notNil and:[ (sel := col doubleClickedSelector) notNil ]) ifTrue:[
2074
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2044
diff changeset
  3007
            col doubleClickOn:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3008
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3009
            doubleClickActionBlock notNil ifTrue:[
4772
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
  3010
                doubleClickActionBlock valueWithOptionalArgument:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3011
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3012
        ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3013
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3014
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3015
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3016
findMenuForSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3017
    "find the middle button menu for the current selection; returns the menu or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3018
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3019
    |col row menu|
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3020
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3021
    self numberOfSelections == 1 ifTrue:[
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3022
        row := self at:(self firstIndexSelected).
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3023
        col := self selectedColumn.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3024
        col notNil ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3025
            menu := col menuForRow:row orAdaptor:columnAdaptor.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3026
            menu notNil ifTrue:[ ^ menu ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3027
        ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3028
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3029
        col := columnDescriptors
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3030
                        detect:[:c | c rendererType == #rowSelector ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3031
                        ifNone:[ nil ].
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3032
        col notNil ifTrue:[
1223
176702811314 kludge: when asking for an itemMenu, pass application to
tm
parents: 1215
diff changeset
  3033
            ^ col menuForRow:row inApplication:(self application)
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3034
        ]
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3035
    ].
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3036
    ^ nil
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3037
!
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3038
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3039
keyPress:aKey x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3040
    "a key was pressed - handle page-keys here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3041
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3042
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3043
                          #BeginOfText #EndOfText #ScrollUp #ScrollDown
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3044
                          #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)>
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3045
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3046
    |maxColNr firstSelRowNr selRowNr selColNr
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3047
     key column isTab listSize hasSelectables rawKey|
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3048
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3049
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3050
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3051
    (listSize := list size) == 0 ifTrue:[
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3052
        ^ super keyPress:aKey x:x y:y
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3053
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3054
    aKey isCharacter ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3055
        ^ self characterPress:aKey x:x y:y
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3056
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3057
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3058
    (aKey == #SelectAll) ifTrue:[
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3059
        multipleSelectOk ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3060
            self selectAllRows.
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3061
        ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3062
        ^ self
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3063
    ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3064
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3065
    aKey == #PreviousPage ifTrue:[^ self pageUp].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3066
    aKey == #NextPage     ifTrue:[^ self pageDown].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3067
    aKey == #HalfPageUp   ifTrue:[^ self halfPageUp].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3068
    aKey == #HalfPageDown ifTrue:[^ self halfPageDown].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3069
    aKey == #BeginOfText  ifTrue:[^ self scrollToTop].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3070
    aKey == #EndOfText    ifTrue:[^ self scrollToBottom].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3071
    aKey == #ScrollUp     ifTrue:[^ self scrollUp].
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3072
    aKey == #ScrollDown   ifTrue:[^ self scrollDown].
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3073
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3074
    aKey == #Return ifTrue:[
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3075
        editView notNil ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3076
            (self selectedRowIndex size == 1
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3077
            and:[self selectedRowIndex first == listSize]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3078
                self selectRowIndex:nil.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3079
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3080
                self cursorKey:#CursorDown rawKey:#CursorDown.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3081
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3082
            ^ self
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3083
        ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3084
        self numberOfSelections == 1 ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3085
            self doubleClicked
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3086
        ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3087
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3088
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3089
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3090
    hasSelectables := self hasSelectables.
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3091
5873
c8cf9d94aed1 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5809
diff changeset
  3092
    rawKey := (WindowGroup lastEvent) rawKey.
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3093
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3094
    (aKey == #CursorUp
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3095
    or:[aKey == #CursorDown
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3096
    or:[rawKey == #Home
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3097
    or:[rawKey == #End]]])
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3098
    ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3099
        self cursorKey:aKey rawKey:rawKey.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3100
        ^ self
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3101
    ].
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3102
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3103
    hasSelectables ifFalse:[
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3104
        ^ super keyPress:aKey x:x y:y
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3105
    ].
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3106
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3107
    "/ CURSOR LEFT/RIGHT or TABING
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3108
    (aKey == #CursorLeft or:[aKey == #CursorRight]) ifTrue:[
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3109
        isTab := false.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3110
        key   := aKey.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3111
    ] ifFalse:[
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3112
        tabIntern ifFalse:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3113
            ^ super keyPress:aKey x:x y:y
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3114
        ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3115
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3116
        (aKey includesString:'Tab') ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3117
            key := (aKey = #BackTab or:[self sensor shiftDown or:[aKey includesString:'Left']])
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
  3118
                        ifTrue:[#CursorLeft]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
  3119
                        ifFalse:[#CursorRight]
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3120
        ] ifFalse:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3121
            (aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3122
                ^ super keyPress:aKey x:x y:y
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3123
            ].
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3124
            key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3125
        ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3126
        isTab := true.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3127
    ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3128
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3129
    maxColNr := self numberOfColumns.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3130
    selColNr := self selectedColIndex.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3131
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3132
    firstSelRowNr := self firstIndexSelected.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3133
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3134
    key == #CursorLeft ifTrue:[
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3135
        selRowNr := firstSelRowNr.
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3136
        selRowNr == 0 ifTrue:[selRowNr := listSize].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3137
        selColNr == 0 ifTrue:[selColNr := maxColNr + 1].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3138
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3139
        [true] whileTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3140
            (selColNr := selColNr - 1) == 0 ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3141
                [   selRowNr := selRowNr - 1.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3142
                    selRowNr == 0 ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3143
                        isTab ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3144
                            tabAtStartAction notNil ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3145
                                tabAtStartAction value
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3146
                            ] ifFalse:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3147
                                self deselect.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3148
                                self windowGroup focusPreviousFrom:self
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3149
                            ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3150
                        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3151
                        ^ self
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3152
                    ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3153
                    (self isRowSelectable:selRowNr)
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3154
                ] whileFalse.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3155
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3156
                selColNr := maxColNr
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3157
            ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3158
            column := self columnDescriptorAt:selColNr.
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3159
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3160
            (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3161
                ^ self selectColIndex:selColNr rowIndex:selRowNr.
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3162
            ]
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3163
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3164
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3165
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3166
    selRowNr := firstSelRowNr.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3167
    selRowNr == 0 ifTrue:[selRowNr := 1].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3168
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3169
    [true] whileTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3170
        (selColNr := selColNr + 1) > maxColNr ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3171
            [   selRowNr := selRowNr + 1.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3172
                selRowNr > listSize ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3173
                    isTab ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3174
                        tabAtEndAction notNil ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3175
                            tabAtEndAction value
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3176
                        ] ifFalse:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3177
                            self deselect.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3178
                            self windowGroup focusNextFrom:self
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3179
                        ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3180
                    ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3181
                    ^ self
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3182
                ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3183
                (self isRowSelectable:selRowNr)
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3184
            ] whileFalse.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3185
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3186
            selColNr := 1
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3187
        ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3188
        column := self columnDescriptorAt:selColNr.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3189
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3190
        (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3191
            ^ self selectColIndex:selColNr rowIndex:selRowNr
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3192
        ]
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3193
    ].
5873
c8cf9d94aed1 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5809
diff changeset
  3194
c8cf9d94aed1 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5809
diff changeset
  3195
    "Modified: / 09-08-2018 / 09:27:46 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3196
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3197
5670
9aea34629aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5666
diff changeset
  3198
keyboardZoom:largerBoolean
5279
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3199
    "CTRL+/- zoom action"
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3200
5670
9aea34629aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5666
diff changeset
  3201
    self fontLargerOrSmaller:largerBoolean
5279
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3202
!
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3203
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3204
mouseWheelZoom:amount
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3205
    "CTRL-wheel action"
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3206
    |oldSize newSize font|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3207
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3208
    font := gc font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3209
    font sizeUnit == #px ifTrue:[ ^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3210
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3211
    oldSize := font size.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3212
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3213
    amount > 0 ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3214
        oldSize < 5 ifTrue:[ ^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3215
        newSize := oldSize - 1.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3216
    ] ifFalse:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3217
        oldSize > 99 ifTrue:[^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3218
        newSize := oldSize + 1.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3219
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3220
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3221
    self font:(font asSize:newSize).
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3222
!
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3223
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3224
originChanged:delta
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3225
    "this one is sent, after the origin of my contents has changed -
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3226
     tell dependents (i.e. scrollers) about this"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3227
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3228
    super originChanged:delta.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3229
    self updateEditViewOrigin.
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3230
!
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3231
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3232
sizeChanged:how
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3233
    "size changed - move origin up if possible
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3234
     change the layout of the labelView dependent on my layout"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3235
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3236
    |selectionWasVisible lastExtent|
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3237
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3238
    lastExtent := previousExtent notNil ifTrue:[previousExtent] ifFalse:[self extent].
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3239
    selectionWasVisible := self isSelectionVisibleIn:lastExtent.
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3240
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3241
    previousExtent := self extent.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3242
    super sizeChanged:how.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3243
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3244
    previousExtent := self extent.
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3245
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3246
    "/ no - must compute even if not visible.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3247
    "/ (could be invisible in a notebook ...)
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3248
    realized ifTrue:[                   "used to be: shown"
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3249
"/        labelView isVisible ifTrue:[
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3250
"/            lyt := labelView layout.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3251
"/            lyt  leftOffset:(layout leftOffset).
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3252
"/            lyt rightOffset:(layout rightOffset).
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3253
"/            labelView layout:lyt.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3254
"/        ].
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3255
        previousExtent x ~= lastExtent x ifTrue: [
4123
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3256
            self fitColumns.
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3257
        ].
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3258
        selectionWasVisible ifTrue:[
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3259
            self makeSelectionVisible.
4020
3bf856409692 changed: #sizeChanged:
ca
parents: 3994
diff changeset
  3260
        ].
3bf856409692 changed: #sizeChanged:
ca
parents: 3994
diff changeset
  3261
        self updateEditViewOrigin.
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3262
    ].
4059
b8d390e67d16 changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
  3263
4123
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3264
    "Modified: / 04-05-2012 / 14:34:24 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3265
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3266
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3267
!DSVColumnView methodsFor:'focus handling'!
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3268
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3269
canTab
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3270
    super canTab ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3271
        ^ editView isNil
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3272
    ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3273
    ^ false
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3274
!
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3275
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3276
showFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3277
    self invalidateSelection.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3278
    super showFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3279
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3280
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3281
showNoFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3282
    self invalidateSelection.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3283
    super showNoFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3284
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3285
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3286
wantsFocusWithPointerEnter
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3287
    "views which like to take the keyboard focus
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3288
     when the pointer enters can do so by redefining this
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3289
     to return true"
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3290
3924
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3291
    editView notNil ifTrue:[^ false].
2237
1da5501b1248 bug fix in focus handling
ca
parents: 2226
diff changeset
  3292
2958
99f7bfe9e9a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2956
diff changeset
  3293
    (UserPreferences current focusFollowsMouse ~~ false
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3294
    and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true)
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3295
    ]) ifTrue:[
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3296
        list size > 0 ifTrue:[
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3297
            ^ true
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3298
        ]
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3299
    ].
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3300
    ^ false
3924
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3301
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3302
    "Modified: / 08-08-2010 / 14:41:00 / cg"
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3303
! !
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3304
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3305
!DSVColumnView methodsFor:'gc operations'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3306
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3307
imageOnMyDevice:anImage
4606
1cc343187f71 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4589
diff changeset
  3308
    "associate image to device and returns the new image."
1cc343187f71 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4589
diff changeset
  3309
1cc343187f71 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4589
diff changeset
  3310
    anImage isNil ifTrue:[^ nil].
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  3311
    ^ anImage onDevice:device.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3312
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3313
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3314
registerImage:anImage key:aKey
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3315
    "any row can register an image with a unique identifier a key symbol"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3316
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3317
    |img|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3318
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3319
    (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3320
        ^ img
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3321
    ].
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3322
    img := self imageOnMyDevice:anImage.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  3323
    registererImages at:aKey put:img.
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  3324
    ^ img
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3325
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3326
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3327
registeredImageAt:aKey
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3328
    "any row can register an image with a unique identifier"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3329
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3330
    ^ registererImages at:aKey ifAbsent:nil
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3331
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3332
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3333
releaseAllRegisteredImages
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3334
    "release all registered images"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3335
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3336
    registererImages := IdentityDictionary new.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3337
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3338
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3339
!DSVColumnView methodsFor:'help'!
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3340
5680
48cf8714352b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5670
diff changeset
  3341
helpTextAt:aPoint
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3342
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)."
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3343
3248
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3344
    |rowNr colNr col|
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3345
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3346
    columnDescriptors isEmpty ifTrue:[^ nil].
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3347
3248
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3348
    rowNr := self yVisibleToRowNr:aPoint y.
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3349
    rowNr isNil ifTrue:[^ nil ].
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3350
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3351
    colNr := self xVisibleToColNr:aPoint x.
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3352
    colNr notNil ifTrue:[
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3353
        col := columnDescriptors at:colNr.
3458
5f9a85c6279a Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents: 3449
diff changeset
  3354
        ^ col activeHelpTextForRow:rowNr.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3355
    ].
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3356
    ^ nil
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3357
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3358
    "Created: / 26-03-2007 / 14:42:54 / cg"
3248
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3359
    "Modified: / 16-10-2007 / 17:52:24 / cg"
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3360
! !
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3361
2500
1477b0a5a918 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3362
!DSVColumnView methodsFor:'initialization & release'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3363
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3364
create
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3365
    |graphicsDevice|
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3366
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3367
    super create.
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  3368
    graphicsDevice := device.
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3369
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3370
    fgColor     := fgColor     onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3371
    bgColor     := bgColor     onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3372
    selectionForegroundColor := selectionForegroundColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3373
    selectionBackgroundColor := selectionBackgroundColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3374
    selectionFrameColor notNil ifTrue:[selectionFrameColor := selectionFrameColor onDevice:graphicsDevice].
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3375
    selectionForegroundColorNoFocus := selectionForegroundColorNoFocus onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3376
    selectionBackgroundColorNoFocus := selectionBackgroundColorNoFocus onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3377
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3378
    buttonShadowColor := buttonShadowColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3379
    buttonLightColor  := buttonLightColor onDevice:graphicsDevice.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3380
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3381
    buttonHalfShadowColor notNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3382
        buttonHalfShadowColor := buttonHalfShadowColor onDevice:graphicsDevice
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3383
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3384
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3385
    buttonHalfLightColor notNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3386
        buttonHalfLightColor := buttonHalfLightColor onDevice:graphicsDevice
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3387
    ].
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3388
    rowSelectorForm         := self imageOnMyDevice:rowSelectorForm.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3389
    checkToggleActiveImage  := self imageOnMyDevice:checkToggleActiveImage.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3390
    checkTogglePassiveImage := self imageOnMyDevice:checkTogglePassiveImage.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3391
    checkToggleForm         := self imageOnMyDevice:checkToggleForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3392
    radioButtonActiveImage  := self imageOnMyDevice:radioButtonActiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3393
    radioButtonPassiveImage := self imageOnMyDevice:radioButtonPassiveImage.
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3394
    comboButtonForm         := self imageOnMyDevice:comboButtonForm.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3395
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3396
    "Modified: / 20-01-2011 / 08:43:51 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3397
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3398
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3399
initStyle
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3400
    "setup colors, etc."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3401
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3402
    |button widget|
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3403
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3404
    super initStyle.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3405
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3406
    DefaultForegroundColor isNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3407
        self class updateStyleCache
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3408
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3409
    fgColor     := DefaultForegroundColor.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3410
    bgColor     := DefaultBackgroundColor.
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
  3411
    labelFgColor := DefaultLabelForegroundColor.
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
  3412
    labelBgColor := DefaultLabelBackgroundColor.
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  3413
    selectionForegroundColor := DefaultHilightForegroundColor.
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  3414
    selectionBackgroundColor := DefaultHilightBackgroundColor.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3415
    selectionFrameColor      := DefaultHilightFrameColor.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3416
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3417
    shadowColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3418
        shadowColor := Color grayPercent:40.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3419
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3420
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3421
    lightColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3422
        lightColor := Color grayPercent:75
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3423
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3424
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3425
    buttonLightColor    := ButtonLightColor  ? lightColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3426
    buttonShadowColor   := ButtonShadowColor ? shadowColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3427
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3428
    (ButtonEdgeStyle == #soft) ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3429
        buttonHalfShadowColor := ButtonHalfShadowColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3430
        buttonHalfLightColor  := ButtonHalfLightColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3431
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3432
        buttonHalfShadowColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3433
            buttonHalfShadowColor := buttonShadowColor lightened
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3434
        ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3435
    ].
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3436
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3437
    buttonHalfShadowColor isNil ifTrue:[
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3438
        buttonHalfShadowColor := Color gray
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3439
    ].
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3440
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3441
    selectionForegroundColorNoFocus isNil ifTrue:[
4653
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3442
        selectionForegroundColorNoFocus := DefaultHilightForegroundColorNoFocus.
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3443
        selectionForegroundColorNoFocus isNil ifTrue:[
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3444
            selectionForegroundColorNoFocus := selectionForegroundColor slightlyLightened.
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3445
        ]
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3446
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3447
    selectionBackgroundColorNoFocus isNil ifTrue:[
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3448
        selectionBackgroundColorNoFocus := DefaultHilightBackgroundColorNoFocus.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3449
        selectionBackgroundColorNoFocus isNil ifTrue:[
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3450
            selectionBackgroundColor notNil ifTrue:[
4653
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3451
                selectionBackgroundColorNoFocus := selectionBackgroundColor slightlyLightened.
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3452
                "/ selectionBackgroundColorNoFocus := Color brightness:(selectionBackgroundColor "lightened" brightness).   "/ asGray.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3453
            ].
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3454
        ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3455
    ].
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3456
    selectionFrameColorNoFocus isNil ifTrue:[
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3457
        selectionFrameColor notNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3458
            selectionFrameColorNoFocus := selectionFrameColor lightened.
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3459
            "/ selectionFrameColorNoFocus := Color brightness:(selectionFrameColor "lightened" brightness).   "/ asGray
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3460
        ]
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3461
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3462
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  3463
    rowSelectorForm         := self class rowSelectorImage.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3464
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3465
    checkToggleActiveImage  := CheckToggleActiveImage.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3466
    checkTogglePassiveImage := CheckTogglePassiveImage.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3467
    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3468
    CheckToggleDisabledActiveImage isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3469
        CheckToggleDisabledActiveImage := CheckToggle disabledActiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3470
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3471
    CheckToggleDisabledPassiveImage isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3472
        CheckToggleDisabledPassiveImage := CheckToggle disabledPassiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3473
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3474
    checkToggleDisabledActiveImage  := CheckToggleDisabledActiveImage.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3475
    checkToggleDisabledPassiveImage := CheckToggleDisabledPassiveImage.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3476
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3477
    CheckToggleForm isNil ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3478
        widget            := CheckToggle new.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3479
        CheckToggleForm   := widget label.
6236
ddfc83270532 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6220
diff changeset
  3480
        CheckToggleLevel  := widget passiveLevel.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3481
        CheckToggleExtent := widget preferredExtent.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3482
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3483
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3484
    checkToggleForm   := CheckToggleForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3485
    checkToggleLevel  := CheckToggleLevel.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3486
    checkToggleExtent := CheckToggleExtent.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3487
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3488
    radioButtonActiveImage  := RadioButtonActiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3489
    radioButtonPassiveImage := RadioButtonPassiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3490
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3491
    RadioButtonDisabledActiveImage isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3492
        RadioButtonDisabledActiveImage := RadioButton disabledActiveForm.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3493
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3494
    RadioButtonDisabledPassiveImage isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3495
        RadioButtonDisabledPassiveImage := RadioButton disabledPassiveForm.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3496
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3497
    radioButtonDisabledActiveImage  := RadioButtonDisabledActiveImage.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3498
    radioButtonDisabledPassiveImage := RadioButtonDisabledPassiveImage.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3499
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3500
    ComboButtonForm isNil ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3501
        widget            := ComboListView new.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3502
        button            := widget menuButton.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3503
        ComboButtonForm   := button label.
6236
ddfc83270532 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6220
diff changeset
  3504
        ComboButtonLevel  := button passiveLevel.
3428
436f115aefe8 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  3505
        ComboButtonExtent := (button preferredWidth) @ (widget preferredHeight).
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3506
    ].
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3507
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3508
    comboButtonForm   := ComboButtonForm.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3509
    ComboButtonDisabledForm isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3510
        ComboButtonDisabledForm := ComboView disabledForm
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3511
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3512
    comboButtonDisabledForm   := ComboButtonDisabledForm.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3513
    comboButtonLevel  := ComboButtonLevel.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3514
    comboButtonExtent := ComboButtonExtent.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3515
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3516
    "Modified: / 20-01-2012 / 15:48:13 / cg"
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3517
    "Modified: / 17-08-2018 / 17:33:56 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3518
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3519
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3520
initialize
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3521
    "set default attributes"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3522
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3523
    |fontOnDevice|
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3524
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3525
    verticalSpacing    := verticalSpacing ? self class verticalSpacing.
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3526
    horizontalSpacing  := horizontalSpacing ? self class horizontalSpacing.
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3527
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3528
    super initialize.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3529
    self lineWidth:0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3530
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3531
    separatorSize      := 1.                            "/ separators mode 2D
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3532
    verticalSpacing    := self class verticalSpacing.
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3533
    horizontalSpacing  := self class horizontalSpacing.
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3534
    tabIntern          := true.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3535
    useIndex           := true.
5664
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  3536
    ignoreReselect     := true.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3537
    viewOrigin         := 0@0.
5204
fccb63f32188 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5195
diff changeset
  3538
    fontOnDevice       := gc deviceFont.
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3539
    rowFontAscent      := fontOnDevice ascent.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3540
    rowHeight          := verticalSpacing + (fontOnDevice height) + verticalSpacing + separatorSize.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  3541
    minRowHeight       := rowHeight.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3542
    multipleSelectOk   := false.                        "/ multiselect disabled
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3543
    selectedRowIndex   := 0.                            "/ no selection
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3544
    self selectedColIndex:0.
1778
51bbd960baf9 change registeredIcons from IdentityDictionary to Dictionary
ca
parents: 1776
diff changeset
  3545
    registererImages   := Dictionary new.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3546
    columnDescriptors  := #().
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3547
    beDependentOfRows  := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3548
    colorMap           := Dictionary new.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3549
    catchChangeEvents  := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3550
    selectRowOnDefault := true.
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3551
    autoScroll         := true.
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  3552
    autoScrollToColumn := true.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3553
    scrollRowWise      := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3554
    sortListInPlace    := false.    "/ when false (default for backward compatibility):
4613
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3555
                                    "/ if sorting, create a copy
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3556
                                    "/ of the list, which is wrong when useIndex is on,
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3557
                                    "/ as the application will get the index in the sorted
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3558
                                    "/ list, which is probably different from tha apps list mode.
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3559
                                    "/ When true (should be default, but that might break many
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3560
                                    "/ users), the passed in list is sorted in place (i.e. possibly
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3561
                                    "/ sorting the application's list).
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3562
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3563
    updateListHolderWhenSorting := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3564
                                    "/ when false (default for backward compatibility):
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3565
                                    "/ if sorting, do not write back the sorted list into the listHolder
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3566
                                    "/ When true (should be default, but that might break many
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3567
                                    "/ users), the sorted list is written back into the listHolder,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3568
                                    "/ but only if sortListInPlace is false.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3569
3223
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3570
    "/ need for active help
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3571
    self enableMotionEvents.
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3572
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3573
    "Modified: / 13-09-2017 / 16:08:34 / cg"
705
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  3574
!
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  3575
2807
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3576
mapped
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3577
    "set selection (if any) after mapping"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3578
2807
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3579
    |idx|
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3580
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3581
    super mapped.
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3582
    needFitColumns == true ifTrue:[
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3583
        self fitColumns
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3584
    ].
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3585
    (idx := self firstIndexSelected) ~~ 0 ifTrue:[
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3586
        self scrollToRowAt:idx colAt:0.
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3587
    ].
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3588
!
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3589
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3590
realize
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3591
    "recompute contents and fit columns to view"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3592
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3593
    |selection|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3594
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3595
    self bitGravity:#NorthWest.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3596
    self recomputeHeightOfContents.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3597
    selection := 0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3598
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3599
        (model respondsTo:#selectionIndex) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3600
            selection := model selectionIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3601
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3602
            model == listHolder ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3603
                selection := model value
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3604
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3605
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3606
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3607
    self selectRowIndex:selection.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3608
    super realize.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3609
    self fitColumns.
2011
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  3610
!
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  3611
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3612
release
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3613
    "remove dependencies"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3614
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3615
    self columnHolder:nil.
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3616
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3617
    beDependentOfRows ifTrue:[self makeIndependentOfRows].
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3618
    listHolder notNil ifTrue:[
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3619
        listHolder removeDependent:self.
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3620
    ].
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3621
    columnAdaptor isValueModel ifTrue:[
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3622
        columnAdaptor removeDependent:self
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3623
    ].
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3624
    super release
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3625
! !
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3626
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3627
!DSVColumnView methodsFor:'obsolete'!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3628
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3629
has3Dsepartors
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3630
    <resource: #obsolete>
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3631
    "shouldn't be used any more"
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3632
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3633
    self obsoleteMethodWarning.
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3634
    ^ self has3Dseparators
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3635
!
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3636
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3637
has3Dsepartors:aBool
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3638
    <resource: #obsolete>
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3639
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3640
    "shouldn't be used any more"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3641
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3642
    self obsoleteMethodWarning.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3643
    self has3Dseparators:aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3644
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3645
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3646
!DSVColumnView methodsFor:'private'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3647
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3648
anyColumnHasBackground
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3649
    columnDescriptors isNil ifTrue:[^ false].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3650
    columnDescriptors do:[:eachCol |
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3651
        |bg|
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3652
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3653
        bg := eachCol backgroundColor.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3654
        (bg notNil and:[bg isImageOrForm]) ifTrue:[^ true].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3655
        eachCol bgSelector notNil ifTrue:[^ true].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3656
    ].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3657
    ^ false.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3658
!
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3659
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3660
anyColumnHasPotentialNonConstantBackground
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3661
    columnDescriptors isNil ifTrue:[^ false].
2933
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3662
    ^ columnDescriptors contains:[:someCol | someCol hasPotentialNonConstantBackground].
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3663
"/    columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]].
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3664
"/    ^ false.
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3665
!
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3666
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3667
destroyEditView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3668
    "destroy the edit view; release KeyboardForwarder"
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3669
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3670
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3671
        editValue removeDependent:self.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3672
        editValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3673
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3674
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3675
    editView notNil ifTrue:[ |winGroup focusView|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3676
        self hasFocus ifTrue:[focusView := self].
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3677
        editView isDialogBox ifTrue:[
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3678
            focusView := self
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3679
        ] ifFalse:[    
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3680
            editView withAllSubViewsDo:[:aView |
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3681
                aView hasFocus ifTrue:[focusView := self].
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3682
                aView delegate:nil
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3683
            ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3684
        ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3685
        editView destroy.
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3686
        editView := nil.
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3687
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3688
        winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3689
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3690
        winGroup notNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3691
            winGroup focusView:focusView.
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3692
        ]
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3693
    ].
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3694
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  3695
    "Modified: / 23-04-2019 / 19:13:41 / Claus Gittinger"
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3696
!
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3697
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3698
detectViewAt:aPoint in:aView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3699
    "returns the view at a point"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3700
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3701
    aView isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3702
        ^ nil
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3703
    ].
2019
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  3704
    ^ aView detectViewAt:aPoint.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3705
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3706
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3707
fitColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3708
    "fit columns to view; "
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3709
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3710
    |selectedColumn columnsWithRelativeWidth
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3711
     overallMinWidth restWidth anyChange oldOrgX newOrgX oldWidth|
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3712
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3713
    realized ifFalse:[
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3714
        needFitColumns := true.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3715
        ^ self
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3716
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3717
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3718
    cachedPreferredExtent isNil ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3719
        self preferredExtent.
2956
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3720
    ] ifFalse:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3721
        oldWidth := cachedPreferredExtent x.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3722
    ].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3723
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3724
    columnDescriptors isEmpty ifTrue:[
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3725
        ^ self
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3726
    ].
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3727
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3728
    overallMinWidth := 0.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3729
    anyChange := false.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3730
    columnsWithRelativeWidth := OrderedCollection new.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3731
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3732
    columnDescriptors do:[:aCol|
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3733
        aCol canResize ifTrue:[
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3734
            anyChange := true.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3735
            aCol invalidate.
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3736
        ].
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3737
        aCol hasRelativeWidth ifTrue:[columnsWithRelativeWidth add:aCol].
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3738
        overallMinWidth := overallMinWidth + aCol minWidth.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3739
    ].
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3740
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3741
    cachedPreferredExtent := width @(self preferredHeight).
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3742
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3743
    columnsWithRelativeWidth notEmpty ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3744
        restWidth := self innerWidth - overallMinWidth.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3745
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3746
        restWidth > 0 ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3747
            |sumOfAnnouncedRelativeWidths sumWeach|
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3748
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3749
            "/ distribute restwidth among remaining columns according to
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3750
            "/ their announced relative width's
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3751
            sumOfAnnouncedRelativeWidths := columnsWithRelativeWidth sum:[:each | each description width].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3752
            sumWeach := 0.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3753
            columnsWithRelativeWidth do:[:each |
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3754
                |eachRel wEach|
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3755
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3756
                eachRel := each description width / sumOfAnnouncedRelativeWidths.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3757
                each == columnsWithRelativeWidth last ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3758
                    wEach := restWidth - sumWeach.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3759
                ] ifFalse:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3760
                    wEach := (eachRel * restWidth) truncated.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3761
                    sumWeach := sumWeach + wEach.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3762
                ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3763
                each setWidth:wEach.
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3764
            ].
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3765
        ]
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3766
    ] ifFalse:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3767
        anyChange ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3768
            | resizableColumns numberOfResizable additionalOffsetX |
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3769
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3770
            overallMinWidth  := 0.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3771
            resizableColumns := OrderedCollection new.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3772
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3773
            columnDescriptors do:[: eachColumn |
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3774
                eachColumn canResize ifTrue:[ resizableColumns add: eachColumn ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3775
                eachColumn width: nil. "force a recomputation of width"
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3776
                overallMinWidth := overallMinWidth + eachColumn width.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3777
            ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3778
            numberOfResizable := resizableColumns size.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3779
            numberOfResizable > 0 ifTrue:[
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3780
                restWidth := self innerWidth - overallMinWidth.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3781
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3782
                restWidth > numberOfResizable ifTrue:[
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3783
                    additionalOffsetX := restWidth // numberOfResizable.
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3784
                    resizableColumns do:[:aCol| aCol growWidth:additionalOffsetX ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3785
                    restWidth := restWidth - (additionalOffsetX * numberOfResizable).
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3786
                ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3787
                restWidth > 0 ifTrue:[ resizableColumns last growWidth:restWidth ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3788
            ].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3789
        ].
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3790
    ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  3791
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3792
    shown ifTrue:[
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3793
        "have to invalidate unconditionally even if nothing has been changed here:
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3794
         #fitColumns is called from #changeWidthOfColumn:deltaX:
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3795
         after a manual resize"
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3796
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3797
        self      invalidate.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3798
        labelView invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3799
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3800
        (oldOrgX := viewOrigin x) ~~ 0 ifTrue:[
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3801
            |prefWidth|
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3802
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3803
            "/ UPDATE VIEW-ORIGIN X
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3804
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3805
            prefWidth   := self preferredWidth.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3806
            newOrgX := (prefWidth - self innerWidth) max:0.
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3807
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3808
            newOrgX < oldOrgX ifTrue:[
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3809
                self originWillChange.
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3810
                viewOrigin := newOrgX @ (viewOrigin y).
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3811
                self originChanged:((newOrgX - oldOrgX) @ 0).
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3812
            ]
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3813
        ].
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3814
1930
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3815
        "/ cg: do not scroll to selection when a column-size is changed
2319
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3816
1930
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3817
"/        self hasSelection ifTrue:[
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3818
"/            editView notNil ifTrue:[
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3819
"/                editView width:(self selectedColumn width - (2 * separatorSize)).
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3820
"/            ].
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3821
"/            self scrollToSelection.
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3822
"/        ].
2319
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3823
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3824
        "/ ca: but resize the editView (if there is any currently visible)
2319
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3825
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3826
        editView notNil ifTrue:[
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3827
            selectedColumn := self selectedColumn.
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3828
            selectedColumn notNil ifTrue:[
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3829
                editView width:(selectedColumn width - (2 * separatorSize)).
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3830
            ]
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3831
        ].
3428
436f115aefe8 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  3832
        oldWidth ~= self preferredWidth ifTrue:[
2956
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3833
            self contentsChanged.
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3834
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3835
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3836
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3837
    "Modified (format): / 15-03-2018 / 11:40:25 / mawalch"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3838
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3839
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3840
hasSelectables
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3841
    columnDescriptors do:[:aCol|
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3842
        (aCol rendererType == #rowSelector) ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3843
            (aCol description canSelect) ifTrue:[^ true].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3844
        ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3845
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3846
    ^ false.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3847
!
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3848
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3849
maxViewOriginY
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3850
    "returns the maximum possible y of the view origin"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3851
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3852
    |y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3853
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3854
    y := self heightOfContents - self innerHeight.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3855
    ^ y max:0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3856
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3857
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3858
updateEditViewOrigin
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3859
    "update origin of the editView"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3860
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3861
    |x y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3862
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3863
    editView notNil ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3864
        y := self yVisibleOfRowNr:(self firstIndexSelected).
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3865
        x := self xVisibleOfColNr:self selectedColIndex.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3866
        editView origin:(x @ y + separatorSize).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3867
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3868
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3869
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3870
xVisibleOfColNr:aColNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3871
    "returns visible x assigned to a column number"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3872
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3873
    |x
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3874
     end "{ Class:SmallInteger }"|
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3875
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3876
    x := margin - viewOrigin x.
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3877
    aColNr > 1 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3878
        end := aColNr - 1.
6103
546b95ce8e53 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 6094
diff changeset
  3879
        columnDescriptors from:1 to:end do:[:aCol | x := x + aCol width ]
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3880
    ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3881
    ^ x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3882
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3883
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3884
xVisibleToColNr:x
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3885
    "returns the column number for a physical x position.
5079
1ef6c9d3cdf3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  3886
     Returns nil if x is beyond the last column."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3887
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3888
    |x0|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3889
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3890
    x0 := x + viewOrigin x - margin.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3891
    columnDescriptors keysAndValuesDo:[:index :aCol |
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3892
        x0 := x0 - aCol width.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3893
        x0 <= 0 ifTrue:[ ^ index ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3894
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3895
    ^ nil.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3896
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3897
    "Modified: / 26-03-2007 / 15:22:01 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3898
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3899
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3900
yVisibleOfRowNr:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3901
    "returns visible y assigned to the row number"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3902
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3903
    ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3904
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3905
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3906
yVisibleToRowNr:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3907
    "returns the row number assigned to a physical y or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3908
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3909
    |rowNr|
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3910
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3911
    rowNr := (y + viewOrigin y - margin) // rowHeight + 1.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3912
    (rowNr between:1 and:(list size)) ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3913
        ^ rowNr
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3914
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3915
    ^ nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3916
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3917
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3918
!DSVColumnView methodsFor:'queries'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3919
2728
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3920
firstLineShown
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3921
    "for protocol-compat. with listviews"
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3922
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3923
    ^ self indexOfFirstRowShown
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3924
!
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3925
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3926
hasOpenEditor
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3927
    ^ editView notNil
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3928
!
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3929
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3930
indexOfFirstRowShown
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3931
    "returns the index of the first shown row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3932
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3933
    |idx|
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3934
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3935
    idx := (viewOrigin y // rowHeight) + 1.
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3936
    ^ (idx max:1)
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3937
!
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3938
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3939
indexOfLastRowShown
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3940
    "returns the index of the last shown row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3941
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3942
    |idx|
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3943
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3944
    idx := (viewOrigin y + height - 1 // rowHeight) + 1.
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3945
    ^ (idx min:list size)
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3946
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3947
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3948
isEnabled
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3949
    ^ enableChannel value ~~ false
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3950
!
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3951
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3952
isRowSelectable:aRowNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3953
    "returne true if a row number is selectable"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3954
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3955
    (aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3956
        selectConditionBlock isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3957
            ^ true
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3958
        ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3959
        ^ (selectConditionBlock value:aRowNumber)
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3960
    ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3961
    ^ false
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3962
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3963
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3964
numberOfColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3965
    "returns number of columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3966
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3967
    ^ columnDescriptors size
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3968
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3969
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3970
numberOfRows
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3971
    "returns number of rows"
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3972
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3973
    ^ list size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3974
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3975
    "Modified (comment): / 15-03-2018 / 12:23:01 / mawalch"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3976
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3977
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3978
rowHeight
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3979
    "get the height of the highest row in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3980
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3981
    ^ rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3982
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3983
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3984
separatorSize
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3985
    "returns vertical/horizontal size of a separator dependent on the
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3986
     3D effect."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3987
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3988
    ^ separatorSize
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3989
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3990
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3991
size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3992
    "returns number of rows"
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3993
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3994
    ^ list size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3995
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3996
    "Modified (comment): / 15-03-2018 / 12:24:18 / mawalch"
4486
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3997
!
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3998
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3999
yVisibleToLineNr:yVisible
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  4000
    ^ self yVisibleToRowNr:yVisible.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4001
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4002
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4003
!DSVColumnView methodsFor:'recomputation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4004
5952
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4005
computePreferredExtent
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4006
    "return my preferred extent"
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4007
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4008
    |numRows prefWidth prefHeight|
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4009
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4010
    cachedPreferredExtent notNil ifTrue:[
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4011
        ^ cachedPreferredExtent
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4012
    ].
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4013
    self computeRowHeight.
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4014
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4015
    prefWidth := (columnDescriptors size - 1) max:0.  "/ for the separators
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4016
    columnDescriptors do:[:aCol |
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4017
        prefWidth := prefWidth + (aCol minWidth max:5).
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4018
    ].
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4019
    numRows := list size.
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4020
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4021
    "/ no need for a separator after the last row.
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4022
    prefHeight := separatorSize + ((numRows * rowHeight) "- separatorSize") "+ separatorSize".
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4023
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4024
    cachedPreferredExtent := prefWidth @ prefHeight.
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4025
    ^ cachedPreferredExtent
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4026
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4027
    "Created: / 09-11-2018 / 19:50:03 / Claus Gittinger"
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4028
!
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4029
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4030
computeRowHeight
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4031
    |minHeight|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4032
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  4033
    minHeight := self font height.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4034
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4035
    columnDescriptors do:[:aCol |
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4036
        minHeight := (aCol heightOfHighestRow) max:minHeight.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4037
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4038
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  4039
    "/ to fix a double bug which compensated for not computing things correctly
5730
dcaa2eb5a14b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5723
diff changeset
  4040
    "/ (verticalSpacing was always computed as 2 into the height, even if changed later,
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  4041
    "/  it was stil in the max-of-col-heights, because minHeight was never reset, but always
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  4042
    "/  carried on in the minRowHeight)
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  4043
    minHeight := 2 + minHeight + 2.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4044
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4045
    rowHeight := (verticalSpacing + minHeight + verticalSpacing + separatorSize).
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4046
    minRowHeight := rowHeight.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4047
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4048
    "Created: / 13-09-2017 / 15:32:28 / cg"
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4049
!
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4050
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4051
hasPreferredExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4052
    "returns true if preferred extent is accumulated"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4053
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4054
    ^ cachedPreferredExtent notNil
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4055
!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4056
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4057
preferredExtentChanged
3519
9102be1f145c fix typo in comment
Stefan Vogel <sv@exept.de>
parents: 3518
diff changeset
  4058
    "called if the preferred extent changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4059
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4060
    |x "{ Class:SmallInteger }"
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4061
     y "{ Class:SmallInteger }"|
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4062
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4063
    y := viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4064
    x := viewOrigin x.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4065
    (y ~~ 0 or:[ x ~~ 0 ]) ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4066
        self originWillChange.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4067
        viewOrigin := 0 @ 0.
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4068
        cachedPreferredExtent := nil.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4069
        self originChanged:(x negated @ y negated).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4070
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4071
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4072
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4073
recomputeHeightOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4074
    "recompute height of contents( scrolling )"
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4075
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4076
    cachedPreferredExtent := nil.
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4077
"/    cachedPreferredExtent notNil ifTrue:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4078
"/        cachedPreferredExtent y:(rowHeight * list size)
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4079
"/    ] ifFalse:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4080
"/        self preferredExtent
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4081
"/    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4082
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4083
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4084
!DSVColumnView methodsFor:'scroller interface'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4085
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4086
innerHeight
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4087
    "returns the inner height of the contents shown"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4088
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4089
    ^ height - margin - margin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4090
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4091
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4092
verticalScrollStep
3500
d2adfa92fa6d comment
Claus Gittinger <cg@exept.de>
parents: 3494
diff changeset
  4093
    "return the amount to scroll when stepping up/down (also used for mouseWheel)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4094
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4095
    ^ rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4096
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4097
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4098
viewOrigin
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4099
    "return the viewOrigin;
5252
06aa7602b274 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5214
diff changeset
  4100
     that's the coordinate of the contents which is shown topLeft in the view."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4101
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4102
    ^ viewOrigin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4103
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4104
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4105
widthOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4106
    "return the width of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4107
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4108
    cachedPreferredExtent isNil ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4109
        self preferredExtent
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4110
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4111
    ^ cachedPreferredExtent x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4112
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4113
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4114
xOriginOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4115
    "return the horizontal origin of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4116
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4117
    ^ viewOrigin x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4118
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4119
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4120
yOriginOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4121
    "return the vertical origin of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4122
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4123
    ^ viewOrigin y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4124
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4125
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4126
!DSVColumnView methodsFor:'scrolling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4127
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4128
scrollTo:anOrigin redraw:doRedraw
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4129
    "change origin to have newOrigin be visible at the top-left."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4130
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4131
    |newOrg dltOrg wg
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4132
     h       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4133
     w       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4134
     x       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4135
     x0      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4136
     x1      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4137
     y       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4138
     y0      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4139
     y1      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4140
     dX      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4141
     dY      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4142
     innerHG "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4143
     innerWT "{ Class:SmallInteger }"
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4144
     lMargin
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4145
    |
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4146
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4147
    shown ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4148
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4149
    ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4150
1448
b389b8c76479 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  4151
    (wg := self windowGroup) notNil ifTrue:[
b389b8c76479 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  4152
        wg processRealExposeEventsFor:self.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4153
    ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4154
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4155
    innerWT := self innerWidth.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4156
    innerHG := self innerHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4157
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4158
    h := viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4159
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4160
    (y := anOrigin y) > h ifTrue:[              "/ end of contents
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4161
        y > (dY := self maxViewOriginY) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4162
            y := dY max:h
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4163
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4164
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4165
        y := y max:0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4166
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4167
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4168
    (x := anOrigin x) > 0 ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4169
        x := x min:(self widthOfContents - innerWT).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4170
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4171
    x      := x max:0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4172
    newOrg := (x @ y).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4173
    dltOrg := newOrg - viewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4174
    dX     := dltOrg x.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4175
    dY     := dltOrg y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4176
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4177
    (dX == 0 and:[dY == 0]) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4178
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4179
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4180
    self originWillChange.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4181
    viewOrigin := newOrg.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4182
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4183
    doRedraw ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4184
        ^ self originChanged:dltOrg
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4185
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4186
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4187
    dY ~~ 0 ifTrue:[                            "/ SCROLL VERTICAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4188
        dY := dY abs.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4189
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4190
        (dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  4191
            self invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4192
        ] ifFalse:[                             "/ COPY VERTICAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4193
            y0 := y1 := margin + dY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4194
            h  := innerHG - dY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4195
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4196
            dltOrg y < 0 ifTrue:[y0 := margin. y := y0]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4197
                        ifFalse:[y1 := margin. y := y1 + h].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4198
1460
2fe0ac4bc4d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1448
diff changeset
  4199
            self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:false.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  4200
            self invalidateX:margin y:y width:innerWT height:(innerHG - h).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4201
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4202
    ] ifFalse:[                                 "/ SCROLL HORIZONTAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4203
        dX := dX abs.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4204
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4205
        innerWT - dX < 20 ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4206
            labelView invalidate.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  4207
            self invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4208
        ] ifFalse:[                             "/ COPY HORIZONTAL
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  4209
            x0 := x1 := dX + margin.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4210
            w  := width - dX.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4211
            lMargin := labelView margin.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4212
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4213
            dltOrg x < 0 ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4214
                " ->"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4215
                x0 := x := margin.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4216
                self copyFrom:self x:margin y:margin toX:margin+dX y:margin width:innerWT-dX height:innerHG async:false.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4217
                self invalidateX:margin y:margin width:dX height:innerHG.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4218
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4219
                labelView notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4220
                    labelView copyFrom:labelView x:lMargin y:lMargin toX:lMargin+dX y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4221
                    labelView invalidateX:lMargin y:lMargin width:dX height:labelView innerHeight.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4222
                ].
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4223
            ] ifFalse:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4224
                x1 := margin. x := w.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4225
                self copyFrom:self x:margin+dX y:margin toX:margin y:margin width:innerWT-dX height:innerHG async:false.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4226
                self invalidateX:width-margin-dX y:margin width:dX height:innerHG.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4227
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4228
                labelView notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4229
                    labelView copyFrom:labelView x:lMargin+dX y:lMargin toX:lMargin y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4230
                    labelView invalidateX:labelView width-lMargin-dX y:lMargin width:dX height:labelView innerHeight.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4231
                ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4232
            ].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4233
            labelView repairDamage.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4234
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4235
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4236
    self originChanged:dltOrg.
1123
ea32a2e3d44d care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  4237
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4238
    wg notNil ifTrue:[
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4239
        wg processRealExposeEventsFor:self.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4240
    ].
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4241
1123
ea32a2e3d44d care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  4242
    "Modified: / 7.9.1998 / 16:39:49 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4243
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4244
2728
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4245
scrollToLine:aLineNr
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4246
    "for compat. with listViews"
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4247
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4248
    self scrollToRowAt:aLineNr colAt:1.
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4249
!
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4250
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4251
scrollToRowAt:aRowNr colAt:aColNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4252
    "make row at a row number in column at a column number visible"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4253
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4254
    |x  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4255
     y  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4256
     l  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4257
     dY "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4258
     dX "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4259
    |
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4260
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4261
    (    (aRowNr between:1 and:(list size))
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4262
     and:[aColNr between:0 and:(columnDescriptors size)]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4263
    ) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4264
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4265
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4266
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4267
    dY := dX := 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4268
    y  := self yVisibleOfRowNr:aRowNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4269
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4270
    y < margin ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4271
        dY := margin - y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4272
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4273
        y := y + rowHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4274
        l := height - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4275
        y > l ifTrue:[dY := l - y]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4276
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4277
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4278
    aColNr == 0 ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4279
        dY == 0 ifTrue:[^ self].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4280
        dX := 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4281
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4282
        x  := self xVisibleOfColNr:aColNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4283
1163
f46f69609c53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1149
diff changeset
  4284
        x <= margin ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4285
            dX := margin - x
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4286
        ] ifFalse:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4287
            x := x + (columnDescriptors at:aColNr) width.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4288
            l := width - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4289
            x > l ifTrue:[dX := l - x]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4290
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4291
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4292
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4293
    (dX == 0 and:[dY == 0]) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4294
        self scrollTo:(viewOrigin - (dX @ dY)).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4295
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4296
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4297
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4298
scrollToSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4299
    "make selection visible"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4300
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4301
    |rowNr|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4302
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4303
    (rowNr := self firstIndexSelected) ~~ 0 ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4304
        self scrollToRowAt:rowNr colAt:self selectedColIndex
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4305
    ]
1506
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4306
!
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4307
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4308
scrollVerticalTo:aPixelOffset
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4309
    "change origin to make aPixelOffset be the top line"
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4310
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4311
    |orgX orgY|
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4312
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4313
    orgX := viewOrigin x.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4314
    scrollRowWise ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4315
        orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4316
    ] ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4317
        orgY := aPixelOffset.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4318
    ].
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4319
    ^ self scrollTo:(orgX @ orgY).
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4320
!
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4321
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4322
startAutoScroll:aSelectorOrBlock distance:aDistance
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4323
    "setup for auto-scroll (when button-press-moving below/above view);
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4324
     - timeDelta for scroll is computed from distance"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4325
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4326
    |timeDelta scrollBlock|
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4327
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4328
    autoScroll ifFalse:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4329
        self stopAutoScroll.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4330
        ^ self
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4331
    ].
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4332
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4333
    autoScrollBlock notNil ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4334
        Processor removeTimedBlock:autoScrollBlock.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4335
    ] ifFalse:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4336
        self compressMotionEvents:false.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4337
    ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4338
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4339
    timeDelta := 0.5 / (aDistance abs).
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4340
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4341
    scrollBlock :=
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4342
        [
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4343
            aSelectorOrBlock isSymbol ifTrue:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4344
                self perform:aSelectorOrBlock.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4345
            ] ifFalse:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4346
                aSelectorOrBlock value
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4347
            ].
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4348
            autoScrollBlock notNil ifTrue:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4349
                Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4350
            ]
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4351
        ].
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4352
6145
2afa782523aa #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 6103
diff changeset
  4353
    autoScrollBlock := [self sensor pushAction:scrollBlock].
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4354
    Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4355
!
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4356
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4357
stopAutoScroll
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4358
    "stop any autoScroll"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4359
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4360
    autoScrollBlock notNil ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4361
        Processor removeTimedBlock:autoScrollBlock.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4362
        autoScrollBlock := nil.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4363
        self compressMotionEvents:true.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4364
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4365
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4366
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4367
!DSVColumnView methodsFor:'searching'!
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4368
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4369
findFirstColumnWithStringFrom:start to:stop
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4370
    start to:stop do:[:eachNr|
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4371
        |row lbl|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4372
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4373
        row := self at:eachNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4374
        columnDescriptors keysAndValuesDo:[:colNr :col |
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4375
            lbl := col shownValueForRow:row rowNr:eachNr.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4376
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4377
            lbl isNonByteCollection ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4378
                lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4379
            ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4380
            (lbl respondsTo:#string) ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4381
                lbl := lbl string.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4382
            ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4383
            (lbl size ~~ 0 and:[(lbl at:1) isCharacter]) ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4384
                ^ colNr
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4385
            ]
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4386
        ]
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4387
    ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4388
    ^ nil
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4389
!
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4390
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4391
findFirstRowWithString: aString from:start to:stop by: step ignoreCase:ignoreCase
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4392
    "Return the rowNr from the first row that matches aString.
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4393
     The search is performed between the start and stop row numbers and incrementing by a step"
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4394
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4395
    |stringToMatch|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4396
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4397
    aString isEmptyOrNil ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4398
        ^ self
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4399
    ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4400
    stringToMatch := '*', aString, '*'.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4401
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4402
    start to:stop by:step do:[:rowNr|
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4403
        |row lbl|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4404
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4405
        row := self at:rowNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4406
        columnDescriptors keysAndValuesDo:[:colNr :col |
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4407
            lbl := col shownValueForRow:row rowNr:rowNr.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4408
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4409
            lbl isNonByteCollection ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4410
                lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4411
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4412
            (lbl respondsTo:#string) ifTrue:[
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4413
                lbl := lbl string.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4414
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4415
            lbl isNumber ifTrue:[
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4416
                lbl := lbl printString.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4417
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4418
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4419
            (lbl size ~~ 0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4420
                and:[(lbl at:1) isCharacter
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4421
                and:[stringToMatch match:lbl caseSensitive:ignoreCase not
4359
bb6d48846f0d class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4333
diff changeset
  4422
            ]]) ifTrue:[
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4423
                ^ rowNr
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4424
            ]
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4425
        ]
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4426
    ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4427
    ^ nil
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4428
!
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4429
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4430
findFirstRowWithString: aString from:start to:stop ignoreCase:ignoreCase
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4431
    "Return the rowNr from the first row that matches aString.
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4432
     The search is performed between the start and stop row numbers"
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4433
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4434
    ^ self findFirstRowWithString:aString from:start to:stop by:1 ignoreCase:ignoreCase
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4435
! !
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4436
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4437
!DSVColumnView methodsFor:'selection'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4438
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4439
addRowToSelection:aRowNr
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4440
    "add a row to the selection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4441
     if a column is selected, the column will be closed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4442
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4443
    |newSelection|
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4444
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4445
    (self isRowSelectable:aRowNr) ifFalse:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4446
        ^ self
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4447
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4448
    self numberOfSelections == 0 ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4449
        self selectColIndex:0 rowIndex:aRowNr.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4450
        ^ self
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4451
    ].
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4452
    (self isInSelection:aRowNr) ifTrue:[
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4453
        ^ self
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4454
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4455
    multipleSelectOk ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4456
        self selectColIndex:0 rowIndex:aRowNr.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4457
        ^ self
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4458
    ].
2371
2bc91b1b59a5 bugfix when adding to selection
ca
parents: 2370
diff changeset
  4459
    newSelection := selectedRowIndex copyWith:aRowNr.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4460
    self selectedColIndex ~~ 0 ifTrue:[
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4461
        self selectColIndex:0 rowIndex:newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4462
    ] ifFalse:[
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4463
        selectedRowIndex := newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4464
        self invalidateRowAt:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4465
        self selectionChanged.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4466
    ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4467
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4468
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4469
deselect
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4470
    self selectColIndex:0 rowIndex:0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4471
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4472
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4473
firstIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4474
    "returns index of first row selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4475
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4476
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4477
        ^ selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4478
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4479
    selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4480
        ^ selectedRowIndex at:1
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4481
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4482
    ^ 0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4483
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4484
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4485
forceAcceptInEditor
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4486
    editView notNil ifTrue:[
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4487
        editView isDialogBox ifFalse:[
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4488
            editView
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4489
                allSubViewsDo:[:aSubView |
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4490
                    (aSubView respondsTo:#accept) ifTrue:[
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4491
                        aSubView accept
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4492
                    ].
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4493
                ]
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4494
        ]
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4495
    ]
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4496
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4497
    "Modified: / 23-04-2019 / 19:17:04 / Claus Gittinger"
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4498
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4499
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4500
hasRowSelection
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4501
    "returns true if a selection exists, and its a complete row
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4502
     (as opposed to either no selection, or a columnSelection)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4503
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4504
    ^ self hasSelection and:[ self selectedColIndex == 0 ]
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4505
!
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4506
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4507
hasSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4508
    "returns true if a selection exists"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4509
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4510
    ^ self numberOfSelections ~~ 0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4511
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4512
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4513
isInSelection:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4514
    "returns true, if row, aRowNr is in the selection"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4515
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4516
    aRowNr ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4517
        multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4518
            ^ aRowNr == selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4519
        ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4520
        selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4521
            ^ selectedRowIndex includes:aRowNr
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4522
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4523
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4524
    ^ false
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4525
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4526
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4527
isRowSelected:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4528
    "returns true, if row is in the selection"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4529
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4530
    self selectedColIndex == 0 ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4531
        ^ self isInSelection:aRowNr
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4532
    ].
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4533
    ^ false
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4534
!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4535
2263
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4536
isRowVisible:aRowNr
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4537
    |y h|
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4538
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4539
    h := rowHeight.
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4540
    y := self yVisibleOfRowNr:aRowNr.
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4541
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4542
    y < margin ifTrue:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4543
        (h := h + y) <= margin ifTrue:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4544
            ^ false
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4545
        ].
2263
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4546
    ] ifFalse:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4547
        y >= (height-margin) ifTrue:[^ false].
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4548
    ].
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4549
    ^ true
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4550
!
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4551
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4552
isSelected:aRowNr inColumn:aColNr
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4553
    "returns true if cell in a row; a row number, in a column, a column
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4554
     number is selected."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4555
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4556
    multipleSelectOk ifFalse:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4557
        aRowNr ~~ selectedRowIndex ifTrue:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4558
            ^ false
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4559
        ]
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4560
    ] ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4561
        (selectedRowIndex size ~~ 0 and:[ selectedRowIndex includes:aRowNr ]) ifFalse:[
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4562
            ^ false
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4563
        ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4564
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4565
    ^ (self selectedColIndex == 0 or:[ self selectedColIndex == aColNr ])
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4566
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4567
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4568
isSelectionVisibleIn:anExtentPoint
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4569
    self selectionIndicesDo:[:selRowNr |
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4570
        |y|
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4571
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4572
        y := self yVisibleOfRowNr:selRowNr.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4573
        (y between:margin and:(anExtentPoint y - margin)) ifTrue:[^ true].
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4574
    ].
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4575
    ^ false.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4576
!
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4577
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4578
lastIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4579
    "returns index of last selected row or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4580
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4581
    multipleSelectOk ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4582
        ^ selectedRowIndex
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4583
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4584
    selectedRowIndex size ~~ 0 ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4585
        ^ selectedRowIndex last
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4586
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4587
    ^ 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4588
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4589
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4590
makeLineVisible:aLine
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4591
    "scroll to make aLine visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4592
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4593
    |colNr|
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4594
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4595
    aLine == 0 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4596
        ^ self
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4597
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4598
    (self isRowVisible:aLine) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4599
        ^ self
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4600
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4601
    (self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4602
        colNr := self selectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4603
    ] ifFalse:[ colNr := 1 ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4604
    self scrollToRowAt:aLine colAt:colNr
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4605
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4606
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4607
makeSelectionVisible
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4608
    "scroll to make the selection line visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4609
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4610
    |rowNr colNr|
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4611
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4612
    rowNr := self firstIndexSelected.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4613
    rowNr == 0 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4614
        ^ self
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4615
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4616
    (self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4617
        colNr := self selectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4618
    ] ifFalse:[ colNr := 1 ].
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4619
    self scrollToRowAt:rowNr colAt:colNr
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4620
!
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4621
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4622
maxIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4623
    "return the largest index selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4624
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4625
    multipleSelectOk ifFalse:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4626
        ^ selectedRowIndex
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4627
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4628
    selectedRowIndex size ~~ 0 ifTrue:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4629
        ^ selectedRowIndex max
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4630
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4631
    ^ 0
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4632
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4633
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4634
minIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4635
    "return the smallest index selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4636
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4637
    multipleSelectOk ifFalse:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4638
        ^ selectedRowIndex
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4639
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4640
    selectedRowIndex size ~~ 0 ifTrue:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4641
        ^ selectedRowIndex min
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4642
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4643
    ^ 0
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4644
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4645
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4646
numberOfSelections
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4647
    "return the number of selected rows"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4648
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4649
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4650
        ^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4651
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4652
    ^ selectedRowIndex size
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4653
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4654
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4655
openEditorOnSelection
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4656
     |colIdx column rowIdx editorAndModel winGroup
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4657
      editor filter keyBrdFwd selColor|
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4658
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4659
    (shown and:[editView isNil]) ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4660
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4661
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4662
    winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4663
    winGroup isNil ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4664
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4665
    colIdx := self selectedColIndex ? 0.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4666
    column := self columnDescriptorAt:colIdx.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4667
    column isNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4668
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4669
    rowIdx := self selectedRowIndex ? 0.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4670
    rowIdx == 0 ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4671
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4672
    rowIdx isSequenceable ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4673
        rowIdx := rowIdx at:1 ifAbsent:[ ^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4674
    ].
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4675
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4676
    editorAndModel := column editorForRowAt:rowIdx.
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4677
    editorAndModel isNil ifTrue:[^ self].
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4678
    
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4679
    editor := editorAndModel editor.
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4680
    editor isDialogBox ifTrue:[
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4681
        editor open.
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4682
        editor accepted ifTrue:[
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4683
            "/ editorAndModel acceptAction value:nil.
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4684
        ].
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4685
        editView := editor.
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4686
        didEditWithDialog := true.
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4687
        ^ self
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4688
    ].    
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4689
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4690
    autoScrollToColumn == true ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4691
        self scrollToRowAt:rowIdx colAt:colIdx.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4692
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4693
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4694
    editView := SimpleView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4695
                extent:((column width - (2 * separatorSize))
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4696
                        @ (rowHeight - (2 * separatorSize)))
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4697
                in:self.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4698
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4699
    self updateEditViewOrigin.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4700
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4701
    (column containsText or:[ column showSelectionHighLighted not ]) ifTrue:[
3149
66df7168e377 bug fix
ca
parents: 3141
diff changeset
  4702
        selColor := (column backgroundColorAt:rowIdx)
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4703
    ] ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4704
        selColor := selectionBackgroundColor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4705
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4706
    editView viewBackground:selectionBackgroundColor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4707
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4708
    editView add:editor.
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4709
    editorAndModel editorNeedsCursorKeys ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4710
        editorAndModel editorNeedsReturnKey ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4711
            "/ only steal TAB from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4712
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4713
        ] ifFalse:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4714
            "/ steal TAB and RETURN from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4715
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #Return ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4716
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4717
    ] ifFalse:[
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4718
        editorAndModel editorNeedsReturnKey ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4719
            "/ only steal TAB and Curosr Keys from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4720
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4721
        ] ifFalse:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4722
            "/ steal TAB, RETURN and Curosr Keys from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4723
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown #Return ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4724
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4725
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4726
    keyBrdFwd := KeyboardForwarder
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4727
                toView:self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4728
                condition:nil
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4729
                filter:filter.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4730
    editView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4731
        withAllSubViewsDo:[:aView |
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4732
            aView delegate:keyBrdFwd.
4496
229bdd6b4754 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4489
diff changeset
  4733
            aView font:self font.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4734
        ].
3141
095e746ebc1d bug fix
ca
parents: 3140
diff changeset
  4735
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4736
    (editValue := editorAndModel model) notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4737
        editValue addDependent:self.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4738
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4739
    editView realize.
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4740
    editor canTab:true.
3962
0b5f7e526d0f changed:
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  4741
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4742
    winGroup focusView:editor.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4743
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4744
    self processAllExposeEvents.
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4745
3962
0b5f7e526d0f changed:
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  4746
    "Modified: / 02-11-2010 / 22:04:01 / cg"
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4747
    "Modified: / 23-04-2019 / 18:47:46 / Claus Gittinger"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4748
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4749
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4750
processAllExposeEvents
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4751
    |sensor|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4752
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4753
    sensor := self sensor.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4754
    [
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4755
        sensor hasExposeEventFor:nil
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4756
    ] whileTrue:[
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4757
        self windowGroup processExposeEvents
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4758
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4759
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4760
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4761
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4762
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4763
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4764
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4765
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4766
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4767
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4768
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4769
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4770
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4771
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4772
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4773
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4774
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4775
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4776
removeRowFromSelection:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4777
    "remove a row from the selection"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4778
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4779
    (self isInSelection:aRowNr) ifFalse:[^ self].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4780
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4781
    self numberOfSelections == 1 ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4782
        self deselect.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4783
    ] ifFalse:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4784
        selectedRowIndex := selectedRowIndex copyWithout:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4785
        self invalidateRowAt:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4786
        self selectionChanged.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4787
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4788
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4789
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4790
selectAllRows
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4791
    "select all"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4792
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4793
    multipleSelectOk ifFalse:[^ self].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4794
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4795
    selectedRowIndex := (1 to:list size) select:[:idx| self isRowSelectable:idx ].
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4796
    self selectionChanged.
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4797
    self invalidate.
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4798
!
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4799
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4800
selectColIndex:aColNr rowIndex:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4801
    "change selection with notification"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4802
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4803
    self selectColIndex:aColNr rowIndex:aRowNr openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4804
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4805
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4806
selectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4807
    "change selection with notification"
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4808
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4809
    |oldCol oldRow|
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4810
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4811
    oldCol := self selectedColIndex.
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4812
    oldRow := self selectedRowIndex.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4813
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4814
    self setSelectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4815
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4816
    (oldCol ~~ self selectedColIndex
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4817
    or:[oldRow ~= self selectedRowIndex
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4818
    or:[ignoreReselect == false]]) ifTrue:[
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4819
        self selectionChanged:aColNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4820
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4821
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4822
6180
a2037f3ba84c #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6145
diff changeset
  4823
selectRow:anInteger
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4824
    "select a row"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4825
6180
a2037f3ba84c #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 6145
diff changeset
  4826
    ^ self selectedRowIndex:anInteger
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4827
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4828
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4829
selectRowAt:rowNr colAt:colNr atPoint:aPoint
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4830
    self selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4831
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4832
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4833
selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:openEditor
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4834
    |view p shouldClick editorType|
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4835
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4836
    view := editView.
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4837
    didEditWithDialog := false.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4838
    self selectColIndex:colNr rowIndex:rowNr openEditor:openEditor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4839
    openEditor ifFalse:[ ^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4840
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4841
    didEditWithDialog ifTrue:[didEditWithDialog := false. ^ self].
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4842
    
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4843
    editView isNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4844
        "/ might be a reselection
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4845
        self openEditorOnSelection.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4846
        editView isNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4847
    ] ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4848
        editView == view ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4849
    ].
5517
9acf3fa7e7a8 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5447
diff changeset
  4850
    view := self detectViewAt:aPoint ignoreInvisible:false.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4851
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4852
    shouldClick := true.
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4853
    "/ when PreselectAllWhenOpeningEditor is true, we should not click into
5902
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4854
    "/ the editor, as this could clear the selection.
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4855
    "/ however, for non-text editors, it is a good idea to do so...
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4856
    PreselectAllWhenOpeningEditor == true ifTrue:[
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4857
        shouldClick := false.
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4858
    ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4859
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4860
    editorType := self selectedColumn editorType.
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4861
    editorType == #ComboList ifTrue:[ 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4862
        shouldClick := true 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4863
    ] ifFalse:[
5902
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4864
        editorType == #ComboBox ifTrue:[ 
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4865
            "/ only click if clicked onto menu-pull button
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4866
            (view ~~ self and:[view notNil]) ifTrue:[
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4867
                |screenPoint comboSubView|
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4868
5902
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4869
                screenPoint := device translatePoint:aPoint fromView:self toView:nil.
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4870
                comboSubView := device viewFromPoint:screenPoint.
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4871
                (comboSubView notNil and:[comboSubView isKindOf:Button]) ifTrue:[
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4872
                    shouldClick := true 
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4873
                ].    
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4874
            ].    
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4875
        ] ifFalse:[
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4876
            editorType == #CheckToggle ifTrue:[ 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4877
                shouldClick := true 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4878
            ] ifFalse:[
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4879
                editorType == #RadioButton ifTrue:[ 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4880
                    shouldClick := true 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4881
                ] ifFalse:[
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4882
                    "/ TODO: more heuristics here...
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4883
                    "/ editorType == #RadioButton ifTrue:[ ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4884
                    (view isKindOf:ComboBoxButton) ifTrue:[
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4885
                        shouldClick := true 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4886
                    ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4887
                ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4888
            ]
5902
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4889
        ].
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4890
    ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4891
    
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4892
    shouldClick ifTrue:[
2125
67e0f2c9ad4d event types are private to WindowEvent;
ca
parents: 2101
diff changeset
  4893
        "/ simulate clicking into the editor
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4894
        self breakPoint:#ca.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4895
        (view ~~ self and:[view notNil]) ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  4896
            p := device translatePoint:aPoint fromView:self toView:view.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4897
            self sensor
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4898
                    pushEvent:(WindowEvent   buttonPress:1 x:p x y:p y view:view);
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4899
                    pushEvent:(WindowEvent buttonRelease:1 x:p x y:p y view:view).
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4900
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4901
"/        "/ a very special hack for radioButtons:
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4902
"/        "/ if the button is now on, all other cells must be turned off !!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4903
"/        self selectedColumn editorType == #RadioButton ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4904
"/            1 tolist size do:[:eachRowNr |
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4905
"/                eachRowNr ~~ rowNr ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4906
"/                    self at:eachRowNr put:false
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4907
"/                ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4908
"/            ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4909
"/        ].
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4910
        ].
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4911
    ].
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4912
4073
14b8653c124f changed: #selectRowAt:colAt:atPoint:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4059
diff changeset
  4913
    "Modified: / 07-09-2011 / 16:08:45 / cg"
5517
9acf3fa7e7a8 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5447
diff changeset
  4914
    "Modified: / 15-03-2017 / 21:09:54 / stefan"
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  4915
    "Modified: / 23-04-2019 / 19:17:11 / Claus Gittinger"
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4916
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4917
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4918
selectRowFrom:start to:stop
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4919
    |step oldSelection newSelection|
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4920
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4921
    start == stop ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4922
        self selectColIndex:0 rowIndex:start.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4923
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4924
    ].
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4925
    step := (start <= stop) ifTrue:1 ifFalse:-1.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4926
    newSelection := (start to:stop by:step)
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4927
                select:[:idx | self isRowSelectable:idx ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4928
    self selectedColIndex ~~ 0 ifTrue:[
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4929
        self selectColIndex:0 rowIndex:newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4930
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4931
    ].
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4932
    oldSelection := selectedRowIndex ? #().
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4933
    selectedRowIndex := newSelection.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4934
    newSelection
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4935
        select:[:i | (oldSelection includes:i) not ]
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4936
        thenDo:[:i | self invalidateRowAt:i ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4937
    oldSelection
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4938
        select:[:i | (newSelection includes:i) not ]
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4939
        thenDo:[:i | self invalidateRowAt:i ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4940
    self selectionChanged.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4941
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4942
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  4943
selectRowIndex:anInteger
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4944
    "set selection of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4945
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  4946
    self selectColIndex:self selectedColIndex rowIndex:anInteger
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  4947
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  4948
    "Modified (format): / 21-11-2018 / 20:08:26 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4949
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4950
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4951
selectedColIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4952
    "returns selected column number or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4953
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4954
    ^ self selectedColIndexHolder value
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4955
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4956
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4957
selectedColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4958
    "returns selected column or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4959
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4960
    ^ columnDescriptors at:self selectedColIndex ifAbsent:nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4961
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4962
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4963
selectedRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4964
    "returns the selected row (or collection if multiple selection) or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4965
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4966
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4967
        ^ self at:selectedRowIndex ifAbsent:nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4968
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4969
    selectedRowIndex size ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4970
        ^ selectedRowIndex collect:[:i | self at:i ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4971
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4972
    ^ nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4973
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4974
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4975
selectedRow:something
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4976
    "select something"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4977
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4978
    self selectedRowIndex:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4979
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4980
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4981
selectedRowIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4982
    "returns selected row number or 0"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4983
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4984
    ^ selectedRowIndex
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4985
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4986
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4987
selectedRowIndex:rowOrCollectionOfRows
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4988
    "set the row selection (single or multiple rows);
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  4989
     does NOT change the selected column."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4990
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4991
    self selectColIndex:(self selectedColIndex) rowIndex:rowOrCollectionOfRows
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4992
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4993
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4994
selectionChanged
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4995
    "selection has changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4996
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4997
    self selectionChanged:nil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4998
!
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4999
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5000
selectionChanged:colNrOrNil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5001
    "selection has changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5002
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5003
    |val|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5004
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5005
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5006
        val := self selectedRowIndex copy.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5007
        (model respondsTo:#selectionIndex:) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5008
            model selectionIndex:val
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5009
        ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5010
            |newVal|
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5011
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5012
            newVal := (useIndex ifTrue:[val] ifFalse:[self selectedRow]).
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5013
            "/ must check here: valueHolder compares using identity to identify
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5014
            "/ changes. This would lead to an endless recursion....
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5015
            model value ~= newVal ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5016
                model value:newVal
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  5017
            ]
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5018
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  5019
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5020
    actionBlock notNil ifTrue:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5021
        colNrOrNil isNil ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5022
            actionBlock valueWithOptionalArgument:(self selectedRowIndex)
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  5023
        ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5024
            actionBlock valueWithOptionalArgument:(self selectedRowIndex) and:colNrOrNil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  5025
        ].
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  5026
    ]
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  5027
!
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  5028
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5029
selectionIndicesDo:aOneArgBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5030
    "evaluate block on each row selected; the argument to the row
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  5031
     is the index of the selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5032
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5033
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5034
        selectedRowIndex ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5035
            aOneArgBlock value:selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5036
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5037
    ] ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5038
        selectedRowIndex size ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  5039
            selectedRowIndex do:aOneArgBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5040
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5041
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5042
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5043
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5044
setSelectColIndex:colNrArg rowIndex:rowNrArg
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  5045
    "change selection without notification"
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5046
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5047
    self setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:true
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5048
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5049
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5050
setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:openEditor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5051
    "change selection without notification"
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5052
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5053
    |rowNr colNr newCol oldCol oldRow sglSelRow oldSz winGroup|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5054
5709
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  5055
    rowNr := self validateSelection:rowNrArg.
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  5056
    rowNr isNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5057
        rowNr := multipleSelectOk ifTrue:[#()] ifFalse:[0].
5709
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  5058
    ].
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  5059
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  5060
    colNr := colNrArg.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5061
    rowNr == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5062
        colNr := 0.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5063
    ] ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5064
        multipleSelectOk ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5065
            (rowNr size == 1) ifFalse:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5066
                colNr := 0
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5067
            ]
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5068
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5069
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5070
    (colNr := colNr ? 0) ~~ 0 ifTrue:[
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5071
        newCol := self columnDescriptorAt:colNr.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5072
        newCol rendererType == #rowSelector ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5073
            colNr := 0.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5074
            newCol := nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5075
        ] ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5076
            multipleSelectOk ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5077
                sglSelRow := rowNr at:1
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5078
            ] ifFalse:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5079
                sglSelRow := rowNr
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5080
            ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5081
            (newCol canSelect:sglSelRow) ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5082
                newCol := nil.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5083
                colNr := 0.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  5084
                selectRowOnDefault ifFalse:[
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
  5085
                    rowNr := multipleSelectOk ifTrue:[nil] ifFalse:[0]
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  5086
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5087
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5088
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5089
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5090
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5091
    (rowNr = selectedRowIndex and:[ colNr == self selectedColIndex ]) ifTrue:[
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  5092
        (editView notNil and:[editView isDialogBox]) ifTrue:[
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  5093
            editView := nil
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  5094
        ].
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  5095
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5096
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5097
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5098
    "/ release old selection
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5099
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5100
    oldSz := self numberOfSelections.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5101
    oldCol := self selectedColIndex.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5102
    oldRow := selectedRowIndex.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5103
    oldSz == 1 ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5104
        multipleSelectOk ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5105
            oldRow := oldRow at:1
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5106
        ].
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5107
        self updateColumnFromEditValueAndDestroyEditView.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5108
    ].
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  5109
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  5110
    (rowNr ~= selectedRowIndex
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  5111
    or:[ignoreReselect == false]) ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5112
        selectedRowIndex := rowNr.
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  5113
        self selectionChanged:colNr.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5114
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5115
    self selectedColIndex:colNr.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5116
    shown ifFalse:[ ^ self ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5117
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5118
    winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5119
    winGroup isNil ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5120
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5121
    oldSz > 1 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5122
        "/ redraw old selection
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5123
        oldRow do:[:aRowNr |
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5124
            "/ unselected if visible
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  5125
            self invalidateRowAt:aRowNr colAt:0
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5126
        ]
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5127
    ] ifFalse:[
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5128
        oldSz == 1 ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  5129
            self invalidateRowAt:oldRow colAt:oldCol
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5130
        ]
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5131
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5132
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5133
    "/ show new selection
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5134
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5135
    newCol notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5136
        openEditor ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5137
            self openEditorOnSelection.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5138
            editView notNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5139
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5140
        self invalidateRowAt:sglSelRow colAt:colNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5141
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  5142
        autoScrollToColumn == true ifTrue:[
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  5143
            self scrollToRowAt:sglSelRow colAt:colNr.
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  5144
        ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5145
    ] ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5146
        self selectionIndicesDo:[:i | self invalidateRowAt:i colAt:0 ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5147
        self scrollToRowAt:(self firstIndexSelected) colAt:0
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5148
    ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5149
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5150
    self processAllExposeEvents.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5151
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  5152
    "Modified: / 12-07-2011 / 14:22:42 / cg"
6043
8d87fa82b05d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5990
diff changeset
  5153
    "Modified: / 23-04-2019 / 19:30:50 / Claus Gittinger"
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5154
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5155
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5156
updateColumnFromEditValueAndDestroyEditView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5157
    |edValue selCol selRow|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5158
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5159
    selCol := self selectedColIndex.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5160
    selRow := selectedRowIndex.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5161
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5162
        editValue removeDependent:self
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5163
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5164
    editView notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5165
        self forceAcceptInEditor
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5166
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5167
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5168
        edValue := editValue value.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5169
        edValue isSequenceable ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5170
            edValue size == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5171
                edValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5172
            ] ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5173
                edValue isString ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5174
                    edValue := edValue select:[:el | el notNil ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5175
                    edValue size == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5176
                        edValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5177
                    ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5178
                ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5179
            ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5180
        ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5181
        selRow isNumber ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5182
            "/ ??? should we do ???:
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5183
            "/ selRow do:[:eachRow |
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5184
            "/     (self columnAt:selCol) at:eachRow put:edValue.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5185
            "/ ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5186
            selRow := selRow first
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5187
        ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5188
        (self columnDescriptorAt:selCol) at:selRow put:edValue.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5189
        modifiedChannel notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5190
            modifiedChannel value:true
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5191
        ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5192
        editValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5193
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5194
    self destroyEditView.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5195
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5196
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5197
validateSelection:aSelection
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5198
    |newSel|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5199
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5200
    (list size == 0 or:[aSelection isNil or:[aSelection == 0]]) ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5201
        ^ multipleSelectOk ifFalse:[0] ifTrue:[nil]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5202
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5203
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5204
    newSel := aSelection.
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5205
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5206
    multipleSelectOk ifFalse:[
2732
0d3258f88f58 *** empty log message ***
martin
parents: 2730
diff changeset
  5207
        newSel isInteger ifFalse:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5208
            newSel := self identityIndexOfRow:aSelection.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5209
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5210
        ^ (self isRowSelectable:newSel) ifTrue:[newSel] ifFalse:[0].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5211
    ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5212
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5213
    "multiple selection
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5214
    "
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5215
    aSelection size ~~ 0 ifTrue:[
2732
0d3258f88f58 *** empty log message ***
martin
parents: 2730
diff changeset
  5216
        aSelection first isInteger ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5217
            newSel := aSelection select:[:idx| self isRowSelectable:idx ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5218
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5219
            newSel := aSelection
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5220
                            collect:[:el| self identityIndexOfRow:el ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5221
                            thenSelect:[:idx| self isRowSelectable:idx ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5222
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5223
        newSel notEmpty ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5224
            ^ newSel
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5225
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5226
    ] ifFalse:[
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5227
        newSel isInteger ifFalse:[
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5228
            newSel := self identityIndexOfRow:aSelection.
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5229
        ].
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5230
        (self isRowSelectable:newSel) ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5231
            ^ Array with:newSel
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5232
        ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5233
    ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5234
    ^ nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5235
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5236
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5237
!DSVColumnView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5238
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5239
version
4794
73a3ffcaf58c class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4772
diff changeset
  5240
    ^ '$Header$'
3757
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5241
!
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5242
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5243
version_CVS
4794
73a3ffcaf58c class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4772
diff changeset
  5244
    ^ '$Header$'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5245
! !
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  5246