ListModelView.st
author Stefan Vogel <sv@exept.de>
Mon, 20 Sep 2004 12:33:52 +0200
changeset 2745 5986c83276b1
parent 2708 f3efc17bcbce
child 2852 c5651fcf9770
permissions -rw-r--r--
clean up obfuscated code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1431
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     1
"
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     2
 COPYRIGHT (c) 1999 by eXept Software AG
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
     3
	      All Rights Reserved
1431
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     4
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     5
 This software is furnished under a license and may be used
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     6
 only in accordance with the terms of that license and with the
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     8
 be provided or otherwise made available to, or used by, any
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
     9
 other person.  No title to or ownership of the software is
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    10
 hereby transferred.
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    11
"
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    12
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    13
1752
1c11b6e4ab37 use isHierarchicalItem instead of hack variable
ca
parents: 1748
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
1c11b6e4ab37 use isHierarchicalItem instead of hack variable
ca
parents: 1748
diff changeset
    15
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
View subclass:#ListModelView
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'list listHolder textStartLeft viewOrigin enabled fgColor bgColor
1399
da1eed642569 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1391
diff changeset
    18
		lineSpacing widthOfContents computeWidthInRange startOfLinesY
2329
4fb569f8f909 *** empty log message ***
ca
parents: 2322
diff changeset
    19
		autoScroll autoScrollBlock scrollWhenUpdating hasConstantHeight
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
    20
		constantHeight previousExtent renderer'
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultShadowColor
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
		DefaultLightColor StopRedrawSignal'
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
	poolDictionaries:''
1430
ae9e48cc7b9d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
    24
	category:'Views-Lists'
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
    27
Object subclass:#Renderer
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
    28
	instanceVariableNames:'view'
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
    29
	classVariableNames:''
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
    30
	poolDictionaries:''
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
    31
	privateIn:ListModelView
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
    32
!
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
    33
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!ListModelView class methodsFor:'documentation'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
1431
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    36
copyright
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    37
"
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    38
 COPYRIGHT (c) 1999 by eXept Software AG
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
    39
	      All Rights Reserved
1431
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    40
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    41
 This software is furnished under a license and may be used
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    42
 only in accordance with the terms of that license and with the
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    44
 be provided or otherwise made available to, or used by, any
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    45
 other person.  No title to or ownership of the software is
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    46
 hereby transferred.
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    47
"
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    48
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    49
!
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    50
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
documentation
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
"
1431
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    53
    This widget is a new improved revision of the good-old ListView.
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    54
    In contrast to ListView, this one reacts on changes of the
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    55
    underlying model and performs optimized redraws.
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    56
    It requires a List (or alike) as model.
0cc20a8f2f7c docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
    57
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    This class can only passively display collections of elements.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    The class doesn't keep its own list, it works directly on
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    the model( List or HierarchicalList ).
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    Each list item is obligated to provide 3 services:
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    63
        - heightOn:aGC
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    64
        - widthOn:aGC
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    65
        - displayOn:aGC x:x y:y
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    [Instance variables:]
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    68
        list                   <List-Model>     List or HierarchicalList ...
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    69
        listHolder             <Model>          Model, which keeps a List
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    70
        textStartLeft          <Number>         left inset of text
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    71
        viewOrigin             <Point>          the current origin
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    72
        enabled                <Boolean>        widget is enabled/disabeled
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    73
        fgColor                <Color>          color to draw characters
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    74
        bgColor                <Color>          the background
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    75
        lineSpacing            <Number>         pixels between lines
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    76
        widthOfContents        <Number>         cached width of widest line
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    77
        computeWidthInRange    <Point>          used for recompute width of contents
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    78
        startOfLinesY          <Collection>     keeps all the absolute Y-start positions
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    79
                                                for each line in the list. The first
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    80
                                                entry into the list is the top Y inset.
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    81
        supportsDisplayInRange <Boolean>        set to true if the list elements
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    82
                                                supports the service:
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    83
                                                    #displayOn:x:y:h:
1535
872422bc0e81 support frames (views) within the list
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    84
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    85
        hasConstantHeight      <Boolean>        true, than each line has the same height
1554
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
    86
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    87
        constantHeight         <SmallInteger>   hasConstantHeight is turned on, this
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    88
                                                is the used line height
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
    89
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    [author:]
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    91
        Claus Atzkern
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    [see also:]
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    95
        SelectionInListModelView
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    96
        HierarchicalListView
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    97
        List
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
    98
        HierarchicalList
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
examples
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
"
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   104
									[exBegin]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
    |top list view up index|
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    list := List new.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    top  := StandardSystemView new; extent:300@300.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    view := ScrollableView for:ListModelView miniScroller:true
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   111
			origin:0.0@0.0 corner:1.0@1.0 in:top.
1827
54e8a0fc8a42 scrollWhenUpdating
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
   112
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    view list:list.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
    top  openAndWait.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    up := true.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    [top shown] whileTrue:[
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   118
	Delay waitForSeconds:0.2.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   120
	up ifTrue:[
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   121
	    index := 1 + (list size).
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   122
	    list add:('element: ', index printString).
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   123
	    up := index < 20
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   124
	] ifFalse:[
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   125
	    list removeIndex:1.
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   126
	    up := list isEmpty.
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   127
	]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    ].
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   129
									[exEnd]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
!ListModelView class methodsFor:'initialization'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
initialize
1409
e46f8d30a9c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   138
    "setup the signals
e46f8d30a9c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1400
diff changeset
   139
    "
2552
7f6a07978018 notifications are proceedable
Claus Gittinger <cg@exept.de>
parents: 2551
diff changeset
   140
    StopRedrawSignal := Notification newSignalMayProceed:true.
2551
84b5eef43b23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2548
diff changeset
   141
    StopRedrawSignal nameClass:self message:#stopRedrawSignal.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
!ListModelView class methodsFor:'Signal constants'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
stopRedrawSignal
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    ^ StopRedrawSignal
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
!ListModelView class methodsFor:'defaults'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
   152
defaultRenderer
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
   153
    ^ Renderer
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
   154
!
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
   155
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
updateStyleCache
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    "extract values from the styleSheet and cache them in class variables"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    <resource: #style   (
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   160
			#'text.backgroundColor'  #'text.foregroundColor'
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   161
			#'selection.shadowColor' #'selection.lightColor'
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   162
			#'text.font'
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   163
			)>
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    DefaultForegroundColor         := StyleSheet colorAt:'text.foregroundColor' default:Black.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    DefaultBackgroundColor         := StyleSheet colorAt:'text.backgroundColor'.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    DefaultShadowColor             := StyleSheet colorAt:'selection.shadowColor'.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    DefaultLightColor              := StyleSheet colorAt:'selection.lightColor'.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    DefaultFont                    := StyleSheet  fontAt:'text.font'.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
     self updateStyleCache
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
!ListModelView methodsFor:'accessing'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
list
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    "get the list of items
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    ^ list
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
list:aList
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
    "set the list of items
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    "
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   191
    |negatedOrg|
1443
c9ef29f36c29 bug fix:
Claus Gittinger <cg@exept.de>
parents: 1431
diff changeset
   192
2640
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
   193
    renderer listWillChange.
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
   194
1452
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   195
    list ~~ aList ifTrue:[
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   196
        list removeDependent:self.
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   197
        list := aList.
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   198
        list isNil ifTrue:[list := self newDefaultList ].
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   199
        list addDependent:self
1452
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   200
    ].
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   201
    preferredExtent := nil.
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   202
    widthOfContents := nil.
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   203
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   204
    self realized ifFalse:[^ self].
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   205
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
    self recomputeHeightOfContents.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
1827
54e8a0fc8a42 scrollWhenUpdating
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
   209
    scrollWhenUpdating == #beginOfText ifTrue:[
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   210
        viewOrigin = (0@0) ifFalse:[
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   211
            self originWillChange.
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   212
            negatedOrg := viewOrigin negated.
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   213
            viewOrigin := (0@0).
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   214
            self originChanged:negatedOrg.
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   215
        ].
1827
54e8a0fc8a42 scrollWhenUpdating
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
   216
    ] ifFalse:[
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   217
        scrollWhenUpdating == #endOfText ifTrue:[
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   218
            self scrollTo:(0 @ self heightOfContents - self innerHeight) redraw:false
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   219
        ]
1422
98c0e3978fcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   220
    ].
1827
54e8a0fc8a42 scrollWhenUpdating
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
   221
1422
98c0e3978fcf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
   222
    self invalidate.
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   223
    self contentsChanged
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   224
!
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   225
2605
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   226
renderer
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   227
    "returns the used renderer
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   228
    "
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   229
    ^ renderer
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   230
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   231
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   232
renderer:aRenderer
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   233
    "change the used renderer
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   234
    "
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   235
    aRenderer isNil ifTrue:[^ self].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   236
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   237
    renderer == aRenderer ifTrue:[^ self].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   238
    renderer notNil ifTrue:[renderer release].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   239
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   240
    renderer := aRenderer.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   241
    renderer isBehavior ifTrue:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   242
        renderer := renderer basicNew initialize.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   243
    ].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   244
    renderer forView:self.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   247
!ListModelView methodsFor:'accessing-behavior'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   249
autoScroll
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   250
    "returns true if auto scrolling is enabled
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   251
    "
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   252
    ^ autoScroll
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   253
!
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   254
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   255
autoScroll:aBool
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   256
    "returns true if auto scrolling is enabled
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   257
    "
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   258
    autoScroll := aBool ? true.
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   259
!
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
   260
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
enabled
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
   "returns the enabled state
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
   "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
   ^ enabled
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
enabled:aBoolean
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
   "set the enabled state
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
   "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
   enabled := aBoolean
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
1742
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   275
!
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   276
2261
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   277
hasConstantHeight
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   278
    "user configured; true if each line has the same lineHeight
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   279
     optimize for scroller update
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   280
    "
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   281
    ^ hasConstantHeight
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   282
!
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   283
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   284
hasConstantHeight:aBool
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   285
    "user configured; true if each line has the same lineHeight
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   286
     optimize for scroller update
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   287
    "
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   288
    aBool == hasConstantHeight ifTrue:[
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   289
	^ self
2261
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   290
    ].
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   291
    constantHeight    := nil.
2261
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   292
    hasConstantHeight := aBool.
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   293
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   294
    self lostSynchronisation.
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   295
!
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
   296
1742
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   297
scrollWhenUpdating:aSymbolOrNil
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   298
    "define how to scroll, when I get a new text 
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   299
     (via the model or the #contents/#list)
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   300
     Allowed arguments are:
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   301
	#keep / nil     -> no change
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   302
	#endOfText      -> scroll to the end
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   303
	#beginOfText    -> scroll to the top
1742
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   304
     The default is #beginOfText.
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   305
     This may be useful for fields which get new values assigned from
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   306
     the program (i.e. not from the user)
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   307
    "
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   308
1827
54e8a0fc8a42 scrollWhenUpdating
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
   309
    scrollWhenUpdating := aSymbolOrNil
1742
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   310
28c2834d7c3c add #scrollWhenUpdating: - but not yet supported
ca
parents: 1736
diff changeset
   311
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   314
!ListModelView methodsFor:'accessing-items'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
at:anIndex
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    "return the list element at an index
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    ^ list at:anIndex
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
at:anIndex ifAbsent:exceptionBlock
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    "return the list element at an index if valid. 
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
     If the index is invalid, return the result of evaluating 
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
     the exceptionblock.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
    "
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   327
    ^ list at:anIndex ifAbsent:exceptionBlock
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   328
!
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   329
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   330
findLast:aOneArgBlock
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   331
    "find the last list entry, for which evaluation of the argument, aOneArgBlock
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   332
     returns true; return its index or 0 if none detected.
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   333
    "
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   334
    ^ list findLast:aOneArgBlock
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
identityIndexOf:anElement
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
    "returns the index of an element or nil
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
    "
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   340
    ^ list identityIndexOf:anElement
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   341
!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   343
last
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   344
    "returns the last list entry
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   345
    "
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   346
    ^ list last
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   349
!ListModelView methodsFor:'accessing-look'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
backgroundColor
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
    "get the background color
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
    ^ bgColor
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
font:aFont
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    "set a new font
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
    |oldWidth oldHeight|
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
    (aFont isNil or:[aFont = font]) ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   365
        oldWidth  := font width.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   366
        oldHeight := font height.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   368
        super font:aFont.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   370
        (font widthOn:device) ~~ oldWidth ifTrue:[       "/ force a recomputation
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   371
            preferredExtent := nil.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   372
            widthOfContents := nil.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   373
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   374
        oldHeight ~~ (font heightOn:device) ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   375
            self recomputeHeightOfContents.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   376
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   377
        self invalidate
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
foregroundColor
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
    "get the foreground color
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
    ^ fgColor
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
foregroundColor:aColor
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
    "set the foreground color
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
    (aColor notNil and:[fgColor ~~ aColor]) ifTrue:[
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   392
	self realized ifTrue:[
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   393
	    fgColor := aColor onDevice:device.
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   394
	    self invalidate
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   395
	] ifFalse:[
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   396
	    fgColor := aColor
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   397
	]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
    ]
1945
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   399
!
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   400
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   401
lineSpacing
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   402
    "get the lineSpacing - thats an additional number of pixels,
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   403
     by which lines are vertically separated.
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   404
    "
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   405
    ^ lineSpacing
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   406
!
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   407
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   408
lineSpacing:aNumber
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   409
    "set the lineSpacing - thats an additional number of pixels,
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   410
     by which lines are vertically separated.
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   411
    "
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   412
    lineSpacing ~= aNumber ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   413
        lineSpacing := aNumber.
1945
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   414
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   415
        self recomputeHeightOfContents.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
   416
        self invalidate
1945
694ea5d18b60 add access methods for lineSpacing
martin
parents: 1845
diff changeset
   417
    ]
2605
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   418
!
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   419
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   420
viewBackground:aColor
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   421
    "set the background color
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   422
    "
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   423
    (aColor notNil and:[bgColor ~~ aColor]) ifTrue:[
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   424
        bgColor := aColor.
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   425
        super viewBackground:bgColor.
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   426
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   427
        self realized ifTrue:[
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   428
            bgColor := bgColor onDevice:device.
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   429
            self invalidate
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   430
        ].
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   431
    ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
   434
!ListModelView methodsFor:'accessing-mvc'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
listHolder
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
    "returns the listHolder or nil
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
    ^ listHolder
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
listHolder:aListHolder
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
    "set a new listHolder
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
    listHolder removeDependent:self.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
    (listHolder := aListHolder) notNil ifTrue:[
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
   448
	listHolder addDependent:self.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
    self list:(listHolder value).
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
!ListModelView methodsFor:'change & update'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
lineChangedAt:aLnNr with:arg
2548
2d96d09497e9 Fix funny names
Stefan Vogel <sv@exept.de>
parents: 2501
diff changeset
   456
    "line changed at position; check whether line height changed"
2d96d09497e9 Fix funny names
Stefan Vogel <sv@exept.de>
parents: 2501
diff changeset
   457
2d96d09497e9 Fix funny names
Stefan Vogel <sv@exept.de>
parents: 2501
diff changeset
   458
    |cache
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
     oldHeight "{ Class:SmallInteger }"
2548
2d96d09497e9 Fix funny names
Stefan Vogel <sv@exept.de>
parents: 2501
diff changeset
   460
     dltHeight "{ Class:SmallInteger }" |
2d96d09497e9 Fix funny names
Stefan Vogel <sv@exept.de>
parents: 2501
diff changeset
   461
2d96d09497e9 Fix funny names
Stefan Vogel <sv@exept.de>
parents: 2501
diff changeset
   462
    (arg == #icon or:[arg == #hierarchy]) ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   463
        ^ self
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
    ].
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   465
    hasConstantHeight ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   466
        self invalidateLineAt:aLnNr.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   467
        ^ self
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   468
    ].
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
   469
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
    oldHeight := (self yVisibleOfLine:(aLnNr + 1)) - (self yVisibleOfLine:aLnNr).
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
    dltHeight := (self heightOfLineAt:aLnNr) - oldHeight.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
    dltHeight == 0 ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   474
        self invalidateLineAt:aLnNr.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   475
        ^ self
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
    ].
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   477
    cache := self startOfLinesY.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
2548
2d96d09497e9 Fix funny names
Stefan Vogel <sv@exept.de>
parents: 2501
diff changeset
   479
    aLnNr + 1 to:cache size do:[:i|
2d96d09497e9 Fix funny names
Stefan Vogel <sv@exept.de>
parents: 2501
diff changeset
   480
        cache at:i put:((cache at:i) + dltHeight)
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
    self invalidate.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
listChangedInsert:start nItems:nLines
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    "list changed; items are added
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
    "
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   488
    |newLines
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
     run    "{ Class: SmallInteger }"
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   490
     newSz  "{ Class: SmallInteger }"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
     cpyHg  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
     absY0  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
     absY1  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
     visY0  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
     visY1  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
     orgY   "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
     dltY   "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
     maxHg  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
   |
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
    nLines == 0 ifTrue:[^ self ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
    self listSizeChanged:start nLines:nLines.
2569
bfe9e33b545e not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2568
diff changeset
   503
    shown ifFalse:[^ self].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   505
    newSz := startOfLinesY size + nLines.
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   506
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   507
    (newSz - 1) ~~ self size ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   508
        "/
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   509
        "/ no longer synchrounous
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   510
        "/
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   511
        ^ self lostSynchronisation
1451
85e0df1771e5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   512
    ].
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   513
    newLines := startOfLinesY copy.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   514
    newLines addAll:(Array new:nLines) beforeIndex:start + 1.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   515
    absY0 := newLines at:start.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
    absY1 := absY0.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
    run   := start.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
    nLines timesRepeat:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   520
        absY1 := absY1 + (self heightOfLineAt:run).
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   521
        run   := run + 1.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   522
        newLines at:run put:absY1.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
    dltY := absY1 - absY0.
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   525
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   526
    run + 1 to:newSz do:[:i||v|
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   527
        newLines at:i put:((newLines at:i) + dltY)
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    ].
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   529
    startOfLinesY := newLines.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
    orgY  := viewOrigin y.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
    absY1 := absY0 + dltY.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
    visY0 := absY0 - orgY.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
    visY1 := absY1 - orgY.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
    maxHg := height - margin.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
    absY0 < orgY ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   538
        self originWillChange.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   539
        viewOrigin y:(dltY + orgY).
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   540
        self originChanged:(0 @ dltY).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
    ].
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   542
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
    (visY0 >= maxHg or:[visY1 <= margin]) ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   544
        ^ self contentsChanged
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
    visY0 := visY0 max:margin.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
    visY1 := visY1 min:maxHg.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
1773
9dba0f0dda0e invalidate uptoend not all if a damage exists (insert/remove)
ca
parents: 1753
diff changeset
   549
    self hasDamage ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   550
        self invalidate:(Rectangle left:0
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   551
                                    top:visY0 
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   552
                                  width:width 
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   553
                                 height:height - visY0).
1773
9dba0f0dda0e invalidate uptoend not all if a damage exists (insert/remove)
ca
parents: 1753
diff changeset
   554
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   555
        ^ self contentsChanged.
1773
9dba0f0dda0e invalidate uptoend not all if a damage exists (insert/remove)
ca
parents: 1753
diff changeset
   556
    ].
9dba0f0dda0e invalidate uptoend not all if a damage exists (insert/remove)
ca
parents: 1753
diff changeset
   557
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   558
    (start == self size or:[(cpyHg := maxHg - visY1) < 20]) ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   559
        visY1 := maxHg
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
    ] ifFalse:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   561
        self catchExpose.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   563
        self copyFrom:self x:0 y:visY0
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   564
                         toX:0 y:visY1
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   565
                       width:width height:cpyHg async:true.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   567
        self waitForExpose
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   570
    self invalidateX:margin
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   571
                   y:visY0
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   572
               width:width - margin - margin
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   573
              height:(visY1 - visY0).
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   574
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
    self contentsChanged.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
1446
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   578
listChangedRemove:aStart toIndex:aStop
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
    "list changed; items are removed
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
    "
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   581
    |noRedraw newLines
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
     size  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
     absY0 "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
     absY1 "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
     visY0 "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
     visY1 "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
     orgY  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
     orgX  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
     dltY  "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
     cpyHg "{ Class: SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
     maxHg "{ Class: SmallInteger }"
1444
0b7cd00e2537 check range before delete lines
Claus Gittinger <cg@exept.de>
parents: 1443
diff changeset
   592
     stop  "{ Class: SmallInteger }"
1446
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   593
     start "{ Class: SmallInteger }"
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   594
     newSz "{ Class: SmallInteger }"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   595
    |
1446
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   596
    stop  := aStop.
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   597
    start := aStart.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   598
1446
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   599
    (size := stop - start + 1) == 0 ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   600
        ^ self
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   601
    ].
1446
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
   602
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
    self listSizeChanged:start nLines:(size negated).
2569
bfe9e33b545e not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2568
diff changeset
   604
    shown ifFalse:[^ self].
1451
85e0df1771e5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   605
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   606
    newSz := startOfLinesY size - size.
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   607
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   608
    (newSz - 1) ~~ self size ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   609
        "/
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   610
        "/ no longer synchrounous
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   611
        "/
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   612
        ^ self lostSynchronisation
1451
85e0df1771e5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   613
    ].
85e0df1771e5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1446
diff changeset
   614
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
    absY0 := self yAbsoluteOfLine:start.
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   616
    absY1 := self yAbsoluteOfLine:stop + 1.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
    dltY  := absY1 - absY0.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   619
    newLines := startOfLinesY copy.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   620
    newLines removeFromIndex:(start + 1) toIndex:(stop + 1).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   622
    (start + 1) to:newSz do:[:i|
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   623
        absY0 := newLines at:i.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   624
        newLines at:i put:(absY0 - dltY).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
    ].
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   626
    startOfLinesY := newLines.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
    orgY  := viewOrigin y.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
    orgX  := viewOrigin x.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
    absY0 := self yAbsoluteOfLine:start.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
    absY1 := absY0 + dltY.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
    visY0 := absY0 - orgY.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
    visY1 := absY1 - orgY.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
    maxHg := height - margin.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   637
    (self size == 0 or:[(orgY ~~ 0 and:[self maxViewOriginY == 0])]) ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   638
        (orgX ~~ 0 or:[orgY ~~ 0]) ifTrue:[
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   639
            self originWillChange.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   640
            viewOrigin := 0@0.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   641
            self originChanged:((orgX @ orgY) negated).
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   642
        ].
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   643
        self invalidate.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   644
        ^ self contentsChanged    
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
    visY0 < margin ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   648
        noRedraw := visY1 <= margin.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   649
        noRedraw ifTrue:[dltY := dltY negated] ifFalse:[dltY := visY0].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   651
        self originWillChange.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   652
        viewOrigin y:(dltY + orgY).
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   653
        self originChanged:(0 @ dltY).        
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
    ] ifFalse:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   655
        noRedraw := visY0 >= maxHg
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
    ].
1773
9dba0f0dda0e invalidate uptoend not all if a damage exists (insert/remove)
ca
parents: 1753
diff changeset
   657
    visY0 := visY0 max:margin.
9dba0f0dda0e invalidate uptoend not all if a damage exists (insert/remove)
ca
parents: 1753
diff changeset
   658
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   659
    self hasDamage ifTrue:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   660
        self invalidate:(Rectangle left:0
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   661
                                    top:visY0 
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   662
                                  width:width 
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   663
                                 height:height - visY0).
1773
9dba0f0dda0e invalidate uptoend not all if a damage exists (insert/remove)
ca
parents: 1753
diff changeset
   664
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   665
        noRedraw := true
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   666
    ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
   668
    noRedraw ifFalse:[
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   669
        cpyHg := maxHg - visY1.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   671
        cpyHg > 20 ifTrue:[
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   672
            self catchExpose.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   673
            self copyFrom:self x:0 y:visY1 toX:0 y:visY0
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   674
                    width:width height:cpyHg async:true.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   675
            self waitForExpose.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   676
            visY0 := visY0 + cpyHg.
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   677
        ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
2385
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   679
        self invalidateX:margin
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   680
                       y:visY0
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   681
                   width:width - margin - margin
8113112e2184 *** empty log message ***
ca
parents: 2384
diff changeset
   682
                  height:(maxHg - visY0).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
    self contentsChanged.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   687
update:what with:aPara from:chgObj
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   688
    "catch and handle any notification raised from the list model
2745
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   689
     or list holder"
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   690
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   691
    chgObj == self listHolder ifTrue:[
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   692
        self list:chgObj value.
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   693
        ^ self.
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   694
    ].
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   695
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   696
    chgObj == self list ifTrue:[
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   697
        renderer withinUpdateFromListDo:[
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   698
            self updateFromList:what with:aPara.
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   699
        ].
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   700
        ^ self.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   701
    ].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   702
2745
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
   703
    super update:what with:aPara from:chgObj
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   704
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   705
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   706
updateFromList:what with:aPara
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   707
    "called if the list changed
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   708
    "
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   709
    |arg1 arg2|
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   710
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   711
    aPara isCollection ifFalse:[
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   712
        what == #at:     ifTrue:[self lineChangedAt:aPara        with:nil.   ^ self].
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   713
        what == #insert: ifTrue:[self listChangedInsert:aPara  nItems:1.     ^ self].
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   714
        what == #remove: ifTrue:[self listChangedRemove:aPara toIndex:aPara. ^ self].
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   715
      ^ self.
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   716
    ].
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   717
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   718
    arg1 := aPara at:1.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   719
    arg2 := aPara at:2.
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   720
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   721
    (arg1 == 1 and:[arg2 == self size]) ifTrue:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   722
        self list:(self list).  "/ reload list
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   723
      ^ self
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   724
    ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   725
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   726
    what == #at:               ifTrue:[self lineChangedAt:arg1        with:arg2. ^ self].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   727
    what == #insertCollection: ifTrue:[self listChangedInsert:arg1  nItems:arg2. ^ self].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   728
    what == #removeFrom:       ifTrue:[self listChangedRemove:arg1 toIndex:arg2. ^ self].
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   729
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   730
    what == #replace: ifTrue:[
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   731
        arg1 to:arg2 do:[:i|self lineChangedAt:i with:nil].
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   732
      ^ self
1995
ede7d0221fa0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1945
diff changeset
   733
    ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
!ListModelView methodsFor:'drawing'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   738
drawElementsFrom:start to:stop x:x y:y w:w
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   739
    "draw lines from start to stop.
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   740
     clipping and clearing the background is already done
1399
da1eed642569 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1391
diff changeset
   741
    "
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   742
    |item
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   743
     y0 "{ Class:SmallInteger }"
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   744
     y1 "{ Class:SmallInteger }"
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   745
     x0 "{ Class:SmallInteger }"
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   746
    |
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   747
    self paint:fgColor on:bgColor.
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   748
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   749
    x0 := textStartLeft - viewOrigin x.
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   750
    y1 := y.
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   751
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   752
    start to:stop do:[:i|
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   753
        item := self at:i ifAbsent:self.        "/ list changed during draw
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   754
        item == self ifTrue:[^ self].
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   755
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   756
        y0 := y1.
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   757
        y1 := self yVisibleOfLine:(i + 1).
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   758
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   759
        item notNil ifTrue:[
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
   760
            renderer display:item atX:x0 y:y0 lineHeight:(y1 - y0).
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   761
        ]
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   762
    ]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   765
drawFrom:start to:stop x:xLft y:yTop w:aWidth
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   766
    "draw lines from start to stop. Test whether a new clip
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   767
     must be setup.
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   768
    "
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   769
    |maxX w|
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   770
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   771
    maxX := renderer maxItemWidthOrNil.
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   772
    w := aWidth.
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   773
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   774
    maxX notNil ifTrue:[ |clip|
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   775
        maxX := maxX - viewOrigin x.
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   776
        maxX > xLft ifFalse:[^ self.].
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   777
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   778
        w := maxX - xLft min:aWidth.
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   779
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   780
        (clip := self clipRect copy) notNil ifTrue:[
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   781
            clip width:w
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   782
        ] ifFalse:[
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   783
            clip := Rectangle left:xLft top:yTop width:w height:(height - yTop - margin).
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   784
        ].
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   785
        self clippingRectangle:clip.
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   786
    ].
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   787
    self drawElementsFrom:start to:stop x:xLft y:yTop w:w.
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   788
!
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
   789
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   790
invalidateLineAt:aLineNr
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   791
    "add a damage to redraw a line specified by its line number to the
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   792
     input event queue.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
    "
2322
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   794
    ^ self invalidateLineAt:aLineNr fromX:0.
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   795
!
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   796
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   797
invalidateLineAt:aLineNr fromX:x
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   798
    "add a damage to redraw a line specified by its line number to the
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   799
     input event queue.
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   800
    "
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
    |y0 "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
     y1 "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
     yB "{ Class:SmallInteger }"
2322
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   804
     x0 "{ Class:SmallInteger }"
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   805
     xR "{ Class:SmallInteger }"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
    |
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
2244
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   808
    (shown and:[aLineNr notNil and:[aLineNr > 0]]) ifFalse:[
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   809
        ^ self
2244
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   810
    ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
2322
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   812
    xR := width - margin.
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   813
    x0 := x max:margin.
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   814
    x0 < xR ifFalse:[ ^ self].
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   815
2244
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   816
    yB := height - margin.
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   817
    y0 := (self yVisibleOfLine:aLineNr) max:margin.
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   818
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   819
    y0 < yB ifTrue:[
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   820
        y1 := (self yVisibleOfLine:(aLineNr + 1)) min:yB.
2244
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   821
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   822
        y1 > y0 ifTrue:[
2322
b033ff2263ec add method: #invalidateLineAt:fromX:.
ca
parents: 2304
diff changeset
   823
            self invalidateX:x0 y:y0 width:(xR - x0) height:(y1 - y0) repairNow:false.
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   824
        ]
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   825
    ].
2244
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   826
!
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   827
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   828
redraw
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   829
    "redraw complete view
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   830
    "
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   831
    self redrawX:0 y:0 width:width height:height.
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
   832
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
redrawX:x y:y width:w height:h
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
    "redraw part of myself immediately, given logical coordinates 
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
    "
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   839
    |start stop yAbs yStart|
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
    shown ifFalse:[^ self].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
2599
4945da23d4e9 oops-forget asking for #size
ca
parents: 2598
diff changeset
   843
    (self startOfLinesY size == 1 and:[self size > 1]) ifTrue:[
2598
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   844
        "oops, recompute the height of the contents (the first time after creation).
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   845
        "
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   846
        self recomputeHeightOfContents.
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   847
2599
4945da23d4e9 oops-forget asking for #size
ca
parents: 2598
diff changeset
   848
        self startOfLinesY size > 1 ifTrue:[
2598
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   849
            "oops, the contents height changed
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   850
            "
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   851
            self invalidate.
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   852
            self contentsChanged.
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   853
            ^ self
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   854
        ].
b0c2d20f4062 recomputation of the contents height during redraw if not yet happen;
ca
parents: 2595
diff changeset
   855
    ].
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   856
    widthOfContents isNil ifTrue:[
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   857
        self preferredExtent
2188
774f66eedaea *** empty log message ***
ca
parents: 2156
diff changeset
   858
    ].
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   859
    yStart := y.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   860
    start  := self yVisibleToLineNr:y.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   862
    start notNil ifTrue:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   863
        yAbs := y + h.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   864
        stop := self yVisibleToLineNr:yAbs.
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   865
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   866
        stop isNil ifTrue:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   867
            stop := self size.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   868
        ] ifFalse:[ |y0|
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   869
            y0 := self startOfLinesY at:stop ifAbsent:nil.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   870
            y0 isNil ifTrue:[^ self].   "/ oops, lines differ (will be changed)
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   871
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   872
            yAbs == y0 ifTrue:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   873
                stop := (stop - 1) max:start
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   874
            ].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   875
        ].
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
   876
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   877
        start > stop ifTrue:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   878
            start := stop := nil.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   879
        ] ifFalse:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   880
            (renderer validateDrawableItemsFrom:start to:stop) ifFalse:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   881
                self invalidate.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   882
                ^ self.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   883
            ].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   884
            yStart := self yVisibleOfLine:start.
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   885
        ].
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   886
    ].
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   887
    self paint:bgColor.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   888
    self fillRectangleX:x y:y width:w height:h.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   889
2605
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   890
    StopRedrawSignal handle:[:ex|
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   891
        "/ an item changed its dimension during drawing, draw is aborted
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   892
        self invalidate
3690a334fac1 bug fix: when setting #viewBackground: and computation of automatic scroll to x
ca
parents: 2600
diff changeset
   893
    ] do:[
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   894
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   895
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   896
        start notNil ifTrue:[
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   897
            self drawFrom:start to:stop x:x y:yStart w:w.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   898
        ].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
   899
        renderer postRedrawX:x y:yStart w:w from:start to:stop.
2304
50c23d061969 must recompute width of contents if line changed
ca
parents: 2302
diff changeset
   900
    ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
!ListModelView methodsFor:'event handling'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
keyPress:aKey x:x y:y
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2464
diff changeset
   906
    "a key was pressed - handle page-keys here"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2464
diff changeset
   907
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
    <resource: #keyboard( #PreviousPage #NextPage  #HalfPageUp #HalfPageDown
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   909
                          #BeginOfText  #EndOfText #ScrollUp   #ScrollDown
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   910
                        )>
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2464
diff changeset
   912
    |n|
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   914
    self size ~~ 0 ifTrue:[
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   915
        (aKey == #PreviousPage) ifTrue:[^ self pageUp].
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   916
        (aKey == #NextPage)     ifTrue:[^ self pageDown].
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   917
        (aKey == #HalfPageUp)   ifTrue:[^ self halfPageUp].
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   918
        (aKey == #HalfPageDown) ifTrue:[^ self halfPageDown].
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   919
        (aKey == #BeginOfText)  ifTrue:[^ self scrollToTop].
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   920
        (aKey == #EndOfText)    ifTrue:[^ self scrollToBottom].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   922
        (aKey == #ScrollUp or:[aKey == #ScrollDown]) ifTrue:[
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2464
diff changeset
   923
            n := 1 + (self sensor compressKeyPressEventsWithKey:aKey).
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   924
            n := n * self verticalScrollStep.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   926
            aKey == #ScrollUp ifTrue:[self scrollUp:n]
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   927
                             ifFalse:[self scrollDown:n].
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   928
            ^ self
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
   929
        ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   930
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   931
    super keyPress:aKey x:x y:y
2274
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
   932
!
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
   933
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
   934
sizeChanged:how
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
   935
    previousExtent := self extent.
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
   936
    super sizeChanged:how.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   937
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   938
1554
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   939
!ListModelView methodsFor:'event simulation'!
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   940
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   941
syncronizeEvents
2708
f3efc17bcbce Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2670
diff changeset
   942
    <resource:#obsolete>
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   943
    self obsoleteMethodWarning:'no longer supported'.
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   944
    ^ false
1554
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   945
!
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   946
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   947
syncronizeEvents:aBoolean
2708
f3efc17bcbce Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2670
diff changeset
   948
    <resource:#obsolete>
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
   949
    self obsoleteMethodWarning:'no longer supported'.
1554
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   950
! !
c45cac3c4d31 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1538
diff changeset
   951
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
!ListModelView methodsFor:'fetch resources'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
colorOnDevice:aColor
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
    "fetch a device colors
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
    "
2097
78bfd62fdcbc on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   957
    ^ aColor notNil ifTrue:[aColor onDevice:device] ifFalse:[nil]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   960
imageOnMyDevice:anImage
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
    "associate image to device and clear pixel mask
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
     returns the new image.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
    "
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   964
    |deviceImage|
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   965
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   966
    anImage isNil ifTrue:[^ anImage].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   967
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   968
    deviceImage := anImage onDevice:device.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   969
    deviceImage isImage ifTrue:[
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   970
        deviceImage clearMaskedPixels.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   971
    ].
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   972
    ^ deviceImage
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   973
"/    |image|
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   974
"/
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   975
"/    (image := anImage) notNil ifTrue:[
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   976
"/        image device ~~ device ifTrue:[
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   977
"/            image := image copy.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   978
"/        ].
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   979
"/        image := image onDevice:device.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   980
"/        image := image clearMaskedPixels.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   981
"/    ].
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
   982
"/    ^ image
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   984
1417
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   985
!ListModelView methodsFor:'focus handling'!
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   986
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   987
wantsFocusWithButtonPress
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   988
    "catch the keyboard focus on button click
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   989
    "
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   990
    ^  true
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   991
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   992
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   993
!
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   994
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   995
wantsFocusWithPointerEnter
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   996
    "views which like to take the keyboard focus
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   997
     when the pointer enters can do so by redefining this
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   998
     to return true"
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
   999
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
  1000
    ^ true
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
  1001
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
  1002
! !
3d331ae2d2b6 implements:
Claus Gittinger <cg@exept.de>
parents: 1409
diff changeset
  1003
2501
832cbac295b8 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  1004
!ListModelView methodsFor:'initialization & release'!
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1006
create
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1007
    "fetch device dependent resources
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1008
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1009
    super create.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1010
    self fetchResources.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1011
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1012
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1013
initStyle
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1014
    "setup viewStyle specifics
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1015
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1016
    super initStyle.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1017
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1018
    DefaultBackgroundColor notNil ifTrue:[
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1019
        viewBackground := DefaultBackgroundColor
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1020
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1021
    lineSpacing   := 0.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1022
    textStartLeft := 2.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1023
    fgColor       := DefaultForegroundColor.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1024
    bgColor       := viewBackground.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1025
    startOfLinesY := OrderedCollection new.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
    startOfLinesY add:(2 + margin). "/ top inset of first line
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1028
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1029
    DefaultShadowColor notNil ifTrue:[
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1030
        shadowColor := DefaultShadowColor
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1031
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1032
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1033
    DefaultLightColor notNil ifTrue:[
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1034
        lightColor := DefaultLightColor
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1035
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1036
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1037
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1038
initialize
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1039
    "setup default attributes
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1041
    super initialize.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1042
2261
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1043
    viewOrigin         := 0@0.
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1044
    bitGravity         := #NorthWest.
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1045
    enabled            := true.
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1046
    autoScroll         := true.
1827
54e8a0fc8a42 scrollWhenUpdating
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
  1047
    scrollWhenUpdating := #beginOfText.
2261
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1048
    hasConstantHeight  := false.
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1049
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1050
    renderer isNil ifTrue:[
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1051
        renderer := self class defaultRenderer forView:self.
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1052
    ].
2600
69bc62444098 create default list during initialize
ca
parents: 2599
diff changeset
  1053
    self list:(self newDefaultList).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1054
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1055
1562
342e61e7bc99 recompute height of contents after mapped
ca
parents: 1554
diff changeset
  1056
mapped
342e61e7bc99 recompute height of contents after mapped
ca
parents: 1554
diff changeset
  1057
    "recompute list
342e61e7bc99 recompute height of contents after mapped
ca
parents: 1554
diff changeset
  1058
    "
342e61e7bc99 recompute height of contents after mapped
ca
parents: 1554
diff changeset
  1059
    shown ifFalse:[
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1060
        self recomputeHeightOfContents.
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1061
        self contentsChanged.
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1062
    ].
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1063
    renderer mapped.
1562
342e61e7bc99 recompute height of contents after mapped
ca
parents: 1554
diff changeset
  1064
    super mapped
342e61e7bc99 recompute height of contents after mapped
ca
parents: 1554
diff changeset
  1065
!
342e61e7bc99 recompute height of contents after mapped
ca
parents: 1554
diff changeset
  1066
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1067
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1828
diff changeset
  1068
    "sent after a snapin or a migration, reinit for new device"
1828
ea1f39c639f8 comment
Claus Gittinger <cg@exept.de>
parents: 1827
diff changeset
  1069
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
    super recreate.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1071
    self fetchResources.
1796
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1072
!
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1073
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1074
reinitialize
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1075
    "reinit after snapIn (font geometry might be different)
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1076
    "
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1077
    super reinitialize.
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1078
    self recomputeHeightOfContents.
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1079
    self contentsChanged.
c9d801c011f7 recompute layout after snapIn (font geometry could be different)
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1080
2156
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  1081
!
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  1082
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  1083
release
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  1084
    "remove dependencies
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  1085
    "
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1086
    renderer release.
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1087
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1088
    self listHolder removeDependent:self.
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1089
    self list       removeDependent:self.
2156
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  1090
e16dc409ecf2 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  1091
    super release
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1092
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1093
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1094
!ListModelView methodsFor:'private'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1095
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1096
hasDamage
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2464
diff changeset
  1097
    "return true, if any damage events (i.e. expose or resize) are pending"
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1098
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2464
diff changeset
  1099
    ^ self sensor hasDamageFor:self
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1100
!
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1101
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1102
startOfLinesY
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1103
    "returns a sequencable list which keeps all the absolute Y-start positions
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1104
     for each line into the list. The first entry is the top Y inset.
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1105
    "
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1106
    ^ startOfLinesY
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1107
!
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1108
2640
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1109
xAbsoluteOfItem:anItem
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1110
    "returns the absolute x of the labeled text
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1111
    "
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1112
    ^ (self xVisibleOfItem:anItem) + viewOrigin x.
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1113
!
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1114
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1115
xVisibleOfItem:anItem
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1116
    "returns the visible x of the labeled text
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1117
    "
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1118
    ^ textStartLeft - viewOrigin x
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1119
!
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1120
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1121
yAbsoluteOfLine:aLineNr
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1122
    "given a lineNr, return y-coordinate absolute
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1123
    "
1744
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1124
    |y y2 y1 cash|
1446
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1125
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1126
    cash := self startOfLinesY.
1446
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1127
1744
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1128
    (y := cash at:aLineNr ifAbsent:nil) notNil ifTrue:[
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1129
        ^ y
1446
fb46beba2d0c startOfLines can have nil at end; lookup the first not nil
Claus Gittinger <cg@exept.de>
parents: 1444
diff changeset
  1130
    ].
1744
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1131
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1132
    "/ recompute a y position
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1133
    y1 := cash at:1 ifAbsent:2.
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1134
    y2 := cash at:2 ifAbsent:10.
1744
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1135
  ^ aLineNr * (y2 - y1) + y1
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1136
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1138
yVisibleOfLine:aLineNr
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1139
    "given a lineNr, return y-coordinate in view
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1140
    "
1744
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1141
    ^ (self yAbsoluteOfLine:aLineNr) - viewOrigin y
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1142
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1143
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1144
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1145
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1146
yVisibleToLineNr:yVisible
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1147
    "returns the line number assigned to a physical y or nil if out of list
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1148
    "
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1149
    |cash
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1150
     yAbs       "{ Class: SmallInteger}"
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1151
     size       "{ Class: SmallInteger}"
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1152
     ictr       "{ Class: SmallInteger}"
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1153
     yRun       "{ Class: SmallInteger}"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1154
    |
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1155
    cash := self startOfLinesY.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1156
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1157
    (size := cash size) < 2 ifTrue:[^ nil].   "/ empty list
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1158
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1159
    yAbs := yVisible + viewOrigin y.
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1160
    yRun := cash at:size.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1161
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1162
    yAbs >= yRun ifTrue:[
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1163
        yAbs == yRun ifTrue:[ ^ size - 1].
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1164
      ^ nil   "/ out of list
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1165
    ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1166
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1167
    constantHeight notNil ifTrue:[
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1168
        yAbs := yAbs - (cash at:1).
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1169
        yAbs < constantHeight ifTrue:[ ^ 1 ].
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1170
      ^ yAbs // constantHeight + 1
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1171
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1172
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1173
    ictr := yAbs // (cash at:2).
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1174
    ictr < 1 ifTrue:[ ictr := 1 ]
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1175
            ifFalse:[ ictr := ictr min:size ].
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1176
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1177
    yRun := cash at:ictr.
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1178
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1179
    yRun > yAbs ifTrue:[
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1180
        [(ictr := ictr - 1) > 0 ] whileTrue:[
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1181
            yRun := cash at:ictr.
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1182
            yRun <= yAbs ifTrue:[ ^ ictr ].
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1183
        ].
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1184
        ^ 1
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1185
    ].
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1186
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1187
    [ yRun ~~ yAbs ] whileTrue:[
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1188
        ictr := ictr + 1.
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1189
        yRun := cash at:ictr.
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1190
        yRun > yAbs ifTrue:[ ^ ictr - 1 ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1191
    ].
2301
ce583553d709 use constantHeight for computing #yVisibleToLineNr
ca
parents: 2274
diff changeset
  1192
    ^ ictr
2464
2fcd6ccdaa7b +yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1193
!
2fcd6ccdaa7b +yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1194
2fcd6ccdaa7b +yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1195
yVisibleToRowNr:yVisible
2fcd6ccdaa7b +yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1196
    "for protocol compatibility with DSVColumnView"
2fcd6ccdaa7b +yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1197
2fcd6ccdaa7b +yVisibleToRowNr: for protocol compatibility
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1198
    ^ self yVisibleToLineNr:yVisible
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1199
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1200
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1201
!ListModelView methodsFor:'protocol'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1202
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1203
fetchResources
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1204
    "fetch device colors and ..., to avoid reallocation at redraw time;
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1205
     *** called after a create or snapin to fetch all device resources
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1206
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1207
    fgColor    := self colorOnDevice:fgColor.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1208
    bgColor    := self colorOnDevice:bgColor.
2097
78bfd62fdcbc on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  1209
    font       := font onDevice:device.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1210
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1211
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1212
lineHeightFor:anItem
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1213
    "returns the computed line height for an item
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1214
    "
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1215
    ^ lineSpacing + (renderer heightFor:anItem)
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1218
listSizeChanged:anIndex nLines:noLines
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1219
    "list size changed; information is stored to recompute the
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1220
     width if required( preferredExtent, horizontal scroller ... ).
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1221
     see: widthOfContents
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1222
     *** if nLines is negative, lines are removed otherwise added.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1223
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1224
    |start "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1225
     stop  "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1226
     size  "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1227
    |
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1228
    preferredExtent := nil.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1230
    widthOfContents isNil ifTrue:[      "/ recompute whole list
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1231
        ^ self
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1232
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1233
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1234
    (noLines < 0 or:[(size := self size) <= noLines]) ifTrue:[
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1235
        widthOfContents := nil.         "/ force recompute whole list
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1236
        ^ self
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1237
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1238
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1239
    stop  := anIndex + noLines - 1.     "/ recompute a range
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1240
    start := anIndex.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1241
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1242
    computeWidthInRange notNil ifTrue:[
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1243
        start := computeWidthInRange y.
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1244
        stop  <  start ifTrue:[stop := start min:size].
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1245
        start := (computeWidthInRange x) min:anIndex.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1246
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1247
    computeWidthInRange := start@stop
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1248
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1249
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1250
lostSynchronisation
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1251
    "called when the changes derived from the model are faster than the handling
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1252
    "
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1253
    shown ifTrue:[
2302
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
  1254
        self recomputeHeightOfContents.
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
  1255
        self invalidate.
5a2a1d5d09f8 remove asynchronous handling of changes; always disabled because doesn't work
ca
parents: 2301
diff changeset
  1256
        self contentsChanged
1457
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1257
    ].
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1258
!
76491c5ae369 lostSynchronisation:
Claus Gittinger <cg@exept.de>
parents: 1456
diff changeset
  1259
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1260
newDefaultList
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1261
    "creates and returns a new default list class, on default a List
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1262
    "
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1263
    ^ List new
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1264
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1265
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
widthOfWidestLineBetween:firstLine and:lastLine
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1267
    "return the width in pixels of the widest line in a range
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
    "
2645
b3d3e7c3ee40 bugfix due to compilation (test SmallInteger for nil)
ca
parents: 2644
diff changeset
  1269
    |item width|
b3d3e7c3ee40 bugfix due to compilation (test SmallInteger for nil)
ca
parents: 2644
diff changeset
  1270
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1271
    width := renderer widthOfWidestLineBetween:firstLine and:lastLine.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1272
    width notNil ifTrue:[^ width].
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1273
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1274
    width := textStartLeft.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1275
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1276
    firstLine to:lastLine do:[:anIndex|
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1277
        item := self at:anIndex ifAbsent:nil.
1508
9c54f2e53da1 check whether #at:ifAbsent returns nil.
Claus Gittinger <cg@exept.de>
parents: 1457
diff changeset
  1278
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1279
        item isNil ifTrue:[^ width + textStartLeft].
1508
9c54f2e53da1 check whether #at:ifAbsent returns nil.
Claus Gittinger <cg@exept.de>
parents: 1457
diff changeset
  1280
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1281
        width := (renderer widthFor:item) max:width
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1282
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1283
    ^ width + textStartLeft
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1284
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1285
1820
9b17f0c15849 category change
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  1286
!ListModelView methodsFor:'queries'!
9b17f0c15849 category change
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  1287
2274
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1288
isLineVisible:aLineNr
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1289
    "returns true if the line is visible"
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1290
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1291
    ^ self isLineVisible:aLineNr in:self extent
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1292
!
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1293
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1294
isLineVisible:aLineNr in:anExtentPoint
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1295
    "returns true if the line is visible"
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1296
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1297
    |y|
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1298
    y := self yVisibleOfLine:aLineNr.
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1299
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1300
  ^ (y between:margin and:(anExtentPoint y - margin))
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1301
!
c973acbc021d only make selection visible after a resize, if it was visible before
ca
parents: 2265
diff changeset
  1302
1820
9b17f0c15849 category change
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  1303
size
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1304
    "returns the number of list entries
1820
9b17f0c15849 category change
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  1305
    "
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1306
    ^ self list size
1820
9b17f0c15849 category change
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  1307
! !
9b17f0c15849 category change
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  1308
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1309
!ListModelView methodsFor:'recomputation'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1310
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1311
preferredExtent
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1312
    "returns the preferred extent
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1313
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1314
    |x y|
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1315
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1316
    preferredExtent isNil ifTrue:[
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
  1317
	y := self heightOfContents.
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
  1318
	x := self widthOfContents.
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
  1319
	preferredExtent := x@y
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1320
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1321
  ^ preferredExtent
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1322
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1323
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1324
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1325
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1326
recomputeHeightOfContents
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1327
    "recompute all the y positions
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1328
    "
1643
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1329
    |newList
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1330
     yAbs "{ Class: SmallInteger }"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1331
     lnHg "{ Class: SmallInteger }"
1643
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1332
     size "{ Class: SmallInteger }"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1333
    |
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1334
1643
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1335
    yAbs    := startOfLinesY at:1.   "/ top inset of first line
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1336
    size    := self size.
1643
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1337
    newList := OrderedCollection new:(size + 1).
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1338
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1339
    newList add:yAbs.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1340
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1341
    size == 0 ifTrue:[
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1342
        startOfLinesY := newList.
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1343
        ^ self
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1344
    ].
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1345
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1346
    hasConstantHeight ifTrue:[
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1347
        constantHeight notNil ifTrue:[ lnHg := constantHeight ]
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1348
                             ifFalse:[ lnHg := self heightOfLineAt:1 ].
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
  1349
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1350
        1 to:size do:[:anIndex|
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1351
            newList add:(yAbs := yAbs + lnHg)
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1352
        ].
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1353
        startOfLinesY := newList.
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1354
        ^ self
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1355
    ].
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1356
1643
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1357
    1 to:size do:[:anIndex|
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1358
        lnHg := self heightOfLineAt:anIndex.
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1359
        newList add:(yAbs := yAbs + lnHg)
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1360
    ].
1643
cabafd70be77 checkin from browser
ps
parents: 1642
diff changeset
  1361
    startOfLinesY := newList.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1362
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1363
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1364
!ListModelView methodsFor:'scroller interface'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1365
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1366
getWidthOfContents
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1367
    ^ widthOfContents
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1368
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1369
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1370
heightOfContents
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1371
    "return the height of the contents in pixels
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1372
    "
2595
1ab5dc7d4796 create a default list; thus we have not to test for nil
ca
parents: 2569
diff changeset
  1373
    ^ self startOfLinesY last ? 0
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1374
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1375
2261
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1376
heightOfLineAt:aLineNr
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1377
    "returns the total height for a line at an index( including lineSpacing ... )
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1378
    "
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1379
    |item|
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1380
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1381
    hasConstantHeight ifTrue:[
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1382
        constantHeight notNil ifTrue:[ ^ constantHeight ].
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1383
        item := self at:1 ifAbsent:nil.
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1384
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1385
        item notNil ifTrue:[
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1386
            constantHeight := self lineHeightFor:item.
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1387
            ^ constantHeight
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1388
        ]
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1389
    ] ifFalse:[
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1390
        item := self at:aLineNr ifAbsent:nil.
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1391
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1392
        item notNil ifTrue:[
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1393
            ^ self lineHeightFor:item
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1394
        ]
2261
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1395
    ].
2264
0241177f2a2b *** empty log message ***
ca
parents: 2261
diff changeset
  1396
    ^ 4
2261
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1397
!
dd8a6eb74790 add #hasConstantHeight for optimization
ca
parents: 2257
diff changeset
  1398
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1399
innerHeight
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1400
    "returns the inner height of the contents shown
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1401
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1402
    ^ height - margin - margin
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1403
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1404
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1405
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1406
innerWidth
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1407
    "returns the inner width of the contents shown
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1408
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1409
    ^ width - margin - margin
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1410
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1411
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1412
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1413
maxViewOriginY
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1414
    "returns the maximum possible y of the view origin
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1415
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1416
    ^ (self heightOfContents - self innerHeight) max:0
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1419
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1420
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1421
setWidthOfContents: aWidth
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1422
    widthOfContents := aWidth.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1423
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1424
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1425
verticalScrollStep
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1426
    "return the amount to scroll when stepping up/down.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1427
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1428
    ^ 10
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1429
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1430
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1431
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1432
viewOrigin
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1433
    "return the viewOrigin; thats the coordinate of the contents 
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1434
     which is shown topLeft in the view.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1435
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1436
    ^ viewOrigin
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1437
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1438
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1439
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
widthOfContents
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1441
    "return the width of the contents in pixels
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1442
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1443
    |range
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1444
     size  "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1445
     start "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1446
     stop  "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1447
    |
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1448
    (widthOfContents notNil and:[computeWidthInRange isNil]) ifTrue:[
2384
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1449
        ^ widthOfContents + textStartLeft
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1450
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1451
    range               := computeWidthInRange.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1452
    computeWidthInRange := nil.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1453
    preferredExtent     := nil.
2384
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1454
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1455
    shown ifFalse:[ ^ 60 ].
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1456
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1457
    size := self size.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1458
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1459
    size == 0 ifTrue:[
2384
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1460
        widthOfContents := 20.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1461
    ] ifFalse:[
2384
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1462
        widthOfContents isNil ifTrue:[
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1463
            widthOfContents := self widthOfWidestLineBetween:1 and:size
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1464
        ] ifFalse:[
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1465
            start := range x.
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1466
            stop  := range y min:size.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1467
2384
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1468
            start > stop ifFalse:[
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1469
                size := self widthOfWidestLineBetween:start and:stop.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1470
2384
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1471
                widthOfContents < size ifTrue:[
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1472
                    widthOfContents := size
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1473
                ]
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1474
            ]
44fbf84cfb22 validate widthOfContents if visible
ca
parents: 2367
diff changeset
  1475
        ]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1476
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1477
    ^ widthOfContents + textStartLeft
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1478
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1479
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1480
xOriginOfContents
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1481
    "return the horizontal origin of the contents in pixels
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1482
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
    ^ viewOrigin x 
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1484
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1485
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1486
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1487
yOriginOfContents
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1488
    "return the vertical origin of the contents in pixels
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1489
    "
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1490
    ^ viewOrigin y
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1491
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1492
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1493
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1494
!ListModelView methodsFor:'scrolling'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1495
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1496
halfPageDown
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1497
    "scroll down half a page
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1498
    "
1827
54e8a0fc8a42 scrollWhenUpdating
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
  1499
    self scrollDown:(height // 2).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1500
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1501
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1502
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1503
halfPageUp
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1504
    "scroll up half a page
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1505
    "
1827
54e8a0fc8a42 scrollWhenUpdating
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
  1506
    self scrollUp:(height // 2).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1507
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1508
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1509
2367
69f8b4d73f5d add #makeLineVisible:
ca
parents: 2352
diff changeset
  1510
makeLineVisible:aLnNr
69f8b4d73f5d add #makeLineVisible:
ca
parents: 2352
diff changeset
  1511
    "make the line visible
69f8b4d73f5d add #makeLineVisible:
ca
parents: 2352
diff changeset
  1512
    "
69f8b4d73f5d add #makeLineVisible:
ca
parents: 2352
diff changeset
  1513
    aLnNr notNil ifTrue:[
69f8b4d73f5d add #makeLineVisible:
ca
parents: 2352
diff changeset
  1514
        self scrollToLine:aLnNr
69f8b4d73f5d add #makeLineVisible:
ca
parents: 2352
diff changeset
  1515
    ].
69f8b4d73f5d add #makeLineVisible:
ca
parents: 2352
diff changeset
  1516
!
69f8b4d73f5d add #makeLineVisible:
ca
parents: 2352
diff changeset
  1517
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1518
scrollTo:anOrigin redraw:doRedraw
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1519
    "change origin to have newOrigin be visible at the top-left.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1520
    "
1538
ef0eea7c074a check for windowGroup
Claus Gittinger <cg@exept.de>
parents: 1535
diff changeset
  1521
    |newOrg dltOrg winGrp
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1522
     innerWT    "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1523
     innerHG    "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1524
     h          "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1525
     x          "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1526
     x0         "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1527
     x1         "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1528
     y          "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1529
     w          "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1530
     y0         "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1531
     y1         "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1532
     dX         "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1533
     dY         "{ Class:SmallInteger }"
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1534
    |
1531
42dcb9760f0f checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1508
diff changeset
  1535
1580
523119ab4e30 scrollTo:anOrigin redraw:doRedraw
ca
parents: 1566
diff changeset
  1536
    realized ifFalse:[
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1537
        ^ self
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1538
    ].
1580
523119ab4e30 scrollTo:anOrigin redraw:doRedraw
ca
parents: 1566
diff changeset
  1539
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1540
    innerWT := self innerWidth.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1541
    innerHG := self innerHeight.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1542
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1543
    h := viewOrigin y.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1544
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1545
    (y := anOrigin y) > h ifTrue:[              "/ end of contents
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1546
        y > (dY := self maxViewOriginY) ifTrue:[
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1547
            y := dY max:h
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1548
        ]
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1549
    ] ifFalse:[
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1550
        y := y max:0.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1551
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1552
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1553
    (x := anOrigin x) > 0 ifTrue:[
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1554
        x := x min:(self widthOfContents - innerWT).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1555
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1556
    x      := x max:0.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1557
    newOrg := (x @ y).
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1558
    dltOrg := newOrg - viewOrigin.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1559
    dX     := dltOrg x.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1560
    dY     := dltOrg y.
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1561
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1562
    (dX == 0 and:[dY == 0]) ifTrue:[
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1563
        ^ self
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1564
    ].
1534
8c4272e42539 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1532
diff changeset
  1565
    dY := dY abs.
8c4272e42539 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1532
diff changeset
  1566
    dX := dX abs.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1567
1534
8c4272e42539 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1532
diff changeset
  1568
    (   (dX ~~ 0 and:[dY ~~ 0])                         "/ scroll vertical & horizontal
8c4272e42539 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1532
diff changeset
  1569
     or:[(innerHG - dY < 20 or:[innerWT - dX < 20])]    "/ faster to invalidate screen
8c4272e42539 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1532
diff changeset
  1570
    ) ifTrue:[
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1571
        viewOrigin := newOrg.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1572
        self originChanged:dltOrg.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
  1573
        self invalidate.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
  1574
        ^ self
1534
8c4272e42539 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1532
diff changeset
  1575
    ].
1753
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1576
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1577
    (winGrp := self windowGroup) notNil ifTrue:[
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1578
        winGrp processRealExposeEventsFor:self.
1753
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1579
    ].
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1580
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1581
    self originWillChange.
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1582
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1583
    doRedraw ifFalse:[
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1584
        viewOrigin := newOrg.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
  1585
        self originChanged:dltOrg.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2645
diff changeset
  1586
        ^ self 
1753
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1587
    ].
17769f8df493 #scrollTo:redraw: first check whether full invalidate otherwise processRealExposeEventsFor:
ca
parents: 1752
diff changeset
  1588
1531
42dcb9760f0f checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1508
diff changeset
  1589
    self catchExpose.
42dcb9760f0f checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1508
diff changeset
  1590
    viewOrigin := newOrg.
42dcb9760f0f checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1508
diff changeset
  1591
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1592
    dY ~~ 0 ifTrue:[                            "/ SCROLL VERTICAL
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1593
        y0 := y1 := margin + dY.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1594
        h  := innerHG - dY.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1595
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1596
        dltOrg y < 0 ifTrue:[y0 := margin. y := y0]
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1597
                    ifFalse:[y1 := margin. y := y1 + h].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1598
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1599
        self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:true.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1600
        self invalidateX:margin y:y width:innerWT height:(innerHG - h).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1601
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1602
    ] ifFalse:[                                 "/ SCROLL HORIZONTAL
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1603
        x0 := x1 := dX + margin.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1604
        w  := innerWT - dX.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1605
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1606
        dltOrg x < 0 ifTrue:[x0 := x := margin ]
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1607
                    ifFalse:[x1 := margin. x := w].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1608
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1609
        self copyFrom:self x:x0 y:margin toX:x1 y:margin width:w height:innerHG async:true.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1610
        self invalidateX:x y:margin width:(width - w) height:innerHG.
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1611
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1612
    self originChanged:dltOrg.
1531
42dcb9760f0f checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1508
diff changeset
  1613
    self waitForExpose.
42dcb9760f0f checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1508
diff changeset
  1614
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1615
    winGrp notNil ifTrue:[
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1616
        winGrp processRealExposeEventsFor:self.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2408
diff changeset
  1617
    ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1618
!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1619
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1620
scrollToLine:aLineNumber
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1621
    "make line visible
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1622
    "
1744
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1623
    |inHg "{ Class:SmallInteger }"
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1624
     yTop "{ Class:SmallInteger }"
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1625
     orgY "{ Class:SmallInteger }"
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1626
     yBot "{ Class:SmallInteger }"
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1627
    |
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1628
    (shown and:[aLineNumber notNil and:[aLineNumber between:1 and:(self size)]]) ifFalse:[
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1629
        ^ self
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1630
    ].
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1631
1744
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1632
    yTop := self yAbsoluteOfLine:aLineNumber.
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1633
    inHg := self innerHeight.
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1634
    orgY := viewOrigin y.
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1635
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1636
    yTop > orgY ifTrue:[
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1637
        yBot := self yAbsoluteOfLine:(aLineNumber + 1).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1638
2408
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1639
        yBot <= (orgY + inHg) ifTrue:[
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1640
            ^ self
8b0d11537dc0 accessing list indirect
ca
parents: 2385
diff changeset
  1641
        ].
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1642
    ].
1744
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1643
    yTop := (yTop - (inHg // 2)) max:0.
2447f4a3dd7c computation of absoluteY for a line
ca
parents: 1743
diff changeset
  1644
    self scrollTo:(viewOrigin x @ yTop).
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1645
! !
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1646
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1647
!ListModelView methodsFor:'scrolling auto'!
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1648
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1649
startAutoScroll:aSelectorOrBlock distance:aDistance
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1650
    "setup for auto-scroll (when button-press-moving below/above view);
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1651
     - timeDelta for scroll is computed from distance
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1652
    "
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1653
    |timeDelta scrollBlock|
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1654
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1655
    autoScroll ifFalse:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1656
        self stopAutoScroll.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1657
        ^ self
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1658
    ].
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1659
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1660
    autoScrollBlock notNil ifTrue:[
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1661
        Processor removeTimedBlock:autoScrollBlock.
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1662
    ] ifFalse:[
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1663
        self compressMotionEvents:false.
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1664
    ].
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1665
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1666
    timeDelta := 0.5 / (aDistance abs).
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1667
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1668
    scrollBlock := 
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1669
        [
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1670
            aSelectorOrBlock isSymbol ifTrue:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1671
                self perform:aSelectorOrBlock.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1672
            ] ifFalse:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1673
                aSelectorOrBlock value
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1674
            ].
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1675
            autoScrollBlock notNil ifTrue:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1676
                Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1677
            ]
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1678
        ].
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1679
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
  1680
    autoScrollBlock := [self sensor pushUserEvent:#value for:scrollBlock].
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1681
    Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1682
!
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1683
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1684
stopAutoScroll
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1685
    "stop any autoScroll
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1686
    "
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1687
    autoScrollBlock notNil ifTrue:[
2265
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
  1688
	Processor removeTimedBlock:autoScrollBlock.
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
  1689
	autoScrollBlock := nil.
5304bdf0f8e2 *** empty log message ***
ca
parents: 2264
diff changeset
  1690
	self compressMotionEvents:true.
1748
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1691
    ].
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1692
! !
0a2213a15e06 support of auto scrolling
ca
parents: 1744
diff changeset
  1693
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1694
!ListModelView methodsFor:'selection'!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1695
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1696
hasSelection
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1697
    "on default false is returned
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1698
    "
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1699
    ^ false
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1700
! !
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1701
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1702
!ListModelView::Renderer class methodsFor:'documentation'!
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1703
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1704
documentation
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1705
"
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1706
    prepared for ListItemRenderer
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1707
    .... SelectionItemRenderer ...
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1708
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1709
    goal:
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1710
        allow the user to redefine the display operation and the dimesion queries
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1711
"
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1712
! !
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1713
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1714
!ListModelView::Renderer class methodsFor:'instance creation'!
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1715
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1716
forView:aView
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1717
    |renderer|
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1718
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1719
    renderer := self basicNew initialize.
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1720
    renderer forView:aView.
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1721
    ^ renderer
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1722
! !
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1723
2640
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1724
!ListModelView::Renderer methodsFor:'change & update'!
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1725
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1726
listWillChange
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1727
    "called before the list changed, clear cashes ect.
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1728
     here nothing is done
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1729
    "
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1730
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1731
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1732
withinUpdateFromListDo:aBlock
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1733
    "handle an update from the list
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1734
    "
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1735
    aBlock value
2640
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1736
! !
2855d7e55d43 inform renderere if list changed
ca
parents: 2605
diff changeset
  1737
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1738
!ListModelView::Renderer methodsFor:'displaying'!
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1739
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1740
display:anItem atX:xLeft y:yTop lineHeight:h
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1741
    "display the item on the view
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1742
    "
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1743
    |x0 y0 label|
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1744
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1745
    x0 := xLeft.
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1746
    y0 := yTop.
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1747
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1748
    anItem isHierarchicalItem ifTrue:[
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1749
        anItem displayOn:view x:x0 y:y0 h:h
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1750
    ] ifFalse:[
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1751
        anItem isNil ifTrue:[^ self].
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1752
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1753
        y0    := y0 - ((self heightFor:anItem) + 1 - h // 2).
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1754
        label := anItem.
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1755
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1756
        label isImageOrForm ifFalse:[
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1757
            label isNumber ifTrue:[
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1758
                label := label printString
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1759
            ].
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1760
            y0 := y0 + view font ascent
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1761
        ].
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1762
        label displayOn:view x:x0 y:y0
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1763
    ].
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1764
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1765
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1766
postRedrawX:damageX y:yStartOrYDamage w:damageWidth from:startOrNil to:stopOrNil
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1767
    "called after redraw of the items in range from start to stop is done;
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1768
     if no items are damaged, start and stop is set to nil.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1769
    "
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1770
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1771
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1772
validateDrawableItemsFrom:start to:stop
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1773
    "called before drawing items from start to stop; if the method returns false
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1774
     nothing will be drawn and a invalidate is pushed on the event queue.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1775
     On default true is returned.
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1776
    "
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1777
    ^ true
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1778
! !
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1779
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1780
!ListModelView::Renderer methodsFor:'instance creation'!
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1781
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1782
forView:aView
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1783
    view := aView.
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1784
    view shown ifTrue:[ self mapped ].
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1785
!
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1786
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1787
mapped
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1788
    "called if the view is mapped; can be redefined by subclass
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1789
    "
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1790
!
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1791
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1792
release
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1793
    "called if the view is gone; can be redefined by subclass
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1794
    "
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1795
! !
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1796
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1797
!ListModelView::Renderer methodsFor:'queries-behavior'!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1798
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1799
autoScrollHorizontal
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1800
    "returns true if automatic scrolling horizontal
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1801
     is allowed (the default is true).
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1802
    "
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1803
    ^ true
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1804
! !
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1805
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1806
!ListModelView::Renderer methodsFor:'queries-dimensions'!
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1807
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1808
heightFor:anItem
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1809
    "returns the height of an item on the view
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1810
    "
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1811
    ^ anItem heightOn:view
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1812
!
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1813
2643
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1814
maxItemWidthOrNil
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1815
    "returns the maximum item width for drawing or nil
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1816
     if unspecified (the default); used for cliping
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1817
    "
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1818
    ^ nil
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1819
!
8db56678dc19 prepared for table
ca
parents: 2640
diff changeset
  1820
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1821
widthFor:anItem
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1822
    "returns the width of an item on the view
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1823
    "
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1824
    ^ anItem widthOn:view
2644
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1825
!
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1826
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1827
widthOfWidestLineBetween:firstLine and:lastLine
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1828
    "returns the width of the longest line in pixels in a range; if the rendere
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1829
     cannot compute the width, nil is returned (the default).
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1830
    "
78ca3bd5eef1 prepared for table
ca
parents: 2643
diff changeset
  1831
    ^ nil
2352
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1832
! !
c4610dae596e prepared for ListItemRenderer
ca
parents: 2329
diff changeset
  1833
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1834
!ListModelView class methodsFor:'documentation'!
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1835
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1836
version
2745
5986c83276b1 clean up obfuscated code
Stefan Vogel <sv@exept.de>
parents: 2708
diff changeset
  1837
    ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.96 2004-09-20 10:33:52 stefan Exp $'
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1838
! !
2244
c9a195d28e72 change #redrawLineAt: to #invalidateLineAt: (because is a invalidate)
ca
parents: 2188
diff changeset
  1839
1390
62dc950b9140 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1840
ListModelView initialize!