ListView.st
author Stefan Vogel <sv@exept.de>
Fri, 26 Sep 2014 12:25:34 +0200
branchdelegated_gc
changeset 5132 045af422a364
parent 5023 a18a03c5c572
child 5154 b8ffbe20c669
permissions -rw-r--r--
class: ListView changed: #initStyle
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     1
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     4
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    10
 hereby transferred.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    11
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libwidg' }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    13
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    14
View subclass:#ListView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'list firstLineShown nFullLinesShown nLinesShown fgColor bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    16
		partialLines leftMargin topMargin textStartLeft textStartTop
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    17
		innerWidth tabPositions lineSpacing fontHeight fontAscent
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    18
		fontIsFixedWidth fontWidth autoScroll autoScrollBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    19
		autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    20
		listMsg viewOrigin listChannel backgroundAlreadyClearedColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    21
		scrollWhenUpdating scrollLocked lineEndCRLF highlightAreas
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    22
		compareModelOnUpdate expandTabsWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    23
		checkLineEndConventionWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    24
		checkedLinesForWidthOfContentsComputation'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    25
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    26
		UserDefaultTabPositions DefaultLeftMargin DefaultTopMargin'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    27
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    28
	category:'Views-Text'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    29
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    30
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    31
Object subclass:#HighlightArea
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    32
	instanceVariableNames:'startLine startCol endLine endCol fgColor bgColor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    33
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    34
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    35
	privateIn:ListView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    36
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    37
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    38
Object subclass:#SearchSpec
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    39
	instanceVariableNames:'pattern match ignoreCase variable fullWord forward'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    40
	classVariableNames:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    41
	poolDictionaries:''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    42
	privateIn:ListView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    43
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    44
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    45
!ListView class methodsFor:'documentation'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    46
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    47
copyright
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    48
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    49
 COPYRIGHT (c) 1989 by Claus Gittinger
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    50
	      All Rights Reserved
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    51
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    52
 This software is furnished under a license and may be used
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    53
 only in accordance with the terms of that license and with the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    54
 inclusion of the above copyright notice.   This software may not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    55
 be provided or otherwise made available to, or used by, any
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    56
 other person.  No title to or ownership of the software is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    57
 hereby transferred.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    58
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    59
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    60
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    61
documentation
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    62
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    63
    a View for (string-)lists.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    64
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    65
    This class can only passively display collections of strings,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    66
    text or display objects which behave line-like (i.e. all have constant height).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    67
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    68
    Selections, editing, cursors etc. must be implemented in subclasses.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    69
    (see SelectionInListView, TextView etc.)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    70
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    71
    This code currently handles only fixed-height fonts correctly -
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    72
    it should be rewritten in some places to not compute the position/height from
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    73
    the view's font height, but by accumulating line heights...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    74
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    75
    It can only scroll by full lines vertically (i.e. setting firstLineShown to ~~ 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    76
    which should be changed to have this behavior optionally for smooth scroll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    77
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    78
    The text is internally kept in the 'list' instance variable, and is supposed to consist
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    79
    of a collection (Ordered- or StringCollection) of line entries.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    80
    Typically, individual entries are either strings/text or nil (for empty lines).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    81
    However, ANY object which supports the displayOn: and widthIn: protocol can be
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    82
    used - see MultipleColumnListEntry as an example.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    83
    Therefore, ListView (and all subclasses) are prepared to handle non-string entries
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    84
    (especially: attributed Text and labelAndIcon-like entities).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    85
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    86
    The internal version of the text has tabulators expanded to blanks. ListView is not prepared
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    87
    to deal with them. When text is exchanged with an external medium (i.e. reading/writing files), 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    88
    these are expanded/compressed assuming a tab-setting of 8. 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    89
    This is done independent of the user's tab setting, which is used ONLY for positioning,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    90
    while the text is edited. 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    91
    Thus, even if the tab setting is multiple of 4's, tabs are
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    92
    written in multiples of 8 when the text is saved. Since this is the default on all ascii
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    93
    terminals and printers, this assures that the text looks correctly indented when finally printed.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    94
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    95
    Notice:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    96
    -------
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    97
    ListView is one of the OLDEST widget classes in the system and definitely requires a major rewrite:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    98
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
    99
    Due to historic reasons (ListView implemented scrolling before the general
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   100
    scrolling code in View was added), this one does scrolling different from all other
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   101
    views. The general scrolling code (in View) uses the transformation for transparent scrolling
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   102
    using the viewOrigin (transparent means, that the code does not need to know - it simply draws
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   103
    as if all of the text was visible).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   104
    Here in ListView, the transformation is not used, instead it is done again, and different, 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   105
    by keeping the firstLineShown (i.e. vertical offset) and leftOffset (horizontal offset).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   106
    Even worse: the firstLineShown is a line-index, the most annoying consequence of this is that 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   107
    scrolling is done by lines here, whereas it is done in pixels in the View class. 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   108
    Thus, be very careful, when changing things (better: don't touch it ;-). 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   109
    Also, the viewOrigin variable is only valid for the x coordinate. The viewOrigin's y is always 0 !!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   110
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   111
    Also, all controller functionality is completely performed by the listView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   112
    (and subclasses) itself. It is still possible, to define and set a specialized
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   113
    controller, though. I.e. if you like to change the input behavior, define
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   114
    a corresponding controller class and intersect the keyXXX/buttonXXX messages
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   115
    there.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   116
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   117
    This may be totally rewritten ... so don't depend on the internals; especially the scrolling
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   118
    code will be totally removed here and the inherited functionality be used in the next version.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   119
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   120
    Also Notice:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   121
    ------------
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   122
    because ListView was written at a time when most of the graphics was done via remote connections
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   123
    (X-window network protocol), it is highly tuned to avoid redraw operations. Thus, it can be used
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   124
    happily over a slow WLAN (say: 64kBit connection).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   125
    In that, it performed *much* better than other widgets, especialy Java and Qt, some of which are
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   126
    hardly usable via the network.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   127
    It may be questionable whether this is still a requirement these days, where network connections
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   128
    are usually pretty fast. However, the author insists on this to remain as it is!!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   129
    Future underlying graphics may well become network dependent in the future, for example, when
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   130
    the display connection is implemented as an RPC into a web browser...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   131
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   132
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   133
    Also Notice:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   134
    ------------
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   135
    ListView shall be configurable to avoid accesses to its underlying list if required.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   136
    Currently, it can be customized to disable lineWidth computation, tab expansion and scanning for
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   137
    non-string entries. All of which is required when huge texts which are not in memory are to be displayed
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   138
    (for example: a virtual array of 10million text lines). Please be careful to not reintroduce such
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   139
    code when adding features (as happened in the past).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   140
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   141
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   142
    [Instance variables:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   143
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   144
      list                <aCollection>           the text strings, a collection of lines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   145
                                                  Nils may be used for empty lines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   146
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   147
      firstLineShown      <Number>                the index of the 1st visible line (1 ..)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   148
      leftOffset          <Number>                left offset for horizontal scroll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   149
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   150
      nFullLinesShown     <Number>                the number of unclipped lines in visible area
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   151
                                                  (internal; updated on size changes)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   152
      nLinesShown         <Number>                the number of lines in visible area, incl. partial
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   153
                                                  (internal; updated on size changes)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   154
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   155
      fgColor             <Color>                 color to draw characters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   156
      bgColor             <Color>                 the background
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   157
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   158
      partialLines        <Boolean>               allow last line to be partial displayed
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   159
      leftMargin          <Number>                margin at left in pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   160
      topMargin           <Number>                margin at top in pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   161
      textStartLeft       <Number>                margin + leftMargin (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   162
      textStartTop        <Number>                margin + topMargin (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   163
      innerWidth          <Number>                width - margins (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   164
      tabPositions        <aCollection>           tab stops (cols)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   165
      fontHeight          <Number>                font height in pixels (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   166
      fontAscent          <Number>                font ascent in pixels (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   167
      fontIsFixed         <Boolean>               true if its a fixed font (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   168
      fontWidth           <Number>                width of space (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   169
      lineSpacing         <Number>                pixels between lines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   170
      lastSearchPattern   <String>                last pattern for searching
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   171
                                                  (kept to provide a default for next search)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   172
      lastSearchIgnoredCase   <Boolean>           last search ignored case
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   173
                                                  (kept to provide a default for next search)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   174
      wordCheck           <Block>                 rule used for check for word boundaries in word select
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   175
                                                  The default rule is to return true for alphaNumeric characters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   176
                                                  (can be changed to allow for underscore and other
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   177
                                                   characters to be treated as alphaCharacters)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   178
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   179
      autoScrollBlock     <Block>                 block installed as timeoutBlock when doing an
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   180
                                                  autoScroll (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   181
      autoScrollDeltaT                            computed scroll time delta in seconds (internal)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   182
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   183
      includesNonStrings                          cached flag if any non-strings are in list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   184
      widthOfWidestLine                           cached width of widest line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   185
      listMsg                                     if view has a model and listMsg is non-nil,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   186
                                                  this is sent to the model to aquired a new contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   187
                                                  whenever a change of the aspect  (aspectMsg) occurs.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   188
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   189
      viewOrigin                                  the current origin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   190
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   191
      backgroundAlreadyClearedColor               internal; speedup by avoiding
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   192
                                                  multiple fills when drawing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   193
                                                  internal lines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   194
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   195
      scrollWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   196
                                <Symbol>        defines how the view is scrolled if the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   197
                                                model changes its value by some outside activity
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   198
                                                (i.e. not by user input).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   199
                                                Can be one of:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   200
                                                    #keep / nil     -> stay unchanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   201
                                                    #endOfText      -> scroll to the end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   202
                                                    #beginOfText    -> scroll to the top
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   203
                                                The default is #beginOfText (i.e. scroll to top).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   204
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   205
    [StyleSheet parameters:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   206
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   207
      textForegroundColor                         defaults to Black
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   208
      textBackgroundColor                         defaults to White
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   209
      textFont                                    defaults to defaultFont
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   210
      textTabPositions                            defaults to #(1 9 17 25 ...)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   211
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   212
    [author:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   213
        Claus Gittinger
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   214
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   215
    [see also:]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   216
        TextView EditTextView
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   217
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   218
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   219
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   220
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   221
examples
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   222
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   223
    ListViews alone are rarely used - its mostly an abstract superclass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   224
    for TextView, EditTextView and SelectionInListView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   225
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   226
    anyway, here are a few examples:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   227
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   228
     basic simple setup:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   229
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   230
        |top l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   231
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   232
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   233
        top extent:100@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   234
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   235
        l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   236
        l list:#('one' 'two' 'three').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   237
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   238
        top open
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   239
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   240
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   241
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   242
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   243
      specifying textMargins (these have NOTHING to do with the viewInset):
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   244
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   245
        |top l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   246
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   247
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   248
        top extent:100@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   249
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   250
        l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   251
        l list:#('one' 'two' 'three').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   252
        l topMargin:10.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   253
        l leftMargin:20.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   254
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   255
        top open
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   256
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   257
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   258
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   259
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   260
      globally set the fg/bg colors:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   261
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   262
        |top l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   263
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   264
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   265
        top extent:100@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   266
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   267
        l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   268
        l list:#('one' 'two' 'three').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   269
        l foregroundColor:(Color white).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   270
        l backgroundColor:(Color blue).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   271
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   272
        top open
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   273
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   274
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   275
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   276
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   277
      non-string (text) entries:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   278
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   279
        |top list l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   280
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   281
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   282
        top extent:100@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   283
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   284
        l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   285
        list := #('all' 'of' 'your' 'preferred' 'colors')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   286
                with:#(red green blue 'orange' cyan)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   287
                collect:[:s :clr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   288
                            Text string:s
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   289
                                 emphasis:(Array with:#bold
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   290
                                                 with:(#color->(Color name:clr))) ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   291
        l list:list.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   292
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   293
        top open
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   294
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   295
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   296
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   297
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   298
      generic non-string entries:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   299
      (notice: ColoredListEntry is obsoleted by Text)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   300
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   301
        |top list l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   302
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   303
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   304
        top extent:100@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   305
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   306
        l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   307
        list := #('all' 'of' 'your' 'preferred' 'colors')
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   308
                with:#(red green blue 'orange' cyan)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   309
                collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   310
        l list:list.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   311
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   312
        top open
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   313
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   314
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   315
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   316
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   317
      using a model (default listMessage is aspectMessage):
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   318
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   319
        |top model l theModelsText|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   320
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   321
        model := Plug new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   322
        model respondTo:#modelsAspect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   323
                   with:[ theModelsText ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   324
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   325
        top := StandardSystemView new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   326
        top extent:100@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   327
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   328
        l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   329
        l model:model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   330
        l aspect:#modelsAspect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   331
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   332
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   333
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   334
        Delay waitForSeconds:3.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   335
        theModelsText := #('foo' 'bar' 'baz').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   336
        model changed:#modelsAspect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   337
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   338
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   339
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   340
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   341
      using a model with different aspects
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   342
      for two listViews:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   343
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   344
        |top model l1 l2 plainText|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   345
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   346
        plainText := #('').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   347
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   348
        model := Plug new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   349
        model respondTo:#modelsUppercaseText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   350
                   with:[ plainText asStringCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   351
                              collect:[:l | l asUppercase]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   352
        model respondTo:#modelsLowercaseText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   353
                   with:[ plainText asStringCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   354
                              collect:[:l | l asLowercase]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   355
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   356
        top := StandardSystemView extent:200@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   357
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   358
        l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   359
        l1 model:model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   360
        l1 aspect:#modelsAspect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   361
        l1 listMessage:#modelsUppercaseText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   362
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   363
        l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   364
        l2 model:model.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   365
        l2 aspect:#modelsAspect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   366
        l2 listMessage:#modelsLowercaseText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   367
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   368
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   369
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   370
        Delay waitForSeconds:3.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   371
        plainText := #('foo' 'bar' 'baz').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   372
        model changed:#modelsAspect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   373
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   374
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   375
      using a big list (100000 lines),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   376
      wrapping in a ScrollableView:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   377
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   378
        |bigList top lv|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   379
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   380
        bigList := (1 to:100000) collect:[:lineNr | 'List line Nr. ' , lineNr printString].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   381
        bigList at:10 put:('Some Text ' asText , 'with Bold part' allBold).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   382
        bigList at:20 put:('Some Text ' asText , 'with Italic part' allItalic).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   383
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   384
        top := StandardSystemView extent:200@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   385
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   386
        lv := HVScrollableView for:ListView in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   387
        lv origin:0.0 @ 0.0 corner:1.0 @ 1.0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   388
        lv list:bigList expandTabs:false scanForNonStrings:false includesNonStrings:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   389
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   390
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   391
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   392
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   393
      using a huge virtual list (1 mio simulated lines),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   394
      wrapping in a ScrollableView:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   395
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   396
        |virtualList top lv|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   397
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   398
        virtualList := Plug new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   399
        virtualList inheritFrom:SequenceableCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   400
        virtualList respondTo:#size with:[ 1000000 ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   401
        virtualList respondTo:#at:  with:[:lineNr | 'List line Nr. ' , lineNr printString ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   402
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   403
        top := StandardSystemView extent:200@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   404
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   405
        lv := ScrollableView for:ListView in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   406
        lv origin:0.0 @ 0.0 corner:1.0 @ 1.0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   407
        lv list:virtualList expandTabs:false scanForNonStrings:false includesNonStrings:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   408
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   409
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   410
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   411
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   412
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   413
      using a huge virtual array (1 mio simulated lines),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   414
      wrapping in a ScrollableView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   415
      To simulate an expensive computation, a delay is planted into the line generator;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   416
      Startup and display of page full of lines should not take longer than the number of lines shown:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   417
                                                                        [exBegin]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   418
        |virtualList top lv|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   419
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   420
        virtualList := VirtualArray new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   421
        virtualList 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   422
            setSize:1000000; 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   423
            generator:[:index | Transcript showCR:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   424
                                Delay waitForSeconds:0.5.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   425
                                '%1 -> %2' bindWith:index with:index squared].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   426
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   427
        top := StandardSystemView extent:200@200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   428
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   429
        lv := ScrollableView for:ListView in:top.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   430
        lv origin:0.0 @ 0.0 corner:1.0 @ 1.0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   431
        lv expandTabsWhenUpdating:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   432
        lv checkLineEndConventionWhenUpdating:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   433
        lv checkedLinesForWidthOfContentsComputation:-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   434
        lv list:virtualList.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   435
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   436
        top open.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   437
                                                                        [exEnd]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   438
"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   439
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   440
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   441
!ListView class methodsFor:'defaults'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   442
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   443
defaultTabPositions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   444
    "return an array containing the styleSheets default tab positions"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   445
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   446
    ^ DefaultTabPositions ? self tab4Positions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   447
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   448
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   449
defaultTabPositions:aVector
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   450
    "set the array containing the styleSheets tab positions"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   451
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   452
    DefaultTabPositions := aVector
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   453
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   454
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   455
     ListView defaultTabPositions:(ListView tab4Positions)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   456
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   457
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   458
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   459
tab4Positions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   460
    "return an array containing tab positions for 4-col tabs"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   461
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   462
    ^ #(1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   463
	85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   464
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   465
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   466
tab8Positions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   467
    "return an array containing tab positions for 8-col tabs"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   468
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   469
    ^ #(1 9 17 25 33 41 49 57 65 73 81 89 97 105 113 121 129 137 145)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   470
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   471
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   472
updateStyleCache
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   473
    "extract values from the styleSheet and cache them in class variables"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   474
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   475
    <resource: #style (#'text.foregroundColor' #'text.backgroundColor'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   476
                       #'text.tabPositions'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   477
                       #'text.font')>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   478
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   479
    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Color black.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   480
    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:Color white.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   481
    DefaultFont := StyleSheet fontAt:'text.font'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   482
    DefaultTabPositions := StyleSheet at:'text.tabPositions'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   483
    DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   484
    DefaultLeftMargin := 0.5.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   485
    DefaultTopMargin := 0.5.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   486
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   487
    "Modified: 20.10.1997 / 15:05:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   488
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   489
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   490
userDefaultTabPositions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   491
    "return an array containing the users default tab positions"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   492
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   493
    ^ UserDefaultTabPositions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   494
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   495
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   496
userDefaultTabPositions:aVector
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   497
    "set the array containing the users tab positions"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   498
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   499
    UserDefaultTabPositions := aVector
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   500
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   501
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   502
     self userDefaultTabPositions:(self tab4Positions)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   503
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   504
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   505
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   506
!ListView methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   507
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   508
innerHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   509
    "return the number of pixels visible of the contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   510
     - redefined since ListView adds another margin to start the text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   511
     somewhat to indented from the 3D border."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   512
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   513
    ^ height - (2 * margin) - topMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   514
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   515
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   516
!ListView methodsFor:'accessing-behavior'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   517
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   518
checkLineEndConventionWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   519
    "return the line-end convention check when updating behavior.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   520
     If true (the default), the first line of the list given is checked for having a
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   521
     cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   522
     If false, the lineEndCRLF remains as specified by the user.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   523
     You may want to disable this flag if it is very expensive to generate a line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   524
     (although, only the very first line is checked, anyway)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   525
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   526
    ^ checkLineEndConventionWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   527
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   528
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   529
checkLineEndConventionWhenUpdating:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   530
    "define the line-end convention check when updating behavior.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   531
     If true (the default), the first line of the list given is checked for having a
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   532
     cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   533
     If false, the lineEndCRLF remains as specified by the user.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   534
     You may want to disable this flag if it is very expensive to generate a line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   535
     (although, only the very first line is checked, anyway)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   536
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   537
    checkLineEndConventionWhenUpdating := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   538
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   539
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   540
checkedLinesForWidthOfContentsComputation
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   541
    "return which lines to consider in the widthOfContents computation,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   542
     which is needed by the scrollBar interface.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   543
     If nil (the default), all lines are processed and the width of the longest line is taken.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   544
     If positive, that number of lines is checked near the start of the text,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   545
     if negative, from the end of the text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   546
     If 0, the width is dynamically re adjusted, as lines are drawn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   547
     You may want to change this to 1 if it is guaranteed that all linesa are of the same width,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   548
     or -1, if all are shorter than the last line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   549
     (useful, for example, when it is very expensive to generate all lines, and a huge number
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   550
     of same-width lines is generated through a virtual array)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   551
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   552
    ^ checkedLinesForWidthOfContentsComputation
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   553
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   554
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   555
checkedLinesForWidthOfContentsComputation:aNumberOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   556
    "set which lines to consider in the widthOfContents computation,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   557
     which is needed by the scrollBar interface.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   558
     If nil (the default), all lines are processed and the width of the longest line is taken.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   559
     If positive, that number of lines is checked near the start of the text,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   560
     if negative, from the end of the text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   561
     If 0, the width is dynamically re adjusted, as lines are drawn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   562
     You may want to change this to 1 if it is guaranteed that all linesa are of the same width,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   563
     or -1, if all are shorter than the last line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   564
     (useful, for example, when it is very expensive to generate all lines, and a huge number
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   565
     of same-width lines is generated through a virtual array)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   566
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   567
    checkedLinesForWidthOfContentsComputation := aNumberOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   568
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   569
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   570
compareModelWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   571
    "return the compare when updating behavior.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   572
     If true (the default), the list of lines as given due to a model update 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   573
     is processed and compared against the currently shown text. 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   574
     If they are the same, no action is taken.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   575
     This behavior is ok in 99.99% of all applications.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   576
     However, you may turn this off iff:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   577
        - it is very expensive to process the list (for example, because the list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   578
          is defined by a virtual array, which computes the lines dynamically, on
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   579
          the fly).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   580
     One use where this flag should be turned off is in the hex-memory display,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   581
     which is able to simulate texts with millions of lines, but they are actually
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   582
     simulated by generating the presented lines dynamically, as they are displayed."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   583
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   584
    ^ compareModelOnUpdate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   585
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   586
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   587
compareModelWhenUpdating:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   588
    "define the compare when updating behavior.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   589
     If true (the default), the list of lines as given due to a model update 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   590
     is processed and compared against the currently shown text. 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   591
     If they are the same, no action is taken.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   592
     This behavior is ok in 99.99% of all applications.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   593
     However, you may turn this off iff:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   594
        - it is very expensive to process the list (for example, because the list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   595
          is defined by a virtual array, which computes the lines dynamically, on
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   596
          the fly).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   597
     One use where this flag should be turned off is in the hex-memory display,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   598
     which is able to simulate texts with millions of lines, but they are actually
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   599
     simulated by generating the presented lines dynamically, as they are displayed."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   600
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   601
    compareModelOnUpdate := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   602
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   603
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   604
expandTabsWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   605
    "return the tab expansion behavior.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   606
     If true (the default), the list of lines as given via #list: or 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   607
     due to a model update is processed and lines are replaced by lines with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   608
     tabs expanded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   609
     This behavior is ok in 99.99% of all applications.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   610
     However, you may turn this off iff:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   611
        - you are certain, that no tabs are in the passed in list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   612
        - it is very expensive to process the list (for example, because the list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   613
          is defined by a virtual array, which computes the lines dynamically, on
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   614
          the fly).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   615
     One use where this flag should be turned off is in the hex-memory display,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   616
     which is able to simulate texts with millions of lines, but they are actually
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   617
     simulated by generating the presented lines dynamically, as they are displayed."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   618
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   619
    ^ expandTabsWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   620
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   621
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   622
expandTabsWhenUpdating:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   623
    "define the tab expansion behavior.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   624
     If true (the default), the list of lines as given via #list: or 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   625
     due to a model update is processed and lines are replaced by lines with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   626
     tabs expanded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   627
     This behavior is ok in 99.99% of all applications.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   628
     However, you may turn this off iff:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   629
        - you are certain, that no tabs are in the passed in list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   630
        - it is very expensive to process the list (for example, because the list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   631
          is defined by a virtual array, which computes the lines dynamically, on
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   632
          the fly).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   633
     One use where this flag should be turned off is in the hex-memory display,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   634
     which is able to simulate texts with millions of lines, but they are actually
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   635
     simulated by generating the presented lines dynamically, as they are displayed."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   636
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   637
    expandTabsWhenUpdating := aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   638
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   639
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   640
lineEndCRLF
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   641
    "answer true, if CRLF is used for the line end.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   642
     This is true for DOS/Windows files.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   643
     Otherwise 'Character cr' is the line end (which is LF in unix)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   644
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   645
    ^ lineEndCRLF ? false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   646
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   647
    "Created: / 04-07-2006 / 19:05:01 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   648
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   649
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   650
scrollWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   651
    "return the scroll behavior, when I get a new text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   652
     (via the model or the #contents/#list)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   653
     Possible returnValues are:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   654
	#keep / nil     -> no change
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   655
	#endOfText      -> scroll to the end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   656
	#beginOfText    -> scroll to the top
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   657
     The default is #keep.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   658
     This may be useful for fields which get new values assigned from
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   659
     the program (i.e. not from the user)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   660
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   661
    ^ scrollWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   662
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   663
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   664
scrollWhenUpdating:aSymbolOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   665
    "define how to scroll, when I get a new text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   666
     (via the model or the #contents/#list)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   667
     Allowed arguments are:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   668
	#keep / nil     -> no change
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   669
	#endOfText      -> scroll to the end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   670
	#beginOfText    -> scroll to the top
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   671
     The default is #keep.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   672
     This may be useful for fields which get new values assigned from
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   673
     the program (i.e. not from the user)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   674
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   675
    scrollWhenUpdating := aSymbolOrNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   676
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   677
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   678
wordCheckBlock:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   679
    "set the word-check block - this block is called with a character argument,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   680
     when the end/beginning of a word is searched.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   681
     It should return true, if the character belongs to the word.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   682
     The default block is set in #initialize, and returns true for alphanumeric
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   683
     (national) characters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   684
     Applications may change it to include underlines, dollars or other characters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   685
     (a C/C++ editor would include underlines ...)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   686
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   687
    wordCheck := aBlock.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   688
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   689
    "Modified: 22.5.1996 / 12:26:55 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   690
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   691
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   692
!ListView methodsFor:'accessing-contents'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   693
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   694
add:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   695
    "add a line and redisplay"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   696
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   697
    |fontHeightBefore|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   698
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   699
    list isNil ifTrue:[list := OrderedCollection new].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   700
    list add:aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   701
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   702
    includesNonStrings ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   703
        includesNonStrings := (aString notNil and:[(aString isMemberOf:String) not]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   704
        includesNonStrings ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   705
            fontHeightBefore := fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   706
            self getFontParameters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   707
            fontHeightBefore ~~ fontHeight ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   708
                self invalidate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   709
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   710
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   711
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   712
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   713
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   714
        self recomputeWidthOfWidestLineFor:aString old:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   715
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   716
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   717
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   718
        self redrawLine:(self size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   719
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   720
    self enqueueDelayedContentsChangedNotification.             "recompute scrollbars"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   721
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   722
    "Modified: / 25-07-2012 / 12:00:20 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   723
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   724
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   725
add:aString beforeIndex:index
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   726
    "add a line and redisplay"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   727
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   728
    |lastShown|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   729
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   730
    list isNil ifTrue:[list := OrderedCollection new].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   731
    list add:aString beforeIndex:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   732
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   733
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   734
        self recomputeWidthOfWidestLineFor:aString old:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   735
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   736
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   737
    includesNonStrings ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   738
        includesNonStrings := (aString notNil and:[(aString isMemberOf:String) not]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   739
"/        includesNonStrings ifTrue:[self getFontParameters].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   740
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   741
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   742
        lastShown := self lastLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   743
        index <= 2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   744
            self invalidate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   745
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   746
            index to:lastShown do:[:eachLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   747
                self invalidateLine:eachLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   748
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   749
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   750
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   751
    self enqueueDelayedContentsChangedNotification.  "recompute scrollbars"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   752
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   753
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   754
        "/ self selection isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   755
            self scrollToBottom.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   756
        "/ ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   757
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   758
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   759
    "Modified: / 25-07-2012 / 12:00:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   760
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   761
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   762
addAll:aCollectionOfLines beforeIndex:index
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   763
    "add a bunch of lines and redisplay"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   764
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   765
    |lastShown|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   766
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   767
    list isNil ifTrue:[list := OrderedCollection new].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   768
    aCollectionOfLines do:[:eachLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   769
        list addAll:aCollectionOfLines beforeIndex:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   770
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   771
    includesNonStrings ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   772
        includesNonStrings := 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   773
            aCollectionOfLines 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   774
                contains:[:someLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   775
                    someLine notNil and:[(someLine isMemberOf:String) not].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   776
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   777
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   778
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   779
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   780
        aCollectionOfLines do:[:eachLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   781
            self recomputeWidthOfWidestLineFor:eachLine old:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   782
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   783
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   784
"/    widthOfWidestLine := nil. "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   785
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   786
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   787
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   788
        lastShown := self lastLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   789
        ((index-1) <= lastShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   790
            index <= 2 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   791
                self invalidate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   792
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   793
                index-1 to:lastShown do:[:eachLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   794
                    self invalidateLine:eachLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   795
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   796
                "/  self redrawFromLine:index-1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   797
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   798
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   799
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   800
    self enqueueDelayedContentsChangedNotification.  "recompute scrollbars"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   801
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   802
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   803
        "/ self selection isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   804
            self scrollToBottom.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   805
        "/ ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   806
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   807
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   808
    "Modified: / 25-07-2012 / 12:00:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   809
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   810
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   811
at:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   812
    "retrieve a line; return nil if beyond end-of-text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   813
     this allows textViews to be used like collections in some places."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   814
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   815
    list isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   816
    (lineNr between:1 and:self size) ifFalse:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   817
    ^ list at:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   818
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   819
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   820
at:index put:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   821
    "change a line and redisplay"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   822
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   823
    |fontHeightBefore widthBefore|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   824
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   825
    fontHeightBefore := fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   826
    widthBefore := widthOfWidestLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   827
    self withoutRedrawAt:index put:aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   828
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   829
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   830
        fontHeightBefore ~= fontHeight ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   831
            "/ must redraw everything
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   832
            self invalidate.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   833
            ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   834
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   835
        self redrawLine:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   836
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   837
"/ the code below is wrong - we really have to redraw everything, if the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   838
"/ fontHeight changes (due to a labelAndIcon in the list).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   839
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   840
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   841
"/        "/ this could have changed the font height;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   842
"/        "/ must clear all below last line, if it became smaller
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   843
"/        fontHeightBefore > fontHeight ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   844
"/            (self listLineIsVisible:(self size)) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   845
"/                self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   846
"/                                    corner:(width-margin) @ (height-margin).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   847
"/            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   848
"/            self redrawFromLine:index
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   849
"/        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   850
"/            self redrawLine:index
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   851
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   852
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   853
        "/ asynchronous:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   854
"/        visibleLine := self listLineToVisibleLine:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   855
"/        visibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   856
"/            y := self yOfVisibleLine:visibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   857
"/            self invalidate:((margin @ y) extent:(width@fontHeight))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   858
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   859
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   860
        widthBefore ~~ widthOfWidestLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   861
            self enqueueDelayedContentsChangedNotification
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   862
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   863
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   864
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   865
    "Modified: / 25-07-2012 / 12:01:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   866
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   867
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   868
characterAtCharacterPosition:charPos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   869
    "return the character at a 1-based character position.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   870
     Return a space character if nothing is there
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   871
     (i.e. beyond the end of the line or below the last line)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   872
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   873
    |line col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   874
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   875
    line := self lineOfCharacterPosition:charPos.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   876
    col := charPos - (self characterPositionOfLine:line col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   877
    col == 0 ifTrue:[^ Character cr].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   878
    ^ self characterAtLine:line col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   879
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   880
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   881
characterAtLine:lineNr col:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   882
    "return the character at physical line/col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   883
     The lineNr and colNr arguments start at 1, for the top-left cgaracter.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   884
     Return a space character if nothing is there
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   885
     (i.e. beyond the end of the line or below the last line)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   886
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   887
    |line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   888
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   889
    list notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   890
	line := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   891
	line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   892
	    (line size >= colNr) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   893
		^ line at:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   894
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   895
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   896
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   897
    ^ Character space
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   898
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   899
    "Created: 29.4.1996 / 12:11:00 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   900
    "Modified: 29.4.1996 / 12:12:41 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   901
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   902
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   903
contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   904
    "return the contents as a string, terminated by the line end character (sequence)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   905
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   906
    |stringCollection lineEnd|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   907
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   908
    list isNil ifTrue:[^ ''].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   909
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   910
    self lineEndCRLF ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   911
        lineEnd := String crlf.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   912
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   913
        lineEnd := Character cr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   914
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   915
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   916
    stringCollection := list asStringCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   917
    ^ stringCollection 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   918
        asStringWith:lineEnd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   919
        from:1 to:stringCollection size 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   920
        compressTabs:false 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   921
        final:lineEnd
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   922
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   923
    "Modified: / 04-07-2006 / 19:18:47 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   924
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   925
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   926
contents:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   927
    "set the contents (either a String or a Collection of strings)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   928
     also scroll to top. See #setContents:, which does not scroll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   929
     If the argument is a string, it is converted
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   930
     to a collection of line-strings here."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   931
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   932
    |l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   933
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   934
    l := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   935
    l notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   936
	l isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   937
	    l := l asStringCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   938
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   939
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   940
    self list:l
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   941
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   942
    "Modified: 5.6.1997 / 11:11:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   943
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   944
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   945
from:from to:to do:aBlock
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   946
    "evaluate aBlock on some of my lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   947
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   948
    list from:from to:to do:aBlock.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   949
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   950
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   951
grow:n
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   952
    "grow our list"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   953
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   954
    ^ list grow:n.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   955
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   956
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   957
lineAtY:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   958
    "return the lineNr for a given y-(view-)coordinate"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   959
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   960
    |visibleLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   961
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   962
    visibleLine := self visibleLineOfY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   963
    visibleLine isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   964
    ^ self visibleLineToListLine:visibleLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   965
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   966
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   967
list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   968
    "return the contents as a collection of strings.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   969
     This returns the views internal list - modifying it may confuse
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   970
     the listView."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   971
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   972
    ^ list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   973
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   974
    "Modified: 5.6.1997 / 11:10:54 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   975
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   976
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   977
list:aCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   978
    "set the contents (a collection of strings or list entries)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   979
     and scroll as specified in scrollWhenUpdating (default:top-left).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   980
     See also #setList:, which does not scroll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   981
     Tabs are expanded (to spaces).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   982
     The passed list is scanned for nonStrings
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   983
     (remembered to optimize later redraws)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   984
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   985
    self list:aCollection expandTabs:expandTabsWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   986
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   987
    "Modified: 5.6.1997 / 11:10:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   988
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   989
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   990
list:aCollection expandTabs:expand
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   991
    "set the contents (a collection of strings)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   992
     and scroll as specified in scrollWhenUpdating (default:top-left).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   993
     If expand is true, tabs are expanded (to spaces).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   994
     The passed list is scanned for nonStrings (remembered to optimize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   995
     later redraws)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   996
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   997
    self list:aCollection expandTabs:expand scanForNonStrings:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   998
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
   999
    "Modified: 5.6.1997 / 11:09:44 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1000
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1001
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1002
list:aCollection expandTabs:expand scanForNonStrings:scan
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1003
    "set the contents (a collection of strings)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1004
     and scroll as specified in scrollWhenUpdating (default:top-left).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1005
     If expand is true, tabs are expanded (to spaces).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1006
     If scan is true, scan the passed list for nonStrings; otherwise,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1007
     assume that it does contain non-strings
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1008
     (remembered to optimize later redraws)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1009
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1010
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1011
        list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1012
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1013
    "Modified: 5.6.1997 / 12:40:35 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1014
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1015
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1016
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1017
    "set the contents (a collection of strings)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1018
     and scroll as specified in scrollWhenUpdating (default:top-left).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1019
     If expand is true, tabs are expanded (to spaces).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1020
     If scan is true, scan the passed list for nonStrings;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1021
     otherwise, take the information from the nonStrings arg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1022
     (the nonStrings information is remembered to optimize later redraws & height computations)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1024
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1025
        list:aCollection 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1026
        expandTabs:expand 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1027
        scanForNonStrings:scan 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1028
        includesNonStrings:nonStringsIfNoScan 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1029
        redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1030
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1031
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1032
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1033
    "set the contents (a collection of strings)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1034
     and scroll as specified in scrollWhenUpdating (default:top-left).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1035
     If expand is true, tabs are expanded (to spaces).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1036
     If scan is true, scan the passed list for nonStrings;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1037
     otherwise, take the information from the nonStrings arg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1038
     (the nonStrings information is remembered to optimize later redraws & height computations)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1039
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1040
    |oldFirst oldLeft nonStringsBefore fontHeightBefore
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1041
     scrollToEnd scrollToTop newLeftOffset wText same firstLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1042
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1043
    "/ cg: what is the point in comparing here?
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1044
    "/ I think, if there is something to optimize,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1045
    "/ the caller should do so (moved to getListFromModel).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1046
    "/ notice, that it may be very expensive to ask aCollection for each line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1047
    "/ for example, iff the lines are generated on the fly by an algorithm
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1048
    false ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1049
        "/ see if there is a change at all.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1050
        "/ use to compare using =, but that's not enough in case of emphasis change.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1051
        aCollection size == list size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1052
            same := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1053
            aCollection size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1054
                aCollection with:list do:[:eachNewLine :eachOldLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1055
                    (eachNewLine == eachOldLine)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1056
                    ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1057
                        same := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1058
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1059
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1060
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1061
            same ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1062
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1063
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1064
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1065
    scrollToTop := scrollWhenUpdating == #begin or:[scrollWhenUpdating == #beginOfText].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1066
    scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1067
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1068
    (aCollection isEmptyOrNil and:[list isEmptyOrNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1069
        "no contents change"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1070
        list := aCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1071
        scrollLocked ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1072
            scrollToTop ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1073
                self scrollToTop.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1074
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1075
                scrollToEnd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1076
                    self scrollToBottom.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1077
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1078
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1079
            self scrollToLeft.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1080
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1081
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1082
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1083
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1084
    checkLineEndConventionWhenUpdating ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1085
        "Check if the we use DOS/Windows line end convention with CR LF.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1086
         The LF has already been consumed by the conversion to a StringCollection,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1087
         now check for and remove the trailing left over CRs"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1088
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1089
        lineEndCRLF := (aCollection size > 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1090
                        and:[(firstLine := aCollection at:1) isString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1091
                        and:[firstLine notEmpty
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1092
                        and:[firstLine string endsWith:Character return]]]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1093
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1094
    lineEndCRLF ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1095
        list := aCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1096
                    collect:[:eachLineWithCROrNil |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1097
                        eachLineWithCROrNil isNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1098
                            ifTrue:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1099
                            ifFalse:[(eachLineWithCROrNil endsWith:Character return)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1100
                                     ifTrue:[eachLineWithCROrNil copyButLast:1]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1101
                                     ifFalse:[eachLineWithCROrNil]]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1102
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1103
        list := aCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1104
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1105
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1106
    nonStringsBefore := includesNonStrings.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1107
    fontHeightBefore := fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1108
    includesNonStrings := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1109
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1110
    list notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1111
        expand ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1112
            self expandTabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1113
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1114
            scan ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1115
                includesNonStrings := list contains:[:e | e isString not].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1116
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1117
                includesNonStrings := nonStringsIfNoScan ? nonStringsBefore
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1118
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1119
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1120
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1121
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1122
        self getFontParameters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1123
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1124
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1125
    widthOfWidestLine := nil.   "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1126
    oldFirst := firstLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1127
    oldLeft := viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1128
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1129
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1130
        self computeNumberOfLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1131
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1132
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1133
    scrollLocked ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1134
        newLeftOffset := viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1135
        scrollToTop ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1136
            firstLineShown := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1137
            newLeftOffset := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1138
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1139
            scrollToEnd ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1140
                firstLineShown := (list size - nFullLinesShown + 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1141
                newLeftOffset := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1142
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1143
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1144
        newLeftOffset > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1145
            wText := self widthOfContents.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1146
            (viewOrigin x + self innerWidth) > wText ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1147
                newLeftOffset := (wText - self innerWidth) max:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1148
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1149
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1150
        newLeftOffset ~= oldLeft ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1151
            viewOrigin := newLeftOffset @ viewOrigin y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1152
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1153
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1154
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1155
    realized ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1156
        self contentsChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1157
        scrollLocked ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1158
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1159
             don't use scroll here to avoid double redraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1160
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1161
            viewOrigin := viewOrigin isNil ifTrue:[0@0] ifFalse:[(viewOrigin x) @ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1162
            gc transformation:nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1163
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1164
            oldFirst ~~ firstLineShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1165
                self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1166
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1167
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1168
        doRedraw ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1169
            shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1170
                self invalidate.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1171
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1172
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1173
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1174
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1175
    "Modified: / 30-08-1995 / 19:07:13 / claus"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1176
    "Created: / 05-06-1997 / 12:40:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1177
    "Modified: / 04-07-2006 / 19:12:39 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1178
    "Modified: / 22-08-2006 / 11:59:56 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1179
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1180
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1181
listAt:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1182
    "given a lineNumber, return the corresponding string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1183
     This is used for accessing; i.e. for non-string entries, this
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1184
     returns the corresponding string."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1185
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1186
    |l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1187
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1188
    list isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1189
    (lineNr between:1 and:self size) ifFalse:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1190
    l := self at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1191
    l isNil ifTrue:[^ l].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1192
    ^ self visibleStringFrom:l "/ l asString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1193
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1194
    "Modified: 7.9.1995 / 15:54:59 / claus"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1195
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1196
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1197
removeFromIndex:startLineNr toIndex:endLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1198
    "delete some lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1199
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1200
    |nLines widestLineRemoved|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1201
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1202
    list isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1203
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1204
    widestLineRemoved := self widthOfWidestLineBetween:startLineNr and:endLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1205
    list removeFromIndex:startLineNr toIndex:(endLineNr min:list size).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1206
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1207
    widthOfWidestLine == widestLineRemoved ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1208
        widthOfWidestLine := nil. "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1209
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1210
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1211
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1212
    ((startLineNr <= self lastLineShown)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1213
    and:[endLineNr >= firstLineShown]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1214
        startLineNr to:self lastLineShown do:[:eachLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1215
            self invalidateLine:eachLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1216
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1217
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1218
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1219
    nLines := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1220
    (firstLineShown >= nLines) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1221
        self makeLineVisible:nLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1222
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1223
    self enqueueDelayedContentsChangedNotification.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1224
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1225
    "Modified: / 25-07-2012 / 12:01:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1226
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1227
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1228
removeIndex:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1229
    "delete a line, redraw the view"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1230
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1231
    |visLine w h x
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1232
     srcY "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1233
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1234
    (self removeIndexWithoutRedraw:lineNr) ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1235
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1236
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1237
     is there a need to redraw ?
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1238
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1239
    shown ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1240
    visLine := self listLineToVisibleLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1241
    visLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1242
	w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1243
"/        x := textStartLeft.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1244
"/ CLAUS fixes leftOver selection pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1245
	w := w + leftMargin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1246
	x := margin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1247
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1248
	srcY := topMargin + (visLine * fontHeight).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1249
"/        h := ((nLinesShown - visLine) * fontHeight).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1250
	h := (height - margin - srcY).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1251
	h > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1252
	    self catchExpose.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1253
	    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1254
		copyFrom:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1255
		x:x y:srcY
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1256
		toX:x y:(srcY - fontHeight)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1257
		width:w height:h
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1258
		async:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1259
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1260
	self redrawVisibleLine:nFullLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1261
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1262
	 redraw last partial line - if any
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1263
	"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1264
	(nFullLinesShown ~~ nLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1265
	    self redrawVisibleLine:nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1266
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1267
	h > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1268
	    self waitForExpose
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1269
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1270
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1271
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1272
    "Modified: / 27.2.1998 / 12:36:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1273
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1274
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1275
removeIndexWithoutRedraw:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1276
    "delete a line, given its lineNr - no redraw;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1277
     return true, if something was really deleted (so sender knows,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1278
     if a redraw is needed)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1279
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1280
    (list isNil or:[lineNr > self size]) ifTrue:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1281
    list removeIndex:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1282
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1283
    lineNr < firstLineShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1284
        firstLineShown := firstLineShown - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1285
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1286
    self enqueueDelayedContentsChangedNotification.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1287
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1288
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1289
    "Modified: / 25-07-2012 / 12:02:09 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1290
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1291
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1292
replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1293
    "replace some lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1294
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1295
    list isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1296
        list := OrderedCollection new.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1297
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1298
    list replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1299
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1300
    widthOfWidestLine := nil. "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1301
    self textChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1302
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1303
    ((startLineNr <= self lastLineShown)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1304
    and:[endLineNr >= firstLineShown]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1305
        self invalidate.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1306
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1307
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1308
    self enqueueDelayedContentsChangedNotification.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1309
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1310
    "Modified: / 25-07-2012 / 12:02:15 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1311
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1312
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1313
setContents:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1314
    "set the contents (either a string or a Collection of strings)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1315
     dont change position (i.e. do not scroll).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1316
     This can be used to update a self-changing list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1317
     (for example: a file list being shown, without disturbing user too much).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1318
     Compare with #contents:, which scrolls to top."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1319
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1320
    |l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1321
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1322
    l := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1323
    l notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1324
	l isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1325
	    l := l asStringCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1326
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1327
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1328
    self setList:l.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1329
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1330
    "Modified: 18.12.1995 / 22:20:43 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1331
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1332
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1333
setList:aCollection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1334
    "set the contents (a collection of strings);
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1335
     do not change position (i.e. do not scroll).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1336
     This can be used to update a self-changing list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1337
     (for example: a file list being shown, without disturbing user too much)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1338
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1339
    ^ self setList:aCollection expandTabs:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1340
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1341
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1342
setList:aCollection expandTabs:expandTabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1343
    "set the contents (a collection of strings);
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1344
     do not change position (i.e. do not scroll).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1345
     This can be used to update a self-changing list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1346
     (for example: a file list being shown, without disturbing the user too much)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1347
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1348
    self setList:aCollection expandTabs:expandTabs redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1349
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1350
    "Modified: / 22.4.1998 / 11:12:24 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1351
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1352
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1353
setList:aCollection expandTabs:expandTabs redraw:doRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1354
    "set the contents (a collection of strings);
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1355
     do not change position (i.e. do not scroll).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1356
     This can be used to update a self-changing list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1357
     (for example: a file list being shown, without disturbing the user too much)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1358
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1359
    self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1360
        setList:aCollection expandTabs:expandTabs scanForNonStrings:true includesNonStrings:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1361
        redraw:doRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1362
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1363
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1364
setList:aCollection expandTabs:expandTabs scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1365
    "set the contents (a collection of strings);
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1366
     do not change position (i.e. do not scroll).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1367
     This can be used to update a self-changing list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1368
     (for example: a file list being shown, without disturbing the user too much).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1369
    TODO: this stinks: most of the code is the same as in #list:expandTabs:...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1370
          needs a refactoring"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1371
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1372
    |prev|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1373
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1374
    prev := scrollLocked.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1375
    [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1376
        scrollLocked := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1377
        self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1378
            list:aCollection 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1379
            expandTabs:expandTabs 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1380
            scanForNonStrings:scan 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1381
            includesNonStrings:nonStringsIfNoScan 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1382
            redraw:doRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1383
    ] ensure:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1384
        scrollLocked := prev
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1385
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1386
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1387
"/    
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1388
"/"/                scrollLocked ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1389
"/"/                    self setList:newText expandTabs:expandTabsWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1390
"/"/                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1391
"/                    self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1392
"/"/                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1393
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1394
"/    |oldFirst nonStringsBefore|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1395
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1396
"/    (aCollection isNil and:[list isNil]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1397
"/        "no change"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1398
"/        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1399
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1400
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1401
"/    list := aCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1402
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1403
"/    nonStringsBefore := includesNonStrings.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1404
"/    includesNonStrings := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1405
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1406
"/    list notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1407
"/        expandTabs ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1408
"/            self expandTabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1409
"/        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1410
"/            scan ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1411
"/                includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1412
"/            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1413
"/                includesNonStrings := nonStringsIfNoScan ? nonStringsBefore
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1414
"/            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1415
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1416
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1417
"/    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1418
"/        self getFontParameters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1419
"/        self computeNumberOfLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1420
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1421
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1422
"/    "/ new: reposition horizontally if too big
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1423
"/    widthOfWidestLine := nil.   "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1424
"/    innerWidth >= self widthOfContents ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1425
"/        viewOrigin := 0 @ viewOrigin y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1426
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1427
"/    self contentsChanged.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1428
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1429
"/    "/ new: reposition vertically if too big
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1430
"/    (firstLineShown + nFullLinesShown) > self size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1431
"/        oldFirst := firstLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1432
"/        firstLineShown := self size - nFullLinesShown + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1433
"/        firstLineShown < 1 ifTrue:[firstLineShown := 1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1434
"/        oldFirst ~= firstLineShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1435
"/            viewOrigin y:((firstLineShown - 1) * fontHeight).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1436
"/            self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1437
"/            shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1438
"/                self clearView.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1439
"/            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1440
"/        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1441
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1442
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1443
"/    (shown and:[doRedraw]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1444
"/        self invalidate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1445
"/        "/ self redrawFromVisibleLine:1 to:nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1446
"/    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1447
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1448
"/    "Modified: / 18.12.1995 / 23:27:54 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1449
"/    "Created: / 22.4.1998 / 11:11:51 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1450
"/    "Modified: / 26.7.1998 / 13:46:49 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1451
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1452
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1453
size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1454
    "return the size (i.e. number of lines)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1455
     this allows textViews to be used like collections in some places."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1456
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1457
    ^ list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1458
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1459
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1460
stringAtLine:lineNr from:col1 to:col2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1461
    "return the substring starting at physical line/col1, up-to and
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1462
     including col2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1463
     The lineNr and colNr arguments start at 1, for the top-left character.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1464
     Fills the string with space characters at the right.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1465
     (i.e. beyond the end of the line or below the last line)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1466
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1467
    |line len s|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1468
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1469
    len := col2 - col1 + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1470
    list notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1471
	line := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1472
	line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1473
	    (line size >= col1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1474
		s := line copyFrom:col1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1475
		s size < len ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1476
		    ^ s paddedTo:len
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1477
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1478
		^ s copyTo:len
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1479
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1480
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1481
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1482
    ^ String new:len withAll:Character space
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1483
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1484
    "Created: 7.1.1997 / 19:58:43 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1485
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1486
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1487
textFromCharacterPosition:charPos1 to:charPos2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1488
    "return some text as a collection of (line-)strings."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1489
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1490
    |line1 col1 line2 col2|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1491
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1492
    line1 := self lineOfCharacterPosition:charPos1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1493
    col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1494
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1495
    line2 := self lineOfCharacterPosition:charPos2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1496
    col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1497
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1498
    ^ self textFromLine:line1 col:col1 toLine:line2 col:col2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1499
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1500
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1501
textFromLine:startLine col:startCol toLine:endLine col:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1502
    "return some text as a collection of (line-)strings."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1503
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1504
    |text sz index last|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1505
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1506
    startLine isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1507
    endLine isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1508
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1509
    (startLine == endLine) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1510
        "part of a line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1511
        ^ StringCollection with:(self listAt:startLine from:startCol to:endCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1512
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1513
    
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1514
    sz := endLine - startLine + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1515
    sz < 1 ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1516
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1517
    text := StringCollection new:sz.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1518
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1519
    "get 1st and last (possibly) partial lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1520
    text at:1 put:(self listAt:startLine from:startCol).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1521
    endCol == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1522
        last := ''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1523
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1524
        last := self listAt:endLine to:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1525
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1526
    text at:sz put:last.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1527
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1528
    "get bulk of text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1529
    index := 2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1530
    (startLine + 1) to:(endLine - 1) do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1531
        text at:index put:(self listAt:lineNr).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1532
        index := index + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1533
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1534
    ^ text
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1535
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1536
    "Created: / 22-02-2000 / 23:53:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1537
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1538
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1539
withoutRedrawAt:index put:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1540
    "change a line without redisplay and WITHOUT any sizeChange notifications.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1541
     Somewhat dangerous, since scrollBars will not be informed about contents-changes.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1542
     Use only if multiple lines are to be changed, and a sizeChanged is invoked by some other
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1543
     means at the end."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1544
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1545
    |didIncludeNonStrings oldLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1546
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1547
    self checkForExistingLine:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1548
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1549
    oldLine := self listAt:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1550
    list at:index put:aString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1551
    oldLine ~= aString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1552
        self textChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1553
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1554
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1555
    didIncludeNonStrings := includesNonStrings.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1556
    includesNonStrings ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1557
        includesNonStrings := (aString notNil and:[(aString isMemberOf:String) not]).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1558
    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1559
        (aString isNil or:[(aString isMemberOf:String)]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1560
            includesNonStrings := list contains:[:l | l notNil and:[(l isMemberOf:String) not]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1561
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1562
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1563
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1564
    includesNonStrings ~~ didIncludeNonStrings ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1565
        self getFontParameters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1566
        self computeNumberOfLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1567
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1568
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1569
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1570
        self recomputeWidthOfWidestLineFor:aString old:oldLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1571
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1572
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1573
    "Modified: / 26.7.1998 / 13:00:14 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1574
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1575
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1576
!ListView methodsFor:'accessing-look'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1577
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1578
backgroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1579
    "return the background color"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1580
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1581
    ^ bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1582
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1583
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1584
backgroundColor:aColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1585
    "set the background color of the contents"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1586
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1587
    bgColor ~~ aColor ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1588
	bgColor := aColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1589
	self viewBackground:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1590
	self invalidate "/ clear; redraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1591
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1592
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1593
    "Modified: 3.5.1997 / 10:27:40 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1594
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1595
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1596
font:aFont
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1597
    "set the font for all shown text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1598
     Redraws everything.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1599
     CAVEAT: with the addition of Text objects,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1600
             this method is going to be obsoleted by a textStyle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1601
             method, which allows specific control over
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1602
             normalFont/boldFont/italicFont parameters."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1603
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1604
    aFont isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1605
        ^ self error:'nil font' mayProceed:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1606
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1607
    gc font ~~ aFont ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1608
        preferredExtent := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1609
        widthOfWidestLine := nil. "/ i.e. unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1610
        super font:aFont.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1611
        self getFontParameters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1612
        realized ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1613
            (gc font graphicsDevice == gc device) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1614
                self computeNumberOfLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1615
                shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1616
                    self redrawFromVisibleLine:1 to:nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1617
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1618
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1619
            self enqueueDelayedContentsChangedNotification
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1620
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1621
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1622
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1623
    "Modified: / 25-07-2012 / 12:01:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1624
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1625
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1626
fontHeight:pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1627
    "set the lines height - that's the number of pixels,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1628
     by which lines are vertically separated."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1629
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1630
    fontHeight ~~ pixels ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1631
        fontHeight := pixels.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1632
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1633
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1634
    "Created: 17.4.1997 / 01:41:33 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1635
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1636
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1637
foregroundColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1638
    "return the foreground color"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1639
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1640
    ^ fgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1641
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1642
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1643
foregroundColor:aColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1644
    "set the foreground color"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1645
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1646
    fgColor ~~ aColor ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1647
	fgColor := aColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1648
	self invalidate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1649
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1650
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1651
    "Modified: 29.5.1996 / 16:19:02 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1652
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1653
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1654
foregroundColor:color1 backgroundColor:color2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1655
    "set both foreground and background colors"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1656
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1657
    ((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1658
	fgColor := color1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1659
	bgColor := color2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1660
	self invalidate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1661
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1662
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1663
    "Modified: 29.5.1996 / 16:19:05 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1664
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1665
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1666
innerHorizontalMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1667
    "return the margin between the left border and the 1st col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1668
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1669
    ^ leftMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1670
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1671
    "Created: 16.1.1996 / 19:28:23 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1672
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1673
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1674
innerVerticalMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1675
    "return the margin between the top border and the 1st line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1676
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1677
    ^ topMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1678
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1679
    "Created: 16.1.1996 / 19:28:00 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1680
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1681
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1682
leftMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1683
    "return the margin to left of 1st col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1684
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1685
    ^ leftMargin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1686
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1687
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1688
leftMargin:aNumber
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1689
    "set the margin between the left border and the 1st col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1690
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1691
    leftMargin := aNumber.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1692
    textStartLeft := aNumber + margin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1693
    innerWidth := width - aNumber - margin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1694
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1695
    "Modified: 28.2.1996 / 19:32:55 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1696
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1697
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1698
level:aNumber
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1699
    "set the 3D level - caught here to update text-position variables
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1700
     (which avoids many computations later)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1701
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1702
    |newMargin|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1703
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1704
    aNumber ~~ level ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1705
	newMargin := aNumber abs.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1706
	textStartLeft := leftMargin + newMargin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1707
	textStartTop := topMargin + newMargin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1708
	innerWidth := width - textStartLeft - newMargin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1709
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1710
	super level:aNumber.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1711
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1712
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1713
    "Modified: 11.8.1997 / 02:59:15 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1714
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1715
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1716
lineSpacing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1717
    "get the lineSpacing - that's an additional number of pixels,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1718
     by which lines are vertically separated."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1719
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1720
    ^ lineSpacing
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1721
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1722
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1723
lineSpacing:pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1724
    "set the lineSpacing - that's an additional number of pixels,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1725
     by which lines are vertically separated."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1726
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1727
    lineSpacing ~~ pixels ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1728
        lineSpacing := pixels.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1729
        self getFontParameters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1730
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1731
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1732
    "Modified: 22.5.1996 / 12:22:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1733
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1734
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1735
partialLines:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1736
    "allow/disallow display of a last partial line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1737
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1738
    partialLines := aBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1739
    self computeNumberOfLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1740
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1741
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1742
topMargin:aNumber
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1743
    "set the margin between the top border and the 1st line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1744
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1745
    topMargin := aNumber.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1746
    textStartTop := topMargin + margin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1747
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1748
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1749
viewBackground:aColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1750
    super viewBackground:aColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1751
    self isTextView ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1752
	self backgroundColor:aColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1753
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1754
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1755
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1756
!ListView methodsFor:'accessing-mvc'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1757
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1758
addModelInterfaceTo:aDictionary
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1759
    "see comment in View>>modelInterface"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1760
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1761
    super addModelInterfaceTo:aDictionary.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1762
    aDictionary at:#listMessage put:listMsg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1763
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1764
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1765
listMessage
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1766
    "return the listMsg selector;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1767
     if non-nil, this is the message sent to the model (if any) to aquire
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1768
     a new text upon change of the aspect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1769
     This defaults to the aspect-selector."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1770
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1771
    ^ listMsg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1772
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1773
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1774
listMessage:aSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1775
    "ST-80 compatibility: set the listMsg selector;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1776
     if non-nil, this will be sent to the model (if any) to aquire a
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1777
     new text upon change of the aspect.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1778
     This defaults to the aspect-selector."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1779
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1780
    listMsg := aSymbol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1781
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1782
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1783
model:aModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1784
    "define the receivers model, from which the text is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1785
     to be aquired via list- or aspect-messages, whenever its aspect
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1786
     changes."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1787
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1788
    super model:aModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1789
    self getListFromModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1790
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1791
    "Created: 31.12.1996 / 14:56:43 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1792
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1793
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1794
on:aModel aspect:aspectSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1795
    "ST-80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1796
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1797
    ^ self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1798
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1799
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1800
on:aModel aspect:aspectSymbol change:changeSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1801
    "ST-80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1802
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1803
    ^self on:aModel aspect:aspectSymbol change:changeSymbol list:aspectSymbol menu:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1804
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1805
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1806
on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol menu:menuSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1807
    "ST-80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1808
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1809
    aspectSymbol notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1810
        aspectMsg := aspectSymbol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1811
        listMsg isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1812
            listMsg := aspectSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1813
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1814
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1815
    listSymbol notNil ifTrue:[listMsg := listSymbol].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1816
    changeSymbol notNil ifTrue:[changeMsg := changeSymbol].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1817
    menuMsg := menuSymbol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1818
    self model:aModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1819
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1820
    "Modified: 2.1.1997 / 16:11:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1821
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1822
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1823
on:aModel aspect:aspectSymbol change:changeSymbol menu:menuSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1824
    "ST-80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1825
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1826
    ^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1827
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1828
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1829
on:aModel aspect:aspectSymbol list:listSymbol menu:menuSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1830
    "ST-80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1831
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1832
    ^ self on:aModel aspect:aspectSymbol change:nil list:listSymbol menu:menuSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1833
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1834
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1835
on:aModel aspect:aspectSymbol menu:menuSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1836
    "ST-80 compatibility"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1837
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1838
    ^self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:menuSymbol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1839
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1840
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1841
!ListView methodsFor:'change & update'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1842
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1843
update:something with:aParameter from:changedObject
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1844
    |idx|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1845
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1846
    changedObject == model ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1847
	model isList ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1848
	    list ~~ model ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1849
		something == #at: ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1850
		    idx := aParameter isCollection ifTrue:[aParameter at:1]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1851
						  ifFalse:[aParameter].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1852
		    ^ self at:aParameter put:(model at:idx).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1853
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1854
		something == #insert: ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1855
		    (list size + 1) >= aParameter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1856
			^ self add:(model at:aParameter) beforeIndex:aParameter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1857
		    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1858
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1859
		something == #remove: ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1860
		    list size >= aParameter ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1861
			^ self removeIndex:aParameter
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1862
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1863
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1864
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1865
	    self getListFromModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1866
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1867
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1868
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1869
	(aspectMsg notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1870
	and:[something == aspectMsg]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1871
	    self getListFromModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1872
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1873
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1874
	something isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1875
	    "/ model changed (not more information)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1876
	    self getListFromModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1877
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1878
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1879
	something == #size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1880
	    self getListFromModelScroll:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1881
	    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1882
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1883
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1884
    changedObject == listChannel ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1885
	self getListFromModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1886
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1887
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1888
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1889
    ^ super update:something with:aParameter from:changedObject
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1890
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1891
    "Modified: / 08-11-2006 / 19:40:29 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1892
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1893
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1894
!ListView methodsFor:'drawing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1895
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1896
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1897
    "draw a visible line range in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1898
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1899
    |y         "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1900
     x         "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1901
     startLine "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1902
     endLine   "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1903
     listSize e sH l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1904
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1905
    y := self yOfVisibleLine:startVisLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1906
    sH := lineSpacing // 2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1907
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1908
    backgroundAlreadyClearedColor == bg ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1909
        self paint:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1910
        self fillRectangleX:margin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1911
                          y:y-sH
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1912
                      width:(width - (margin * 2))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1913
                     height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1914
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1915
    list isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1916
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1917
    y := y + fontAscent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1918
    listSize := self size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1919
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1920
    startLine := startVisLineNr + firstLineShown - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1921
    endLine := endVisLineNr + firstLineShown - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1922
    (startLine == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1923
        y := y + fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1924
        startLine := startLine + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1925
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1926
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1927
    (endLine > listSize) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1928
        e := listSize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1929
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1930
        e := endLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1931
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1932
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1933
    (startLine <= e) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1934
        x := textStartLeft - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1935
        self paint:fg on:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1936
        "/ dont use list from:to:do:, to allow for subclasses to redefine the enumeration (TableView)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1937
        self from:startLine to:e do:[:line |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1938
            line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1939
                "/ remove line's color emphasis, to enforce color.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1940
                "/ otherwise blue text is not visible if selection-bg is blue
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1941
                l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1942
                self displayOpaqueString:l x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1943
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1944
            y := y + fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1945
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1946
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1947
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1948
    "Modified: / 15.12.1999 / 23:19:39 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1949
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1950
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1951
drawLine:line atX:x inVisible:visLineNr with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1952
    "draw a given string at visible lines position with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1953
     given x position in fg/bg. Clears the whole line before drawing the string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1954
     Low level entry; not meant for public use."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1955
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1956
    |y l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1957
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1958
    y := self yOfVisibleLine:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1959
    backgroundAlreadyClearedColor == bg ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1960
        self paint:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1961
        self fillRectangleX:margin y:y - (lineSpacing//2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1962
                      width:(width - (2 * margin))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1963
                     height:fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1964
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1965
    line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1966
        self paint:fg on:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1967
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1968
        "/ remove lines color emphasis, to enforce color.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1969
        "/ otherwise blue text is not visible if selection-bg is blue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1970
        "/ this is only done in EditTextViews and subClasses.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1971
        self suppressEmphasisInSelection ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1972
            l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1973
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1974
            l := line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1975
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1976
        self displayOpaqueString:l x:x y:(y + fontAscent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1977
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1978
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1979
    "Modified: / 15.12.1999 / 23:19:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1980
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1981
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1982
drawLine:line fromX:x inVisible:visLineNr with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1983
    "draw a given string at visible lines position with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1984
     given x position in fg/bg. Clears partial line before drawing the string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1985
     Low level entry; not meant for public use."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1986
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1987
    |y l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1988
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1989
    y := self yOfVisibleLine:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1990
    line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1991
	self paint:fg on:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1992
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1993
	"/ remove lines color emphasis, to enforce color.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1994
	"/ otherwise blue text is not visible if selection-bg is blue
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1995
	l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1996
	self displayOpaqueString:l x:x y:(y + fontAscent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1997
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1998
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  1999
    "Modified: / 15.12.1999 / 23:19:55 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2000
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2001
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2002
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2003
    "draw single character at col index of visible line in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2004
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2005
    |y yf x len lineString characterString w|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2006
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2007
    lineString := lineStringArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2008
    len := lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2009
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2010
    x := (self xOfCol:col inVisibleLine:visLineNr) - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2011
    y := self yOfVisibleLine:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2012
    yf := y - (lineSpacing // 2).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2013
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2014
    self paint:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2015
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2016
    (lineString notNil and:[lineString isString not]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2017
        w := lineString widthFrom:col to:(col min:len) on:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2018
        w <= 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2019
            w := gc font width.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2020
            self fillRectangleX:x y:yf width:w height:fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2021
            self paint:fg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2022
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2023
        self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2024
            self drawVisibleLine:visLineNr with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2025
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2026
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2027
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2028
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2029
    (lineString isNil or:[col > len]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2030
        self fillRectangleX:x y:yf width:(gc font width) height:fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2031
        self paint:fg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2032
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2033
        characterString := lineString copyFrom:col to:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2034
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2035
        "/ remove lines color emphasis, to enforce color.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2036
        "/ otherwise blue text is not visible if selection-bg is blue
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2037
        characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2038
        w := characterString widthOn:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2039
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2040
        self fillRectangleX:x y:yf width:w height:fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2041
        self paint:fg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2042
        self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2043
            self displayString:characterString x:x y:(y + fontAscent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2044
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2045
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2046
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2047
    "Modified: / 15.12.1999 / 23:21:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2048
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2049
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2050
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2051
    "draw part of a visible line in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2052
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2053
    |y yf x lineString len characterString w endCol sCol eCol numExtraCols|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2054
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2055
    "/ hack - please rewrite
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2056
    endCol := endColOrNil ? lineStringArg size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2057
    (endCol >= startCol) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2058
        sCol := startCol max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2059
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2060
        lineString := lineStringArg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2061
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2062
        x := (self xOfCol:sCol inVisibleLine:visLineNr) - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2063
        y := (self yOfVisibleLine:visLineNr).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2064
        yf := y - (lineSpacing // 2).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2065
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2066
        len := lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2067
        (lineString notNil and:[(lineString isMemberOf:String) not ])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2068
        ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2069
            w := lineString widthFrom:sCol to:(endCol min:len) on:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2070
            endCol > len ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2071
                sCol > len ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2072
                    numExtraCols := (endCol - sCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2073
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2074
                    numExtraCols := (endCol - len" + 1").
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2075
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2076
                self paint:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2077
                self fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2078
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2079
            w > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2080
                self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2081
                    self drawVisibleLine:visLineNr with:fg and:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2082
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2083
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2084
            ^ self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2085
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2086
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2087
        (sCol > len) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2088
            backgroundAlreadyClearedColor == bg ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2089
                len := endCol - sCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2090
                self paint:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2091
                self fillRectangleX:x y:yf
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2092
                               width:(fontWidth * len)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2093
                              height:fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2094
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2095
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2096
            eCol := endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2097
            (endCol > len) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2098
                backgroundAlreadyClearedColor == bg ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2099
                    characterString := lineString string species new:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2100
                    characterString replaceFrom:1 to:len with:lineString startingAt:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2101
                    lineString := characterString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2102
                ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2103
                    eCol := len.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2104
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2105
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2106
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2107
            "/ remove any color emphasis, to enforce drawing in fg/bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2108
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2109
            lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2110
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2111
            backgroundAlreadyClearedColor == bg ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2112
                (lineString isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2113
                    fontIsFixedWidth ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2114
                        w := (eCol - sCol + 1) * fontWidth
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2115
                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2116
                        w := gc font widthOf:lineString from:sCol to:eCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2117
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2118
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2119
                    w := lineString widthFrom:sCol to:endCol on:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2120
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2121
                self paint:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2122
                self fillRectangleX:x y:yf
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2123
                              width:w
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2124
                              height:fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2125
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2126
            self paint:fg on:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2127
"/            w notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2128
"/                "/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2129
"/                self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2130
"/                    "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2131
"/                    self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2132
"/                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2133
"/            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2134
                "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2135
                self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2136
"/            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2137
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2138
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2139
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2140
    "Modified: / 15.12.1999 / 23:21:43 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2141
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2142
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2143
drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2144
    "draw right part of a visible line from startCol to end of line in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2145
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2146
    |y x index1 index2 lineWithoutColor|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2147
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2148
    (startCol < 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2149
        index1 := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2150
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2151
        index1 := startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2152
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2153
    y := self yOfVisibleLine:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2154
    x := (self xOfCol:index1 inVisibleLine:visLineNr) - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2155
    backgroundAlreadyClearedColor == bg ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2156
        self paint:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2157
        self fillRectangleX:x y:y - (lineSpacing // 2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2158
                      width:(width + viewOrigin x - x)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2159
                     height:fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2160
    ].                                      
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2161
    lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2162
        lineString isString ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2163
            self drawLine:lineString inVisible:visLineNr from:startCol to:nil with:fg and:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2164
        ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2165
            lineWithoutColor := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2166
            index2 := lineWithoutColor size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2167
            (index2 < index1) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2168
            (index1 <= index2) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2169
                self paint:fg on:bg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2170
                "/ self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2171
                self displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2172
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2173
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2174
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2175
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2176
    "Modified: / 15.12.1999 / 23:24:40 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2177
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2178
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2179
drawLine:line inVisible:visLineNr with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2180
    "draw a given string at visible lines position in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2181
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2182
    self drawLine:line atX:(textStartLeft - viewOrigin x) inVisible:visLineNr with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2183
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2184
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2185
drawVisibleLine:visLineNr col:col with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2186
    "draw single character at col index of visible line in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2187
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2188
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2189
	drawLine:(self visibleAt:visLineNr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2190
	inVisible:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2191
	col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2192
	with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2193
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2194
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2195
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2196
    "draw part of a visible line in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2197
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2198
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2199
	drawLine:(self visibleAt:visLineNr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2200
	inVisible:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2201
	from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2202
	with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2203
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2204
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2205
drawVisibleLine:visLineNr from:startCol with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2206
    "draw right part of a visible line from startCol to end of line in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2207
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2208
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2209
	drawLine:(self visibleAt:visLineNr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2210
	inVisible:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2211
	from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2212
	with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2213
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2214
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2215
drawVisibleLine:visLineNr with:fg and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2216
    "draw a visible line in fg/bg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2217
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2218
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2219
	drawLine:(self visibleAt:visLineNr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2220
	atX:(textStartLeft - viewOrigin x)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2221
	inVisible:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2222
	with:fg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2223
	and:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2224
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2225
    "Modified: 28.2.1996 / 19:30:23 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2226
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2227
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2228
fillRectangleX:x y:y width:w height:h
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2229
    "fill rectangle; checks whether the rectangle already is filled with
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2230
     the current paint (#redrawX:y:w:h)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2231
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2232
    backgroundAlreadyClearedColor ~~ self paint ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2233
        super fillRectangleX:x y:y width:w height:h
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2234
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2235
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2236
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2237
invalidateLine:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2238
    "invalidate the area of a single line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2239
     This arranges for that line to be redrawn asynchronously (later).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2240
     If multiple such invalidations arrive, those areas may be lumped
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2241
     together for a block update.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2242
     The update takes place when the windowGroup process gets a chance to
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2243
     process expose events."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2244
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2245
    |yTop visLineNr|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2246
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2247
    visLineNr := self listLineToVisibleLine:line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2248
    visLineNr notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2249
        yTop := self yOfVisibleLine:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2250
        yTop isNil ifTrue:[^ self]. "/ not visible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2251
        (yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2252
        self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2253
            invalidateDeviceRectangle:(Rectangle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2254
                            left:margin top:yTop-(lineSpacing//2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2255
                            width:(width - (2 * margin)) height:fontHeight)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2256
            repairNow:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2257
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2258
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2259
    "Created: / 5.3.1998 / 01:24:19 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2260
    "Modified: / 5.3.1998 / 13:41:31 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2261
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2262
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2263
!ListView methodsFor:'event handling'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2264
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2265
contentsChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2266
    "size of contents changed - move origin up if possible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2267
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2268
    |listSize newOrigin|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2270
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2271
        list notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2272
            listSize := self numberOfLines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2273
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2274
            listSize == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2275
                widthOfWidestLine := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2276
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2277
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2278
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2279
             if we are beyond the end, scroll up a bit
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2280
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2281
            ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2282
                newOrigin := listSize - nFullLinesShown + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2283
                newOrigin < 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2284
                    newOrigin := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2285
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2286
                self scrollToLine: newOrigin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2287
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2288
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2289
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2290
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2291
    ^ super contentsChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2292
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2293
    "Modified: 18.11.1996 / 19:50:07 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2294
    "Modified: 5.3.1997 / 15:50:46 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2295
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2296
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2297
keyPress:key x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2298
    "a key was pressed - handle page-keys here"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2299
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2300
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2301
			  #BeginOfText #EndOfText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2302
			  #ScrollUp #ScrollDown )>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2303
    |n|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2304
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2305
    (key == #PreviousPage) ifTrue: [^ self pageUp].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2306
    (key == #NextPage)     ifTrue: [^ self pageDown].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2307
    (key == #HalfPageUp)   ifTrue: [^ self halfPageUp].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2308
    (key == #HalfPageDown) ifTrue: [^ self halfPageDown].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2309
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2310
    (key == #BeginOfText) ifTrue:[^ self scrollToTop].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2311
    (key == #EndOfText) ifTrue:[^ self scrollToBottom].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2312
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2313
    (key == #ScrollUp) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2314
	n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollUp).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2315
	^ self scrollUp:n
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2316
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2317
    (key == #ScrollDown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2318
	n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollDown).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2319
	^ self scrollDown:n
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2320
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2321
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2322
    super keyPress:key x:x y:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2323
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2324
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2325
mapped
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2326
    self stopAutoScroll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2327
    super mapped
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2328
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2329
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2330
mouseWheelZoom:amount
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2331
    "CTRL-wheel action"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2332
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2333
    |oldSize newSize delta mul currentFont|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2334
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2335
    amount > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2336
        "/ delta := 1.  mul := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2337
        delta := 0.  mul := 1.2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2338
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2339
        "/ delta := -1. mul := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2340
        delta := 0. mul := 0.8.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2341
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2342
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2343
    currentFont := gc font.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2344
    currentFont sizeUnit == #px ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2345
        oldSize := currentFont size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2346
        newSize := ((oldSize + delta)* mul) max:2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2347
        newSize ~= oldSize ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2348
            self font:(currentFont asSize:newSize).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2349
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2350
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2351
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2352
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2353
redrawX:x y:y width:w height:h
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2354
    "a region must be redrawn"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2355
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2356
    |startCol endCol line saveClip
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2357
     startLine "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2358
     stopLine  "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2359
    |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2360
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2361
    shown ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2362
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2363
    startLine := self visibleLineOfY:y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2364
    stopLine := self visibleLineOfY:(y + h).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2365
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2366
    saveClip := gc clippingBoundsOrNil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2367
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2368
    self paint:bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2369
    self fillRectangleX:x y:y width:w height:h.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2370
    backgroundAlreadyClearedColor := bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2371
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2372
    (includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2373
        "includes non strings or area is big enough: redraw whole lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2374
        self redrawFromVisibleLine:startLine to:stopLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2375
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2376
        line := self visibleAt:startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2377
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2378
        (fontIsFixedWidth and:[line isMemberOf:String]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2379
            "start/end col has to be computed for each line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2380
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2381
            startLine to:stopLine do:[:i |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2382
                startCol := self colOfX:x inVisibleLine:i.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2383
                endCol := self colOfX:(x + w) inVisibleLine:i.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2384
                startCol > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2385
                    endCol > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2386
                        self redrawVisibleLine:i from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2387
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2388
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2389
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2390
        ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2391
            "start/end col is the same for all lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2392
            startCol := self colOfX:x inVisibleLine:startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2393
            endCol := self colOfX:(x + w) inVisibleLine:startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2394
            startCol > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2395
                endCol > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2396
                    startLine to:stopLine do:[:i |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2397
                        line := self visibleAt:i.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2398
                        (line isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2399
                            self redrawVisibleLine:i from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2400
                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2401
                            self redrawVisibleLine:i
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2402
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2403
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2404
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2405
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2406
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2407
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2408
    backgroundAlreadyClearedColor := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2409
    self clippingRectangle:saveClip.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2410
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2411
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2412
sizeChanged:how
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2413
    "size changed - move origin up if possible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2414
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2415
    super sizeChanged:how.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2416
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2417
    self computeNumberOfLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2418
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2419
    innerWidth := width - textStartLeft - margin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2420
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2421
"/ Makes trouble when fighting with SelListViews sizeChanged-positioning ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2422
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2423
"/    shown ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2424
"/    list isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2425
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2426
"/    listSize := self numberOfLines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2427
"/    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2428
"/     if we are beyond the end, scroll up a bit
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2429
"/    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2430
"/    ((firstLineShown + nFullLinesShown) >= listSize) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2431
"/        self scrollToBottom.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2432
"/        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2433
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2434
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2435
    "Modified: / 18.11.1996 / 19:37:02 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2436
    "Modified: / 27.1.1998 / 14:10:04 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2437
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2438
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2439
unmap
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2440
    self stopAutoScroll.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2441
    super unmap
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2442
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2443
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2444
!ListView methodsFor:'initialization'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2445
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2446
create
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2447
    super create.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2448
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2449
    "I cache font parameters here - they are used so often ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2450
    self getFontParameters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2451
    self computeNumberOfLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2452
    fgColor := fgColor onDevice:self graphicsDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2453
    bgColor := bgColor onDevice:self graphicsDevice
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2454
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2455
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2456
defaultControllerClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2457
    self class == ListView ifTrue:[^ ListViewController].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2458
    ^ super defaultControllerClass
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2459
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2460
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2461
fetchDeviceResources
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2462
    "fetch device colors, to avoid reallocation at redraw time"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2463
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2464
    super fetchDeviceResources.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2465
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2466
    fgColor notNil ifTrue:[fgColor := fgColor onDevice:self graphicsDevice].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2467
    bgColor notNil ifTrue:[bgColor := bgColor onDevice:self graphicsDevice].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2468
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2469
    "Created: 14.1.1997 / 00:12:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2470
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2471
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2472
initStyle
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2473
    "setup viewStyle specifics"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2474
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2475
    |n|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2476
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2477
    super initStyle.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2478
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2479
    n := DefaultTopMargin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2480
    n isInteger ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2481
        n := (self verticalPixelPerMillimeter:n) rounded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2482
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2483
    self topMargin:n.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2484
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2485
    n := DefaultLeftMargin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2486
    n isInteger ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2487
        n := (self verticalPixelPerMillimeter:n) rounded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2488
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2489
    self leftMargin:n.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2490
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2491
    lineSpacing := 2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2492
    "/ q&d temporary hack.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2493
    "/ X11 fonts are currently so ugly... add more spacing.
5132
045af422a364 class: ListView
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  2494
    self graphicsDevice isX11Platform ifTrue:[
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2495
        lineSpacing := lineSpacing + 3.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2496
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2497
    fgColor := DefaultForegroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2498
    bgColor := DefaultBackgroundColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2499
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2500
    "Modified (comment): / 05-10-2011 / 15:51:02 / az"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2501
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2502
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2503
initialize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2504
    super initialize.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2505
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2506
    viewOrigin := 0@0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2507
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2508
    textStartTop := topMargin + margin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2509
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2510
    bitGravity := #NorthWest.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2511
    list := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2512
    firstLineShown := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2513
    nFullLinesShown := 1. "just any value ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2514
    nLinesShown := 1.     "just any value"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2515
    partialLines := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2516
    tabPositions := UserDefaultTabPositions ? DefaultTabPositions.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2517
    includesNonStrings := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2518
    lineEndCRLF := false.    
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2519
    checkedLinesForWidthOfContentsComputation := nil."/ i.e. all
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2520
    self getFontParameters.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2521
    self initializeWordCheckAction.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2522
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2523
    scrollWhenUpdating := #keep. "/ #beginOfText.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2524
    expandTabsWhenUpdating := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2525
    compareModelOnUpdate := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2526
    checkLineEndConventionWhenUpdating := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2527
    scrollLocked := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2528
    autoScroll := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2529
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2530
    "Modified: / 03-07-2006 / 17:03:59 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2531
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2532
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2533
initializeWordCheckAction
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2534
    "the wordCheck is a predicate block which returns true if the given character
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2535
     belongs to the (textual) word. Used with double click to select a word.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2536
     When editing code, typically characters which are part of an identifier
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2537
     are part of a word (underline, dollar, but no other non-letters).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2538
     The standardWordCheck aks the current userPreferences for details."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2539
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2540
    wordCheck := [:char | self standardWordCheck:char].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2541
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2542
    "Created: / 03-07-2006 / 17:03:50 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2543
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2544
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2545
realize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2546
    |sz|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2547
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2548
    self extentChangedFlag ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2549
	self computeNumberOfLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2550
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2551
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2552
    firstLineShown ~~ 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2553
	sz := self size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2554
	firstLineShown + nLinesShown > sz ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2555
	    self scrollToLine:sz - nLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2556
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2557
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2558
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2559
    super realize.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2560
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2561
"/ old: fetch models value on realize;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2562
"/ new: fetch value when model is assigned.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2563
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2564
"/    model notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2565
"/        self getListFromModel.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2566
"/    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2567
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2568
    "Modified: 15.8.1996 / 13:08:56 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2569
    "Modified: 28.2.1997 / 19:44:19 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2570
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2571
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2572
recreate
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2573
    "recreate after a snapin or a migration"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2574
    |n|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2575
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2576
    super recreate.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2577
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2578
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2579
     recompute margins and font parameters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2580
     - display may have different resolution/font sizes.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2581
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2582
"/    topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2583
"/    self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2584
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2585
    n := DefaultTopMargin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2586
    n isInteger ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2587
	n := (self verticalPixelPerMillimeter:n) rounded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2588
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2589
    self topMargin:n.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2590
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2591
    n := DefaultLeftMargin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2592
    n isInteger ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2593
	n := (self verticalPixelPerMillimeter:n) rounded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2594
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2595
    self leftMargin:n.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2596
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2597
    self getFontParameters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2598
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2599
    "Modified: / 26.9.1998 / 17:09:32 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2600
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2601
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2602
!ListView methodsFor:'private'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2603
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2604
absoluteLineToVisibleLine:absLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2605
    "given an absolute line (1..) return visible linenr or nil"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2606
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2607
    <resource:#obsolete>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2608
    self obsoleteMethodWarning:'use #listLineToVisibleLine:'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2609
    ^ self listLineToVisibleLine:absLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2610
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2611
"/    absLineNr isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2612
"/    (absLineNr < firstLineShown) ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2613
"/    (absLineNr >= (firstLineShown + nLinesShown)) ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2614
"/    ^ absLineNr - firstLineShown + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2615
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2616
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2617
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2618
checkForExistingLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2619
    "check if a line for lineNr exists; if not, expand text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2620
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2621
    list isNil ifTrue: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2622
	list := StringCollection new:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2623
	self contentsChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2624
    ] ifFalse: [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2625
	lineNr > (list size) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2626
	    self grow:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2627
	    self contentsChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2628
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2629
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2630
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2631
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2632
colOfX:x inVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2633
    "given a visible lineNr and x-coordinate, return colNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2634
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2635
    |lineString linePixelWidth xRel runCol posLeft posRight done
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2636
     hasEmphasis oPosRight oPosLeft|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2637
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2638
    xRel := x - textStartLeft + viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2639
    (xRel <= 0) ifTrue:[^ 1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2640
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2641
    lineString := self visibleAt:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2642
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2643
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2644
     for fix fonts, this is easy ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2645
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2646
    (fontIsFixedWidth
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2647
    and:[lineString isNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2648
          or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2649
        ^ (xRel // fontWidth) + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2650
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2651
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2652
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2653
     for variable fonts, more work is required ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2654
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2655
    lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2656
        lineString := self visibleStringFrom:lineString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2657
        (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2658
            linePixelWidth := lineString widthOn:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2659
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2660
            lineString := lineString string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2661
            linePixelWidth := gc font widthOf:lineString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2662
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2663
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2664
        linePixelWidth := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2665
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2666
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2667
    (linePixelWidth <= xRel) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2668
        fontWidth == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2669
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2670
             although this 'cannot happen',
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2671
             it seems that X reports this width for some strange fonts ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2672
            "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2673
            ^ lineString size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2674
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2675
        ^ lineString size + ((xRel - linePixelWidth) // fontWidth) + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2676
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2677
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2678
    "/ cannot simply count individual characters,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2679
    "/ since kerning or other non-linear effects may be involved ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2680
    "/ use a binary search, initialized with some guess.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2681
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2682
    "/ a guess: take some 'average' character's width and compute an initial guess
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2683
    runCol := x // (gc font widthOf:'e').
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2684
    runCol := runCol min:lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2685
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2686
"/    runCol := lineString size // 2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2687
"/    (runCol == 0) ifTrue:[runCol := 1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2688
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2689
    hasEmphasis ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2690
        posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2691
        posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2692
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2693
        posLeft := gc font widthOf:lineString from:1 to:(runCol - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2694
        posRight := gc font widthOf:lineString from:1 to:runCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2695
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2696
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2697
    done := (posLeft <= xRel) and:[posRight > xRel].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2698
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2699
    [done] whileFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2700
        oPosRight := posRight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2701
        oPosLeft := posLeft.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2702
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2703
        (posRight <= xRel) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2704
            runCol := runCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2705
            posLeft := posRight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2706
            hasEmphasis ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2707
                posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2708
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2709
                posRight := gc font widthOf:lineString from:1 to:runCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2710
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2711
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2712
            (posLeft > xRel) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2713
                runCol := runCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2714
                (runCol == 0) ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2715
                posRight := posLeft.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2716
                hasEmphasis ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2717
                    posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2718
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2719
                    posLeft := gc font widthOf:lineString from:1 to:(runCol - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2720
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2721
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2722
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2723
        done := (posLeft <= xRel) and:[posRight > xRel].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2724
"234567890123456789012345678901234567890"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2725
        ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2726
            "/ paranoia: just in case there are unprintable characters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2727
            "/ (avoid endless loop if the binary search does not make progress)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2728
            done := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2729
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2730
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2731
"/self paint:Color red.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2732
"/self displayRectangleX:posLeft+textStartLeft-viewOrigin x y:(self yOfVisibleLine:visLineNr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2733
"/                       width:(posRight-posLeft) height:fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2734
"/self paint:Color black.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2735
    ^ runCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2736
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2737
    "Modified: / 25-04-2011 / 11:26:58 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2738
    "Modified: / 02-05-2011 / 14:08:54 / sr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2739
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2740
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2741
computeNumberOfLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2742
    "recompute the number of visible lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2743
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2744
    |innerHeight|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2745
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2746
    innerHeight := self innerHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2747
    nFullLinesShown := (innerHeight + lineSpacing) // fontHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2748
    nLinesShown := nFullLinesShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2749
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2750
    partialLines ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2751
	((nLinesShown * fontHeight) < innerHeight) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2752
	    nLinesShown := nLinesShown + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2753
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2754
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2755
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2756
    "Modified: 29.5.1996 / 14:48:43 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2757
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2758
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2759
convertRTF:aList
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2760
    <resource: #obsolete>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2761
    "this is a q&d RTF to poor-text converter which removes any rich stuff.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2762
     - a first shot 'til  DocumentView is finished ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2763
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2764
    |newList newLine charIndex inEscape char special|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2765
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2766
    self obsoleteMethodWarning.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2767
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2768
    newList := StringCollection new:200.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2769
    newList grow:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2770
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2771
    newLine := ''.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2772
    aList do:[:line |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2773
	((line size == 0) or:[line isBlank]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2774
	    newList add:newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2775
	    newLine := ''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2776
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2777
	    special := ((line at:1) == ${) or:[(line includes:$\)].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2778
	    special := special or:[(line at:1) == $}].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2779
	    special ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2780
		newList add:(newLine , line)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2781
	    ] ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2782
		charIndex := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2783
		[charIndex <= line size] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2784
		    char := line at:charIndex.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2785
		    ((char == ${ ) or:[char == $} ]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2786
			"left-brace: ignore rest of line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2787
			charIndex := line size + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2788
		    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2789
			(char == $\) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2790
			    inEscape := true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2791
			] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2792
			    inEscape ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2793
				(char == Character space) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2794
				    inEscape := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2795
				]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2796
			    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2797
				newLine := newLine copyWith:char
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2798
			    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2799
			].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2800
			charIndex := charIndex + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2801
		    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2802
		]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2803
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2804
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2805
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2806
    ^ newList
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2807
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2808
    "Modified: 18.5.1996 / 14:03:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2809
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2810
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2811
enqueueDelayedContentsChangedNotification
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2812
    "because contentschanged may be slow (recomputing width of widest line),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2813
     we delay its execution by pushing it onto the event queue.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2814
     This has the effect of allowing for multiple add-lines before recomputing.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2815
     Much speeding up inserting into long lists"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2816
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2817
    |sensor|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2818
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2819
    sensor := self sensor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2820
    (sensor hasUserEvent:#contentsChanged for:self) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2821
        sensor pushUserEvent:#contentsChanged for:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2822
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2823
    "/ used to be syncronous:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2824
    "/ self contentsChanged.             "recompute scrollbars"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2825
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2826
    "Created: / 25-07-2012 / 11:59:58 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2827
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2828
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2829
getFontParameters
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2830
    "get some info of the used font. They are cached since we use them often ..
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2831
     The code below uses the fonts average height parameters - these
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2832
     are not OK for some oversized national characters (such as A-dieresis).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2833
     Therefore, this method should be redefined in views which will be used
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2834
     with national characters (i.e. editTextViews)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2835
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2836
    |hMax newDeviceFont|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2837
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2838
    newDeviceFont := gc createFontOnDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2839
    hMax := newDeviceFont height.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2840
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2841
    includesNonStrings == true ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2842
        "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2843
        "/ find maximum height of lines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2844
        "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2845
        hMax := list inject:hMax into:[:maxSoFar :thisLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2846
                                        thisLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2847
                                            maxSoFar
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2848
                                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2849
                                            (thisLine isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2850
                                                maxSoFar
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2851
                                            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2852
                                                maxSoFar max:(thisLine heightOn:self)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2853
                                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2854
                                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2855
                              ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2856
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2857
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2858
    fontHeight := newDeviceFont maxHeight.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2859
    "/ fontHeight := font height.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2860
    fontHeight := fontHeight max:(hMax + lineSpacing).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2861
    fontAscent := newDeviceFont ascent. "/ maxAscent. -- see SelectionInListViews selection in motif style
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2862
    "/ fontAscent := font maxAscent "ascent". "/ maxAscent. -- see SelectionInListViews selection in motif style
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2863
    "/ fontAscent := (font maxAscent + font ascent) // 2. "/ maxAscent. -- see SelectionInListViews selection in motif style
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2864
    fontWidth := newDeviceFont width.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2865
    fontIsFixedWidth := newDeviceFont isFixedWidth.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2866
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2867
    "Modified: 3.7.1997 / 12:24:25 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2868
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2869
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2870
getListFromModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2871
    "ask my model (if any) for the text via the listMsg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2872
     If there is no listMessage, try aspect for backward compatibility."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2873
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2874
    |newText msg|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2875
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2876
    model notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2877
        msg := listMsg ? aspectMsg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2878
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2879
        msg notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2880
            newText := model perform:msg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2881
            "/ cg: this makes many optimizations (virtualArray) useless;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2882
            "/ I do not think that this is a good idea:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2883
            "/     text notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2884
            "/ so I changed it to:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2885
            (newText notNil and:[newText isString]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2886
                newText := newText asStringCollection.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2887
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2888
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2889
            compareModelOnUpdate ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2890
                "/ see if there is a change at all.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2891
                "/ use to compare using =, but that's not enough in case of emphasis change.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2892
                newText size == list size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2893
                    |same|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2894
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2895
                    same := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2896
                    newText size > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2897
                        newText with:list do:[:eachNewLine :eachOldLine |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2898
                            (eachNewLine == eachOldLine) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2899
                                same := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2900
                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2901
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2902
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2903
                    same ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2904
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2905
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2906
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2907
            "/ SV: this compare does not work, if model uses (i.e. updates)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2908
            "/ the same stringCollection as the view!!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2909
            true "text ~= list" ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2910
                "/ changed #list to care for scrollLocked
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2911
"/                scrollLocked ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2912
"/                    self setList:newText expandTabs:expandTabsWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2913
"/                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2914
                    self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2915
"/                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2916
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2917
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2918
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2919
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2920
    "Modified: 26.4.1996 / 14:09:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2921
    "Modified: 19.2.1997 / 12:08:50 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2922
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2923
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2924
getListFromModelScroll:aBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2925
    "ask my model (if any) for the text via the listMsg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2926
     If there is no listMessage, try aspect for backward compatibility.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2927
     If aBoolean is false, scrolling is suppressed here"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2928
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2929
    |prev|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2930
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2931
    prev := scrollLocked.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2932
    scrollLocked := aBoolean not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2933
    [
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2934
        self getListFromModel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2935
    ] ensure:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2936
        scrollLocked := prev.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2937
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2938
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2939
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2940
line:line withoutEmphasis:emphasisToRemove
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2941
    (line notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2942
    and:[line isString]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2943
	^ line withoutEmphasis:emphasisToRemove.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2944
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2945
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2946
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2947
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2948
listAt:lineNr from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2949
    "return right substring from startCol to end of a line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2950
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2951
    |line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2952
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2953
    line := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2954
    line isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2955
    (startCol > line size) ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2956
    ^ line copyFrom:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2957
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2958
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2959
listAt:lineNr from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2960
    "return substring from startCol to endCol of a line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2961
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2962
    |line lineLen nCols|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2963
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2964
    nCols := (endCol - startCol + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2965
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2966
    line := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2967
    lineLen := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2968
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2969
    (line isNil or:[startCol > lineLen]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2970
        (nCols > 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2971
            ^ (String new:nCols)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2972
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2973
        ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2974
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2975
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2976
    (endCol > lineLen) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2977
        ^ (line copyFrom:startCol to:lineLen) , (String new:(endCol-lineLen))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2978
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2979
    ^ line copyFrom:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2980
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2981
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2982
listAt:lineNr to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2983
    "return left substring from start to endCol of a line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2984
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2985
    |line lineSize|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2986
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2987
    line := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2988
    line isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2989
        (endCol > 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2990
            ^ (String new:endCol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2991
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2992
        ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2993
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2994
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2995
    lineSize := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2996
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2997
    (endCol > lineSize) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2998
        ^ (line copyTo:lineSize) , (String new:(endCol - lineSize)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  2999
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3000
    ^ line copyTo:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3001
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3002
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3003
listLineIsVisible:listLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3004
    "return true,  if a particular line is visible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3005
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3006
    |visibleLineNr "{ Class: SmallInteger }"|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3007
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3008
    shown ifFalse:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3009
    listLineNr isNil ifTrue:[^ false].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3010
    visibleLineNr := listLineNr + 1 - firstLineShown.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3011
    ^ (visibleLineNr between:1 and:nLinesShown)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3012
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3013
    "Created: / 26.7.1998 / 13:24:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3014
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3015
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3016
listLineToVisibleLine:listLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3017
    "given a list line (1..) return visible linenr or nil"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3018
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3019
    |visibleLineNr "{ Class: SmallInteger }"|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3020
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3021
    shown ifFalse:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3022
    listLineNr isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3023
    visibleLineNr := listLineNr - firstLineShown + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3024
    (visibleLineNr between:1 and:nLinesShown) ifFalse:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3025
    ^ visibleLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3026
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3027
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3028
recomputeWidthOfWidestLineFor:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3029
    <resource: #obsolete>
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3030
    self recomputeWidthOfWidestLineFor:aString old:nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3031
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3032
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3033
recomputeWidthOfWidestLineFor:newEntry old:oldEntry
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3034
    "a new line was added (oldEntry == nil) or replaced oldEntry.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3035
     Update the widthOfWidestLine cache or flush it, if we cannot easily 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3036
     figure out the overall text width"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3037
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3038
    |newW oldW|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3039
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3040
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3041
        newEntry isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3042
            newW := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3043
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3044
            (newEntry isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3045
                newW := gc font widthOf:newEntry
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3046
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3047
                newW := newEntry widthOn:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3048
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3049
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3050
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3051
        newW >= widthOfWidestLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3052
            widthOfWidestLine := newW.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3053
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3054
            oldEntry isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3055
                oldW := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3056
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3057
                (oldEntry isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3058
                    oldW := gc font widthOf:oldEntry
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3059
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3060
                    oldW := oldEntry widthOn:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3061
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3062
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3063
            newW > oldW ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3064
                "/ no change; new entries width is between this width and amx width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3065
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3066
                "/ new entry is smaller than oldEntry; if the oldEntry was the previos max,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3067
                "/ we don't know the new max
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3068
                oldW = widthOfWidestLine ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3069
                    widthOfWidestLine := nil "/ means: unknown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3070
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3071
                    "/ old line was not the widest, and new line is shorter;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3072
                    "/ no change
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3073
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3074
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3075
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3076
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3077
    ^ widthOfWidestLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3078
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3079
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3080
suppressEmphasisInSelection
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3081
    "selection is shown with original emphasis"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3082
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3083
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3084
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3085
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3086
textChanged
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3087
    "ignored here"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3088
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3089
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3090
visibleAt:visibleLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3091
    "return what is visible at line (numbers start at 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3092
     This is used for redrawing; i.e. for non-string entries, this
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3093
     returns the original."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3094
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3095
    |listLineNr listsize|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3096
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3097
    listLineNr := visibleLineNr + firstLineShown - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3098
    (listLineNr == 0) ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3099
    (list notNil) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3100
	listsize := self size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3101
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3102
	listsize := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3103
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3104
    (listLineNr <= listsize) ifTrue:[^ self at:listLineNr].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3105
    ^ ''
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3106
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3107
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3108
visibleLineOfY:y
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3109
    "given a y-coordinate, return the visible lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3110
     - works for fix-height fonts only"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3111
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3112
    ^ (((y - textStartTop) // fontHeight) + 1) max:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3113
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3114
    "Modified: / 13.2.1998 / 20:57:26 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3115
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3116
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3117
visibleLineToAbsoluteLine:visibleLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3118
    "given a visible line (1..) return absolut linenr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3119
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3120
    visibleLineNr isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3121
    ^ visibleLineNr + firstLineShown - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3122
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3123
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3124
visibleLineToListLine:visibleLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3125
    "given a visible line (1..) return linenr in list or nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3126
     (this one returns nil if the given visibleLineNr is one of the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3127
     separators)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3128
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3129
    |listLineNr  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3130
     listsize    "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3131
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3132
    visibleLineNr isNil ifTrue:[^ nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3133
    listLineNr := visibleLineNr + firstLineShown - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3134
    (listLineNr == 0) ifTrue:[^nil].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3135
    listsize := self size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3136
    (listLineNr <= listsize) ifTrue:[^ listLineNr].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3137
    ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3138
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3139
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3140
visibleStringFrom:aString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3141
    ^ aString asString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3142
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3143
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3144
widthForScrollBetween:firstLine and:lastLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3145
    "return the width in pixels for a scroll between firstLine and lastLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3146
     - used to optimize scrolling, by limiting the scrolled area.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3147
     Subclasses with selections or other additional visible stuff should redefine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3148
     this method."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3149
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3150
    ^ innerWidth
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3151
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3152
"/    "for small width, its not worth searching for
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3153
"/     longest line ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3154
"/    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3155
"/    (width < 300) ifTrue:[^ innerWidth].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3156
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3157
"/    "for large lists, search may take longer than scrolling full
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3158
"/    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3159
"/    self size > 2000 ifTrue:[^ innerWidth].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3160
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3161
"/    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3162
"/     if there is a pattern-background, we have to scroll everything
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3163
"/    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3164
"/    (viewBackground isColor not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3165
"/     or:[viewBackground isDithered]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3166
"/        ^ width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3167
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3168
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3169
"/    w := self widthOfWidestLineBetween:firstLine and:lastLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3170
"/    (w > innerWidth) ifTrue:[^ innerWidth].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3171
"/    ^ w
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3172
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3173
    "Modified: 17.1.1997 / 17:44:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3174
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3175
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3176
widthOfLineString:entry
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3177
    "return the width of an entry"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3178
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3179
    entry isNil ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3180
    (entry isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3181
        ^ gc font widthOf:entry
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3182
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3183
    ^ entry widthOn:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3184
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3185
    "Modified: 12.5.1996 / 20:09:53 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3186
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3187
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3188
widthOfWidestLineBetween:firstLine and:lastLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3189
    "return the width in pixels of the widest line in a range
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3190
     - used to optimize scrolling, by limiting the scrolled area"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3191
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3192
    |max      "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3193
     first    "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3194
     last     "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3195
     thisLen  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3196
     listSize "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3197
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3198
    includesNonStrings ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3199
        ^ width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3200
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3201
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3202
    fontIsFixedWidth ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3203
        ^ (self lengthOfLongestLineBetween:firstLine and:lastLine) * fontWidth
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3204
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3205
    listSize := self size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3206
    max := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3207
    first := firstLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3208
    last := lastLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3209
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3210
    (first > listSize) ifTrue:[^ max].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3211
    (last > listSize) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3212
        last := listSize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3213
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3214
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3215
    self from:first to:last do:[:line |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3216
        line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3217
            (line isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3218
                thisLen := gc font widthOf:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3219
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3220
                thisLen := line widthOn:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3221
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3222
            (thisLen > max) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3223
                max := thisLen
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3224
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3225
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3226
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3227
    ^ max
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3228
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3229
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3230
withoutAnyColorEmphasis:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3231
    (line notNil and:[line isText]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3232
        ^ line withoutAnyColorEmphasis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3233
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3234
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3235
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3236
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3237
     'hello' asText colorizeAllWith:Color red.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3238
     ('hello' asText colorizeAllWith:Color red) withoutForegroundColorEmphasis.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3239
     ('hello' asText colorizeAllWith:Color red) withoutAnyColorEmphasis.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3240
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3241
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3242
    "Modified (comment): / 06-03-2012 / 18:16:41 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3243
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3244
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3245
withoutBackgroundColorEmphasis:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3246
    (line notNil and:[line isText]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3247
        ^ line withoutBackgroundColorEmphasis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3248
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3249
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3250
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3251
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3252
withoutColorEmphasis:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3253
    (line notNil and:[line isText]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3254
        ^ line withoutForegroundColorEmphasis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3255
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3256
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3257
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3258
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3259
withoutColorEmphasis:line ifFg:fg andBg:bg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3260
    "/ remove lines color emphasis, to enforce color.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3261
    "/ otherwise blue text is not visible if selection-bg is blue
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3262
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3263
    (line notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3264
    and:[line isText
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3265
    and:[fg ~= fgColor or:[bg ~= bgColor]]]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3266
        ^ line withoutAnyColorEmphasis
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3267
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3268
    ^ line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3270
    "Created: / 15-12-1999 / 23:19:30 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3271
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3272
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3273
xOfCol:col inVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3274
    "given a visible line- and colNr, return the x-coordinate in view"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3275
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3276
    |line lineSize tcol lText|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3277
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3278
    col == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3279
        lText := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3280
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3281
        tcol := col - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3282
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3283
        line := self visibleAt:visLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3284
        (fontIsFixedWidth
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3285
        and:[line isNil or:[line isMemberOf:String]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3286
        ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3287
            lText := (tcol * fontWidth)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3288
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3289
            line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3290
                lineSize := line string size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3291
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3292
                lineSize := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3293
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3294
            (lineSize == 0) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3295
                lText := (tcol * fontWidth)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3296
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3297
                (lineSize < col) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3298
                    lText := (line widthOn:self) + (fontWidth * (tcol - lineSize))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3299
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3300
                    (line isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3301
                        lText := (gc font widthOf:line from:1 to:tcol)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3302
                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3303
                        lText := line widthFrom:1 to:tcol on:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3304
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3305
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3306
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3307
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3308
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3309
    ^ lText + textStartLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3310
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3311
    "Modified: / 3.9.1998 / 21:56:33 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3312
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3313
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3314
yOfLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3315
    "given a physical lineNr, return y-coordinate in view
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3316
     - works for fix-height fonts only"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3317
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3318
    |visLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3319
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3320
    visLine := self listLineToVisibleLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3321
    visLine isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3322
        ^ nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3323
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3324
    ^ self yOfVisibleLine:visLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3325
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3326
    "Created: / 26.7.1998 / 13:23:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3327
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3328
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3329
yOfVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3330
    "given a visible lineNr, return y-coordinate in view
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3331
     - works for fix-height fonts only"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3332
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3333
    "/ care for visLineNr being nil during initialization
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3334
    ^ (((visLineNr ? 1) - 1) * fontHeight) + textStartTop
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3335
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3336
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3337
yVisibleToLineNr:yVisible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3338
    |vL|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3339
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3340
    vL := self visibleLineOfY:yVisible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3341
    ^ self visibleLineToListLine:vL
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3342
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3343
    "Created: / 20-09-2006 / 15:29:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3344
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3345
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3346
!ListView methodsFor:'queries'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3347
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3348
characterPositionOfLine:lineNr col:colArg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3349
    "given a line/col position, return the character index within the contents-string,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3350
     - used with compiler's error-positioning, which is based on character positions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3351
     of the contents-string."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3352
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3353
    |lineString charPos lineEndCharSize col|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3354
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3355
    lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3356
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3357
    self checkForExistingLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3358
    charPos := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3359
    1 to:(lineNr - 1) do:[:lnr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3360
        lineString := self at:lnr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3361
        lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3362
            charPos := charPos + (lineString string "withoutTrailingSeparators") size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3363
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3364
        charPos := charPos + lineEndCharSize   "the return-character"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3365
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3366
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3367
    "/ if beyond end of line, be careful to not advance into next line.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3368
    "/ otherwise, syntaxHighlighter (and others) walk into trouble,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3369
    "/ if clicked on a space beyond a line's end.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3370
    col := colArg min:((self at:lineNr) size + 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3371
    ^ charPos + col - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3372
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3373
    "Modified: / 04-07-2006 / 19:14:25 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3374
    "Modified: / 21-08-2011 / 11:03:19 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3375
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3376
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3377
colOfCharacterPosition:charPos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3378
    "given a character index within the contents-string,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3379
     return the column number where the character is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3380
     - used to find line to hilight from Compilers error-position"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3381
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3382
    |line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3383
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3384
    line := self lineOfCharacterPosition:charPos.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3385
    ^ charPos - (self characterPositionOfLine:line col:1) + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3386
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3387
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3388
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3389
currentLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3390
    "the current line (for relative gotos);
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3391
     since listViews have no cursor, the first shown line is returned here.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3392
     Redefined in editTextView, to return the cursors line."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3393
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3394
    ^ firstLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3395
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3396
    "Created: / 17.5.1998 / 20:07:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3397
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3398
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3399
firstLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3400
    "return the index of the first (possibly partial) visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3401
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3402
    ^ firstLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3403
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3404
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3405
heightForLines:numberOfLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3406
    "return the height of the receiver, if numberOfLines are to be displayed"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3407
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3408
    |realFont|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3409
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3410
    "need a device font for query"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3411
    realFont := gc createFontOnDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3412
    ^ numberOfLines * fontHeight + topMargin + realFont descent + (lineSpacing) + (margin * 2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3413
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3414
    "Created: 27.1.1996 / 16:55:39 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3415
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3416
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3417
heightOfContents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3418
    "return the height of the contents in pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3419
     - used for scrollbar interface"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3420
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3421
    | numLines  realFont|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3422
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3423
    numLines := self numberOfLines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3424
    numLines == 0 ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3425
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3426
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3427
    "/ kludge for last partial line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3428
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3429
"/    nFullLinesShown ~~ nLinesShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3430
"/        numLines := numLines + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3431
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3432
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3433
     need device-font for query
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3434
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3435
    realFont := gc createFontOnDevice.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3436
    ^ numLines * fontHeight "dont take font height here - think of LabelAndIcons"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3437
"/                            + textStartTop
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3438
                            - (lineSpacing // 2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3439
                            + (realFont descent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3440
"/                            + (font descent)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3441
"/                            + (font descent * 2) "makes it look better"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3442
                                .
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3443
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3444
"/    "it used to be that code - which is wrong"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3445
"/    (nLinesShown == nFullLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3446
"/        ^ numLines * fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3447
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3448
"/    "add one - otherwise we cannot make last line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3449
"/     fully visible since scrolling is done by full lines only"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3450
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3451
"/    ^ (numLines + 1) * fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3452
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3453
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3454
lastLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3455
    "return the index of the last (possibly partial) visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3456
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3457
    ^ firstLineShown + nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3458
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3459
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3460
leftIndentOfLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3461
    "return the number of spaces at the left in line, lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3462
     returns 0 for empty lines."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3463
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3464
    |lineString indent|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3465
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3466
    lineString := self listAt:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3467
    lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3468
	indent := lineString leftIndent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3469
	indent == lineString size ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3470
	^ indent.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3471
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3472
    ^ 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3473
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3474
    "Modified: 20.4.1996 / 19:30:38 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3475
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3476
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3477
lengthOfLongestLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3478
    "return the length (in characters) of the longest line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3479
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3480
    ^ self lengthOfLongestLineBetween:1 and:self size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3481
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3482
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3483
lengthOfLongestLineBetween:firstLine and:lastLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3484
    "return the length (in characters) of the longest line in a line-range"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3485
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3486
    |max      "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3487
     thisLen  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3488
     listSize "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3489
     first    "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3490
     last     "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3491
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3492
    list isNil ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3493
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3494
    listSize := self size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3495
    max := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3496
    first := firstLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3497
    last := lastLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3498
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3499
    (first > listSize) ifTrue:[^ max].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3500
    (last > listSize) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3501
	last := listSize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3502
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3503
    self from:first to:last do:[:lineString |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3504
	lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3505
	    thisLen := lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3506
	    (thisLen > max) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3507
		max := thisLen
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3508
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3509
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3510
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3511
    ^ max
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3512
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3513
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3514
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3515
lineIsFullyVisible:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3516
    "is line fully visible?"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3517
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3518
    (line >= firstLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3519
     and:[ line < (firstLineShown + nFullLinesShown) ]) ifTrue:[ ^ true ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3520
    ^ false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3521
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3522
    "Created: 26.4.1996 / 14:36:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3523
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3524
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3525
lineIsVisible:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3526
    "is line visible?"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3527
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3528
    (line >= firstLineShown and:[ line < (firstLineShown + nLinesShown) ]) ifTrue:[ ^ true ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3529
    ^ false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3530
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3531
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3532
lineOfCharacterPosition:charPos
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3533
    "given a character index within the contents-string,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3534
     return the lineNumber where the character is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3535
     - used to find line to hilight from compiler's error-position"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3536
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3537
    |lineNr sum lastLine lineEndCharSize l|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3538
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3539
    lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3540
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3541
    lineNr := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3542
    sum := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3543
    lastLine := self size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3544
    [(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3545
        l := (self at:lineNr) ? ''.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3546
        sum := sum + (l string "withoutTrailingSeparators" size) + lineEndCharSize.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3547
        lineNr := lineNr + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3548
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3549
    sum == charPos ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3550
        ^ lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3551
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3552
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3553
    ^ (lineNr - 1) max:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3554
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3555
    "Modified: / 04-07-2006 / 19:13:32 / fm"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3556
    "Modified: / 21-08-2011 / 10:50:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3557
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3558
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3559
numberOfLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3560
    "return the number of lines the text has"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3561
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3562
    ^ self size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3563
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3564
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3565
preferredExtentForContents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3566
    ^ (self widthOfContents @ self heightOfContents)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3567
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3568
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3569
preferredExtentForLines:numLines cols:numCols
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3570
    ^ (((gc font widthOf:'x') * numCols + margin + margin)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3571
      @
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3572
      (fontHeight * numLines + margin + margin + gc font descent + lineSpacing + topMargin)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3573
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3574
    "Modified: 26.5.1996 / 12:26:41 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3575
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3576
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3577
supportsSyntaxElements
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3578
    "see CodeView2::TextView"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3579
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3580
    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3581
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3582
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3583
widthOfContents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3584
    "return the width of the contents in pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3585
     - used for scrollbar interface"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3586
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3587
    |f d 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3588
     start "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3589
     stop  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3590
     lengthOfLongestString  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3591
     lengthOfLongestLine    "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3592
     max   "{ Class: SmallInteger }"|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3593
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3594
    list isEmptyOrNil ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3595
    widthOfWidestLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3596
        "/ already computed (cached); this cache is cleared when the contents is modified
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3597
        ^ widthOfWidestLine + (leftMargin * 2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3598
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3599
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3600
    (d := gc device) isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3601
        "/ mhmh - really dont know yet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3602
        d := Screen current
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3603
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3604
    f := gc font onDevice:d.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3605
    gc font:f.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3606
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3607
    checkedLinesForWidthOfContentsComputation isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3608
        start := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3609
        stop := list size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3610
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3611
        checkedLinesForWidthOfContentsComputation >= 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3612
            start := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3613
            stop := (checkedLinesForWidthOfContentsComputation min:list size)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3614
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3615
            stop := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3616
            start := (list size + 1 + checkedLinesForWidthOfContentsComputation) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3617
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3618
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3619
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3620
    includesNonStrings ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3621
        max := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3622
        start to:stop do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3623
            |entry w|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3624
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3625
            entry := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3626
            entry notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3627
                (entry isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3628
                    w := f widthOf:entry
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3629
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3630
                    w := entry widthOn:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3631
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3632
                max := max max:w.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3633
             ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3634
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3635
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3636
        fontIsFixedWidth ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3637
            max := lengthOfLongestString := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3638
            list notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3639
                start to:stop do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3640
                    |line|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3641
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3642
                    line := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3643
                    line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3644
                        (line isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3645
                            line size > lengthOfLongestString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3646
                                lengthOfLongestString := line size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3647
                            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3648
                        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3649
                            max := max max:(line widthOn:self)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3650
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3651
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3652
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3653
                max := max max:(lengthOfLongestString * fontWidth)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3654
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3655
        ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3656
            max := lengthOfLongestLine := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3657
            list notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3658
                start to:stop do:[:lineNr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3659
                    |line len|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3660
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3661
                    line := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3662
                    line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3663
                        len := line size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3664
                        "/ consider this a speed hack (not exact, but fast)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3665
                        lengthOfLongestLine := lengthOfLongestLine max:len.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3666
                        len > (lengthOfLongestLine // 3) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3667
                            max := max max:(line widthOn:self)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3668
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3669
                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3670
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3671
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3672
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3673
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3674
    widthOfWidestLine := max.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3675
    ^ max + (leftMargin * 2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3676
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3677
    "Modified: / 24.9.1998 / 18:21:08 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3678
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3679
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3680
widthOfLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3681
    "return the width of a line in pixels"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3682
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3683
    |line f d|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3684
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3685
    list isNil ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3686
    lineNr > list size ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3687
    line := list at:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3688
    list isNil ifTrue:[^ 0].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3689
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3690
    (d := self graphicsDevice) isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3691
        "/ mhmh - really dont know yet
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3692
        d := Screen current
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3693
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3694
    f := gc font onDevice:d.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3695
    gc font:f.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3696
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3697
    (line isMemberOf:String) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3698
        ^ f widthOf:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3699
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3700
    ^ line widthOn:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3701
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3702
    "Created: / 10.11.1998 / 23:59:20 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3703
    "Modified: / 11.11.1998 / 15:25:07 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3704
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3705
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3706
xOriginOfContents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3707
    "return the horizontal origin of the contents in pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3708
     - used for scrollbar interface"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3709
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3710
    ^ viewOrigin x
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3711
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3712
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3713
yOriginOfContents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3714
    "return the vertical origin of the contents in pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3715
     - used for scrollbar interface"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3716
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3717
    ^ (firstLineShown - 1) * fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3718
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3719
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3720
!ListView methodsFor:'redrawing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3721
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3722
flash
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3723
    "show contents in reverse colors for a moment - to wakeup the user :-)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3724
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3725
    super flash.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3726
"/    self redrawInverted.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3727
"/    Delay waitForSeconds:0.1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3728
"/    self redraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3729
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3730
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3731
     Transcript flash
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3732
     Transcript redrawInverted
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3733
     Transcript redraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3734
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3735
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3736
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3737
redraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3738
    "redraw complete view"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3739
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3740
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3741
	self redrawFromVisibleLine:1 to:nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3742
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3743
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3744
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3745
redrawFromLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3746
    "redraw starting at linrNr"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3747
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3748
    |visibleLine first|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3749
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3750
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3751
	"if first line to redraw is above 1st visible line,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3752
	 start redraw at 1st visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3753
	(lineNr < firstLineShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3754
	    first := firstLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3755
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3756
	    first := lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3757
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3758
	visibleLine := self listLineToVisibleLine:first.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3759
	visibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3760
	    self redrawFromVisibleLine:visibleLine to:nLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3761
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3762
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3763
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3764
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3765
redrawFromLine:startLine col:startCol toLine:endLine col:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3766
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3767
	self redrawLine:startLine from:startCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3768
	endLine > (startLine+1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3769
	    self redrawFromLine:startLine+1 to:endLine-1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3770
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3771
	self redrawLine:endLine from:1 to:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3772
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3773
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3774
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3775
redrawFromLine:start to:end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3776
    "redraw lines from start to end"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3777
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3778
    |visibleFirst visibleLast first last lastLineShown|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3779
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3780
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3781
	lastLineShown := firstLineShown + nLinesShown - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3782
	(start <= lastLineShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3783
	    (end >= firstLineShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3784
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3785
		"if first line to redraw is above 1st visible line,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3786
		 start redraw at 1st visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3787
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3788
		(start < firstLineShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3789
		    first := firstLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3790
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3791
		    first := start
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3792
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3793
		(end > lastLineShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3794
		    last := lastLineShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3795
		] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3796
		    last := end
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3797
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3798
		visibleFirst := self listLineToVisibleLine:first.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3799
		visibleLast := self listLineToVisibleLine:last.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3800
		self redrawFromVisibleLine:visibleFirst to:visibleLast
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3801
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3802
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3803
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3804
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3805
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3806
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3807
    "redraw a visible line range"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3808
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3809
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3810
	self drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fgColor and:bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3811
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3812
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3813
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3814
redrawInverted
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3815
    "show contents in reverse colors"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3816
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3817
    |savFg savBg|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3818
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3819
    savFg := fgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3820
    savBg := bgColor.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3821
    fgColor := savBg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3822
    bgColor := savFg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3823
    self redraw.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3824
    fgColor := savFg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3825
    bgColor := savBg.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3826
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3827
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3828
redrawLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3829
    "redraw a list line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3830
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3831
    |visibleLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3832
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3833
    visibleLine := self listLineToVisibleLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3834
    visibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3835
	self redrawVisibleLine:visibleLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3836
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3837
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3838
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3839
redrawLine:lineNr col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3840
    "redraw a single character"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3841
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3842
    |visibleLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3843
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3844
    visibleLine := self listLineToVisibleLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3845
    visibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3846
	self redrawVisibleLine:visibleLine col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3847
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3848
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3849
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3850
redrawLine:lineNr from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3851
    "redraw a list line from startCol to end of line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3852
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3853
    |visibleLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3854
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3855
    visibleLine := self listLineToVisibleLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3856
    visibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3857
	self redrawVisibleLine:visibleLine from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3858
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3859
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3860
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3861
redrawLine:lineNr from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3862
    "redraw a list line from startCol to endCol"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3863
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3864
    |visibleLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3865
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3866
    visibleLine := self listLineToVisibleLine:lineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3867
    visibleLine notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3868
	self redrawVisibleLine:visibleLine from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3869
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3870
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3871
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3872
redrawVisibleLine:visLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3873
    "redraw a visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3874
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3875
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3876
	self drawVisibleLine:visLineNr with:fgColor and:bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3877
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3878
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3879
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3880
redrawVisibleLine:visLineNr col:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3881
    "redraw single character at col index of visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3882
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3883
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3884
	self drawVisibleLine:visLineNr col:col with:fgColor and:bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3885
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3886
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3887
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3888
redrawVisibleLine:visLineNr from:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3889
    "redraw right part of a visible line from startCol to end of line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3890
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3891
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3892
	self drawVisibleLine:visLineNr from:startCol with:fgColor and:bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3893
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3894
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3895
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3896
redrawVisibleLine:visLineNr from:startCol to:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3897
    "redraw part of a visible line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3898
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3899
    shown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3900
	startCol == endCol ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3901
	    self redrawVisibleLine:visLineNr col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3902
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3903
	    self drawVisibleLine:visLineNr from:startCol to:endCol with:fgColor and:bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3904
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3905
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3906
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3907
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3908
!ListView methodsFor:'scrolling'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3909
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3910
gotoLine:aLineNumber
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3911
    "position to line aLineNumber; this may be redefined
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3912
     in subclasses (for example to move the cursor also)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3913
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3914
    ^ self scrollToLine:aLineNumber
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3915
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3916
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3917
halfPageDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3918
    "scroll down half a page"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3919
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3920
    self scrollDown:(nFullLinesShown // 2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3921
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3922
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3923
halfPageUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3924
    "scroll up half a page"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3925
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3926
    self scrollUp:(nFullLinesShown // 2)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3927
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3928
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3929
horizontalScrollStep
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3930
    "return the amount to scroll when stepping up/down.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3931
     Here, the scrolling unit is characters."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3932
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3933
    ^ gc font width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3934
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3935
    "Created: / 21.5.1999 / 15:55:06 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3936
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3937
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3938
makeColVisible:aCol inLine:aLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3939
    "if column aCol is not visible, scroll horizontal to make it visible"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3940
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3941
    |xWant xVis visLnr|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3942
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3943
    (aCol isNil or:[shown not]) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3944
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3945
    visLnr := self listLineToVisibleLine:aLineNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3946
    visLnr isNil ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3947
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3948
    xWant := self xOfCol:aCol inVisibleLine:visLnr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3949
    xVis := xWant - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3950
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3951
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3952
     dont scroll, if already visible
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3953
     (but scroll, if not in inner 20%..80% of visible area)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3954
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3955
"/    ((xVis >= (width // 5)) and:[xVis <= (width * 4 // 5)]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3956
"/        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3957
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3958
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3959
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3960
     no, the above does not look good, if you click / select at the
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3961
     far right - makes selecting so difficult ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3962
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3963
    (xVis >= 0 and:[xVis < (width - gc font width)]) ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3964
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3965
    self scrollHorizontalTo:(xWant - (width // 2)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3966
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3967
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3968
makeLineVisible:aListLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3969
    "if aListLineNr is not visible, scroll to make it visible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3970
     Numbering starts with 1 for the very first line of the text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3971
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3972
    |bott newTopLine|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3973
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3974
    (aListLineNr isNil "or:[shown not]") ifTrue:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3975
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3976
"/  Old code follows. It is no longer used, because:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3977
"/      1. we must maintain our viewOrigin (not maintained in this code!!)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3978
"/      2. we must inform our dependents about originChanges.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3979
"/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3980
"/    shown ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3981
"/        firstLineShown := (aListLineNr - 1) max:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3982
"/        firstLineShown > (list size - nFullLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3983
"/            firstLineShown := list size - nFullLinesShown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3984
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3985
"/        list size <= nFullLinesShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3986
"/            firstLineShown := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3987
"/        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3988
"/        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3989
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3990
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3991
    (self needScrollToMakeLineVisible:aListLineNr) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3992
	^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3993
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3994
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3995
    (aListLineNr < nFullLinesShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3996
	"/ at the very top of the list - show from top
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3997
	newTopLine := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3998
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  3999
	(nFullLinesShown < 3) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4000
	    "/ a small view - show from that line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4001
	    newTopLine := aListLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4002
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4003
	    bott := self numberOfLines - (nFullLinesShown - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4004
	    (aListLineNr > bott) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4005
		"/ at the end of the list - show the bottom of the list
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4006
		newTopLine := bott
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4007
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4008
		"/ somewhere else - place selected line into the middle of
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4009
		"/ the view
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4010
		newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4011
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4012
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4013
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4014
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4015
    self scrollToLine:newTopLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4016
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4017
    "Modified: / 18.12.1996 / 17:48:22 / stefan"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4018
    "Modified: / 7.8.1998 / 15:14:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4019
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4020
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4021
makeVisible:someString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4022
    "if nescessary, scroll to make the (first)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4023
     line containing someString visible."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4024
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4025
    |index list|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4026
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4027
    (list := self list) notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4028
	index := list indexOf:someString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4029
	index ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4030
	    self makeLineVisible:index
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4031
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4032
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4033
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4034
    "Modified: 9.9.1997 / 10:10:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4035
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4036
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4037
needScrollToMakeLine:aListLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4038
    "return true, if a scroll is needd to make a line visible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4039
     Numbering starts with 1 for the very first line of the text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4040
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4041
    (aListLineNr >= firstLineShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4042
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4043
	    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4044
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4045
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4046
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4047
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4048
    "Created: / 7.8.1998 / 15:13:51 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4049
    "Modified: / 7.8.1998 / 15:14:44 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4050
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4051
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4052
needScrollToMakeLineVisible:aListLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4053
    "return true, if a scroll is needd to make a line visible.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4054
     Numbering starts with 1 for the very first line of the text."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4055
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4056
    (aListLineNr >= firstLineShown) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4057
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4058
	    ^ false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4059
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4060
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4061
    ^ true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4062
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4063
    "Created: / 7.8.1998 / 15:13:51 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4064
    "Modified: / 7.8.1998 / 15:14:44 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4065
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4066
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4067
pageDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4068
    "change origin to display the next page"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4069
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4070
    "/ self scrollTo:(viewOrigin + (0 @ height))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4071
    self scrollToLine:(self firstLineShown + nFullLinesShown)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4072
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4073
    "Modified: / 15-12-2010 / 10:12:37 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4074
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4075
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4076
pageUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4077
    "change origin to display the previous page"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4078
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4079
    "/ self scrollTo:(viewOrigin - (0 @ height))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4080
    self scrollToLine:(self firstLineShown - nFullLinesShown)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4081
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4082
    "Modified: / 15-12-2010 / 10:12:41 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4083
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4084
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4085
scrollDown:nLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4086
    "change origin to scroll down some lines (towards the bottom of the text)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4087
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4088
    nLines ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4089
	self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4090
	       redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4091
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4092
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4093
    "Modified: / 21.5.1999 / 15:59:52 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4094
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4095
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4096
scrollDownPixels:pix
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4097
    "change origin to scroll down some pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4098
     (towards the bottom of the text)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4099
     THIS WILL VANISH!!"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4100
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4101
    pix > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4102
	self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4103
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4104
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4105
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4106
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4107
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4108
scrollHorizontalTo:aPixelOffset
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4109
    "change origin to make aPixelOffset be the left col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4110
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4111
    |nPixel|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4112
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4113
    nPixel := aPixelOffset - viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4114
    nPixel ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4115
	self scrollTo:(viewOrigin + (nPixel @ 0)) redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4116
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4117
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4118
    "Modified: / 3.3.1999 / 22:55:20 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4119
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4120
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4121
scrollLeft:nPixel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4122
    "change origin to scroll left some cols"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4123
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4124
    nPixel ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4125
	self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4126
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4127
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4128
    "Modified: / 21.5.1999 / 15:59:16 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4129
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4130
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4131
scrollRight:nPixel
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4132
    "change origin to scroll right some cols"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4133
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4134
    nPixel ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4135
	self scrollTo:(self viewOrigin + (nPixel @ 0)) redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4136
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4137
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4138
    "Modified: / 21.5.1999 / 15:59:21 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4139
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4140
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4141
scrollSelectDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4142
    "just a template - I do not know anything about selections"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4143
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4144
    ^ self subclassResponsibility
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4145
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4146
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4147
scrollSelectUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4148
    "just a template - I do not know anything about selections"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4149
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4150
    ^ self subclassResponsibility
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4151
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4152
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4153
scrollToBottom
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4154
    "change origin to show end of text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4155
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4156
    "scrolling to the end is not really correct (i.e. should scroll to list size - nFullLinesShown),
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4157
     but scrollDown: will adjust it ..."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4158
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4159
    self scrollToLine:(self size)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4160
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4161
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4162
scrollToCol:aColNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4163
    "change origin to make aColNr be the left col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4164
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4165
    |pxlOffset leftOffset|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4166
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4167
    leftOffset := viewOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4168
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4169
    aColNr == 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4170
        leftOffset ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4171
            self scrollLeft:leftOffset.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4172
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4173
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4174
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4175
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4176
    pxlOffset := gc font width * (aColNr - 1).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4177
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4178
    pxlOffset < leftOffset ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4179
        self scrollLeft:(leftOffset - pxlOffset)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4180
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4181
        pxlOffset > leftOffset ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4182
            self scrollRight:(pxlOffset - leftOffset)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4183
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4184
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4185
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4186
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4187
scrollToLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4188
    "change origin to start (left) of text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4189
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4190
    viewOrigin x ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4191
	self scrollToCol:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4192
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4193
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4194
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4195
scrollToLine:aLineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4196
    "change origin to make aLineNr be the top line"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4197
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4198
    aLineNr < firstLineShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4199
	self scrollUp:(firstLineShown - aLineNr)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4200
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4201
	aLineNr > firstLineShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4202
	    self scrollDown:(aLineNr - firstLineShown)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4203
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4204
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4205
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4206
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4207
scrollToPercent:percentOrigin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4208
    "scroll to a position given in percent of total"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4209
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4210
    "kludge - ListView thinks in lines"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4211
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4212
    self scrollHorizontalToPercent:percentOrigin x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4213
    self scrollVerticalToPercent:percentOrigin y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4214
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4215
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4216
scrollToTop
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4217
    "change origin to start of text"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4218
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4219
    self scrollToLine:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4220
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4221
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4222
scrollUp:nLines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4223
    "change origin to scroll up some lines (towards the top of the text)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4224
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4225
    nLines ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4226
	self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4227
	       redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4228
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4229
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4230
    "Modified: / 21.5.1999 / 15:59:45 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4231
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4232
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4233
scrollUpPixels:pix
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4234
    "change origin to scroll up some pixels
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4235
     (towards the top of the text)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4236
    THIS WILL VANISH!!"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4237
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4238
    pix > 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4239
	self scrollTo:(viewOrigin - (0 @ pix)) redraw:true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4240
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4241
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4242
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4243
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4244
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4245
scrollVerticalToPercent:percent
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4246
    "scroll to a position given in percent of total"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4247
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4248
    |nL lineNr|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4249
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4250
    nL := self numberOfLines.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4251
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4252
    "/ kludge for last partial line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4253
    "/
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4254
    nFullLinesShown ~~ nLinesShown ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4255
	nL := nL + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4256
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4257
    lineNr := (((nL * percent) asFloat / 100.0) + 0.5) asInteger + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4258
    self scrollToLine:lineNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4259
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4260
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4261
startAutoScrollDown:yDistance
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4262
    "setup for auto-scroll down (when button-press-moving below view)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4263
     - timeDelta for scroll is computed from distance"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4264
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4265
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4266
	startAutoScrollVertical:yDistance
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4267
	scrollSelector:#scrollSelectDown
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4268
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4269
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4270
startAutoScrollHorizontal:xDistance scrollSelector:scrollSelector
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4271
    "setup for auto-scroll left/right (when button-press-moving to the right of the view)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4272
     - timeDelta for scroll is computed from distance"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4273
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4274
    |deltaT mm|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4275
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4276
    autoScroll ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4277
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4278
    mm := xDistance // self horizontalIntegerPixelPerMillimeter + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4279
    deltaT := 0.5 / mm.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4280
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4281
    (deltaT = autoScrollDeltaT) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4282
	autoScrollDeltaT := deltaT.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4283
	autoScrollBlock isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4284
	    autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4285
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4286
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4287
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4288
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4289
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4290
startAutoScrollLeft:xDistance
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4291
    "setup for auto-scroll up (when button-press-moving to the left of the view)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4292
     - timeDelta for scroll is computed from distance"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4293
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4294
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4295
	startAutoScrollHorizontal:xDistance negated
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4296
	scrollSelector:#scrollSelectLeft
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4297
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4298
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4299
startAutoScrollRight:xDistance
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4300
    "setup for auto-scroll down (when button-press-moving to the right of the view)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4301
     - timeDelta for scroll is computed from distance"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4302
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4303
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4304
	startAutoScrollHorizontal:xDistance
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4305
	scrollSelector:#scrollSelectRight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4306
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4307
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4308
startAutoScrollUp:yDistance
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4309
    "setup for auto-scroll up (when button-press-moving below view)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4310
     - timeDelta for scroll is computed from distance"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4311
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4312
    self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4313
	startAutoScrollVertical:yDistance negated
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4314
	scrollSelector:#scrollSelectUp
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4315
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4316
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4317
startAutoScrollVertical:yDistance scrollSelector:scrollSelector
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4318
    "setup for auto-scroll up (when button-press-moving below view)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4319
     - timeDelta for scroll is computed from distance"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4320
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4321
    |deltaT mm|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4322
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4323
    autoScroll ifFalse:[^ self].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4324
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4325
    mm := (yDistance abs // self verticalIntegerPixelPerMillimeter) + 1.     
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4326
    deltaT := 0.5 / mm.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4327
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4328
    (deltaT = autoScrollDeltaT) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4329
        autoScrollDeltaT := deltaT.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4330
        autoScrollBlock isNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4331
            autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4332
            Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4333
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4334
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4335
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4336
    "Modified: / 08-08-2010 / 11:26:26 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4337
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4338
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4339
stopAutoScroll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4340
    "stop any auto-scroll"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4341
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4342
    autoScrollBlock notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4343
	self compressMotionEvents:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4344
	Processor removeTimedBlock:autoScrollBlock.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4345
	autoScrollBlock := nil.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4346
	autoScrollDeltaT := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4347
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4348
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4349
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4350
verticalScrollStep
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4351
    "return the amount to scroll when stepping up/down.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4352
     Here, the scrolling unit is lines."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4353
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4354
    ^ 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4355
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4356
    "Created: / 21.5.1999 / 14:00:12 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4357
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4358
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4359
viewOrigin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4360
    "return the viewOrigin; thats the coordinate of the contents
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4361
     which is shown topLeft in the view
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4362
     (i.e. the origin of the visible part of the contents)."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4363
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4364
    ^ viewOrigin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4365
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4366
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4367
!ListView methodsFor:'scrolling-basic'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4368
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4369
additionalMarginForHorizontalScroll
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4370
    "return the number of pixels by which we may scroll more than the actual
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4371
     width of the document would allow.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4372
     This is redefined by editable textViews, to allo for the cursor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4373
     to be visible if it is positioned right behind the longest line of text.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4374
     The default returned here is the width of a blank (to beautify italic text)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4375
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4376
    ^ gc font width
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4377
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4378
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4379
scrollTo:anOrigin redraw:doRedraw
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4380
    "change origin to have newOrigin be visible at the top-left.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4381
     The argument defines the integer device coordinates of the new top-left
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4382
     point.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4383
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4384
    |dltOrg
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4385
     noLn "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4386
     max  "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4387
     tmp  "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4388
     h    "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4389
     w    "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4390
     y0   "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4391
     y1   "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4392
     y    "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4393
     x    "{ Class:SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4394
     delta newFirstLine newViewOrigin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4395
     hBefore wBefore inv wg|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4396
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4397
    hBefore := height.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4398
    wBefore := width.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4399
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4400
    dltOrg := anOrigin - viewOrigin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4401
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4402
"/  compute valid horizontal offset x
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4403
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4404
    (x := dltOrg x) ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4405
        tmp := viewOrigin x + x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4406
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4407
        x < 0 ifTrue:[                                          "/ scrolling left
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4408
            tmp < 0 ifTrue:[x := 0 - viewOrigin x]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4409
        ] ifFalse:[                                             "/ scrolling right
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4410
         "/ allows scrolling to the right of widest line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4411
            max := self widthOfContents + (self additionalMarginForHorizontalScroll).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4412
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4413
            tmp + width > max ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4414
                x := (max - viewOrigin x - width) max:0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4415
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4416
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4417
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4418
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4419
"/  compute valid vertical offset measured in lines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4420
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4421
    (y := dltOrg y // fontHeight) ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4422
        tmp := firstLineShown + y.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4423
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4424
        y < 0 ifTrue:[                                          "/ scrolling up
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4425
            tmp < 1 ifTrue:[y := 1 - firstLineShown]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4426
        ] ifFalse:[                                             "/ scrolling down
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4427
            max := self size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4428
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4429
            tmp + nFullLinesShown > max ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4430
                y := (max - firstLineShown - nFullLinesShown + 1) max:0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4431
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4432
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4433
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4434
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4435
    (x == 0 and:[y == 0]) ifTrue:[                              "/ has viewOrigin changed ?
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4436
        ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4437
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4438
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4439
    (noLn := y) ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4440
        y := y * fontHeight
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4441
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4442
    delta := (x @ y).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4443
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4444
    newFirstLine := firstLineShown + noLn.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4445
    newViewOrigin := viewOrigin + delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4446
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4447
    (shown and:[doRedraw]) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4448
        self originWillChange.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4449
        firstLineShown := newFirstLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4450
        viewOrigin := newViewOrigin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4451
        self assert:(viewOrigin x >= 0).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4452
        ^ self originChanged:delta
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4453
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4454
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4455
"/    (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[               "/ outstanding expose events
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4456
"/        self invalidate.                                        "/ redraw all
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4457
"/        self originWillChange.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4458
"/        ^ self originChanged:(x @ y )
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4459
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4460
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4461
    (     (y ~~ 0 and:[x ~~ 0])         "/ both x and y changed
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4462
      or:[(noLn abs) >= nLinesShown     "/ at least one area is
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4463
      or:[(x abs) > (width // 4 * 3)]]  "/ big enough to redraw all
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4464
    ) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4465
        self originWillChange.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4466
        firstLineShown := newFirstLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4467
        viewOrigin := newViewOrigin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4468
        self invalidate.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4469
        ^ self originChanged:delta
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4470
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4471
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4472
    "/ OLD:
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4473
    "/ self repairDamage.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4474
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4475
    (wg := self windowGroup) notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4476
        wg processRealExposeEventsFor:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4477
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4478
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4479
    self originWillChange.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4480
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4481
    "/ make certain, that all drawing is complete
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4482
    "/ device sync.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4483
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4484
    self catchExpose.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4485
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4486
    x == 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4487
        "/ scrolling vertical
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4488
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4489
        y0 := textStartTop + (y abs).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4490
        h  := hBefore - margin - y0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4491
        w  := wBefore - margin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4492
        y > 0 ifTrue:[                                          "/ copy down
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4493
            "/ kludge: if the selection highlighting draws into the textStartTop area,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4494
            "/ the copy below leaves some selection depris in the top area.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4495
            "/ Therefore, clear the top area.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4496
            "/ (should avoid this, in case we know there cannot be anything
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4497
            "/  there - selection is nil or >= firstLineShown).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4498
            self clearDeviceRectangleX:margin y:margin width:width-margin-margin height:(textStartTop-margin).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4499
"/            self invalidateDeviceRectangle:((margin@margin) corner:(width-margin@textStartTop)) repairNow:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4500
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4501
            self copyFrom:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4502
                        x:0 y:y0 toX:0 y:textStartTop
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4503
                    width:w height:h async:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4504
            y1 := h - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4505
            y0 := y0 + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4506
        ] ifFalse:[                                             "/ copy up
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4507
            self copyFrom:self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4508
                        x:margin y:textStartTop toX:margin y:y0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4509
                    width:w height:h async:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4510
            y1 := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4511
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4512
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4513
        inv := (margin@y1) extent:(w@y0).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4514
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4515
        "/ scrolling horizontal
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4516
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4517
        x > 0 ifTrue:[                                          "/ scrolling right
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4518
            y0 := margin + x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4519
            y1 := wBefore - y0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4520
        ] ifFalse:[                                             "/ scrolling left
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4521
            y0 := margin - x.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4522
            y1 := 0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4523
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4524
        h := hBefore - margin - margin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4525
        w := wBefore - margin - y0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4526
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4527
        x > 0 ifTrue:[                                          "/ copy right
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4528
            self copyFrom:self x:y0 y:margin toX:margin y:margin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4529
                    width:w height:h async:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4530
        ] ifFalse:[                                             "/ copy left
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4531
            "/ self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4532
"/            viewOrigin x > margin ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4533
"/                self copyFrom:self x:0 y:margin toX:y0-margin y:margin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4534
"/                        width:w height:h async:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4535
"/            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4536
                self copyFrom:self x:margin y:margin toX:y0 y:margin
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4537
                        width:w height:h async:true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4538
"/            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4539
        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4540
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4541
        inv := (y1@margin) extent:(y0@h).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4542
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4543
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4544
    firstLineShown := newFirstLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4545
    viewOrigin := newViewOrigin.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4546
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4547
    self invalidateDeviceRectangle:inv repairNow:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4548
    viewOrigin x <= margin ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4549
        self invalidateDeviceRectangle:((0@margin) extent:(margin@h)) repairNow:false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4550
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4551
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4552
    self originChanged:delta.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4553
    self waitForExpose.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4554
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4555
    (wg := self windowGroup) notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4556
        wg processRealExposeEventsFor:self.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4557
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4558
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4559
"/    (hBefore ~= height or:[wBefore ~= width]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4560
"/        self halt.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4561
"/    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4562
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4563
    "Modified: / 08-08-2010 / 11:14:09 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4564
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4565
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4566
!ListView methodsFor:'searching'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4567
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4568
findBeginOfWordAtLine:selectLine col:selectCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4569
    "return the col of first character of the word at given line/col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4570
     If the character under the initial col is a space character, return
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4571
     the first col of the blank-block."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4572
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4573
    |beginCol thisCharacter|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4574
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4575
    beginCol := selectCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4576
    thisCharacter := self characterAtLine:selectLine col:beginCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4577
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4578
    "is this acharacter within a word ?"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4579
    (wordCheck value:thisCharacter) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4580
	[wordCheck value:thisCharacter] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4581
	    beginCol := beginCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4582
	    beginCol < 1 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4583
		^ 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4584
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4585
	    thisCharacter := self characterAtLine:selectLine col:beginCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4586
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4587
	beginCol := beginCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4588
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4589
	"nope - maybe its a space"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4590
	thisCharacter == Character space ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4591
	    [beginCol > 1 and:[thisCharacter == Character space]] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4592
		beginCol := beginCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4593
		thisCharacter := self characterAtLine:selectLine col:beginCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4594
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4595
	    thisCharacter ~~ Character space ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4596
		beginCol := beginCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4597
	    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4598
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4599
	    "select single character"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4600
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4601
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4602
    ^ beginCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4603
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4604
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4605
findEndOfWordAtLine:selectLine col:selectCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4606
    "return the col of last character of the word at given line/col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4607
     If the character under the initial col is a space character, return
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4608
     the last col of the blank-block.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4609
     Return 0 if we should wrap to next line (for spaces)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4610
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4611
    |endCol "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4612
     len    "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4613
     thisCharacter|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4614
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4615
    endCol := selectCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4616
    endCol == 0 ifTrue:[endCol := 1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4617
    thisCharacter := self characterAtLine:selectLine col:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4618
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4619
    len := (self listAt:selectLine) size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4620
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4621
    "is this acharacter within a word ?"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4622
    (wordCheck value:thisCharacter) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4623
	[wordCheck value:thisCharacter] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4624
	    endCol := endCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4625
	    endCol > len ifTrue:[ ^ len ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4626
	    thisCharacter := self characterAtLine:selectLine col:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4627
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4628
	endCol := endCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4629
    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4630
	"nope - maybe its a space"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4631
	thisCharacter == Character space ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4632
	    endCol > len ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4633
		"select rest to end"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4634
		endCol := 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4635
	    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4636
		thisCharacter := self characterAtLine:selectLine col:endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4637
		[endCol <= len and:[thisCharacter == Character space]] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4638
		    endCol := endCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4639
		    thisCharacter := self characterAtLine:selectLine col:endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4640
		].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4641
		endCol := endCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4642
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4643
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4644
	    "select single character"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4645
	]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4646
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4647
    ^ endCol.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4648
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4649
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4650
searchBackwardFor:pattern ignoreCase:ignCase startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4651
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4652
     found evaluate block2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4653
     Sorry, but pattern is no regular expression pattern (yet)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4654
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4655
    ^ self 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4656
        searchBackwardUsingSpec:(SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4657
                                        pattern:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4658
                                        ignoreCase:ignCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4659
                                        match:false)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4660
        startingAtLine:startLine col:startCol 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4661
        ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4662
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4663
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4664
searchBackwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4665
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4666
     found evaluate block2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4667
     Sorry, but pattern is no regular expression pattern (yet)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4668
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4669
    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4670
	searchBackwardFor:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4671
	ignoreCase:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4672
	startingAtLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4673
	ifFound:block1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4674
	ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4675
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4676
    "Modified: 13.9.1997 / 01:07:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4677
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4678
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4679
searchBackwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4680
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4681
     found evaluate block2.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4682
     Sorry, but pattern is no regular expression pattern (yet)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4683
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4684
    |lineString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4685
     pattern ignCase match fullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4686
     found firstChar1 firstChar2 c pc col1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4687
     col         "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4688
     cc          "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4689
     patternSize "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4690
     line1       "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4691
     lineSize    "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4692
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4693
    pattern := searchSpec pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4694
    ignCase := searchSpec ignoreCase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4695
    match := searchSpec match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4696
    match ifTrue:[ Transcript showCR:'backward matchsearch is (still) not implemented' ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4697
    fullWord := searchSpec fullWord.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4698
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4699
    patternSize := pattern size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4700
    (list notNil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4701
    and:[startLine > 0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4702
    and:[patternSize ~~ 0]])
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4703
    ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4704
        self withCursor:Cursor questionMark do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4705
            col := startCol - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4706
            firstChar1 := pattern at:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4707
            ignCase ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4708
                firstChar1 := firstChar1 asLowercase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4709
                firstChar2 := firstChar1 asUppercase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4710
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4711
                firstChar2 := firstChar1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4712
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4713
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4714
            line1 := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4715
            line1 > list size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4716
                line1 := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4717
                col := -999
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4718
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4719
                col > (list at:line1) size ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4720
                    col := -999
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4721
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4722
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4723
            line1 to:1 by:-1 do:[:lnr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4724
                lineString := list at:lnr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4725
                lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4726
                    lineString := lineString asString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4727
                    lineString isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4728
                        "/ quick check if pattern is present
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4729
                        col1 := lineString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4730
                                findString:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4731
                                startingAt:1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4732
                                ifAbsent:0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4733
                                caseSensitive: ignCase not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4734
                        col1 ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4735
                            lineSize := lineString size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4736
                            col == -999 ifTrue:[col := lineSize - patternSize + 1].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4737
                            [(col > 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4738
                             and:[(c := lineString at:col) ~= firstChar1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4739
                             and:[c ~= firstChar2]]] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4740
                                col := col - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4741
                            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4742
                            [col > 0] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4743
                                cc := col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4744
                                found := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4745
                                1 to:patternSize do:[:cnr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4746
                                    cc > lineSize ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4747
                                        found := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4748
                                    ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4749
                                        pc := pattern at:cnr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4750
                                        c := lineString at:cc.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4751
                                        pc ~= c ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4752
                                            (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4753
                                                found := false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4754
                                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4755
                                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4756
                                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4757
                                    cc := cc + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4758
                                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4759
                                found ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4760
                                    (fullWord not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4761
                                        or:[ (self findBeginOfWordAtLine:lnr col:col) == col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4762
                                              and:[ (self findEndOfWordAtLine:lnr col:col) == (col + patternSize - 1) ]]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4763
                                    ) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4764
                                        ^ block1 value:lnr value:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4765
                                    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4766
                                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4767
                                col := col - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4768
                                [(col > 0)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4769
                                and:[(c := lineString at:col) ~= firstChar1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4770
                                and:[c ~= firstChar2]]] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4771
                                    col := col - 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4772
                                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4773
                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4774
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4775
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4776
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4777
                col := -999.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4778
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4779
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4780
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4781
    "not found"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4782
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4783
    ^ block2 value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4784
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4785
    "Created: / 13-09-1997 / 01:06:19 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4786
    "Modified: / 05-08-2012 / 12:16:31 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4787
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4788
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4789
searchForwardFor:pattern ignoreCase:ignCase match:match startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4790
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4791
     found evaluate block2."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4792
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4793
    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4794
        searchForwardUsingSpec:(SearchSpec new
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4795
                                    pattern:pattern 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4796
                                    ignoreCase:ignCase 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4797
                                    match:match)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4798
        startingAtLine:startLine col:startCol 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4799
        ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4800
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4801
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4802
searchForwardFor:pattern ignoreCase:ignCase startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4803
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4804
     found evaluate block2."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4805
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4806
    ^ self searchForwardFor:pattern ignoreCase:ignCase match: true startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4807
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4808
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4809
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4810
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4811
     found evaluate block2."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4812
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4813
    ^ self
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4814
	searchForwardFor:pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4815
	ignoreCase:false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4816
	startingAtLine:startLine col:startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4817
	ifFound:block1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4818
	ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4819
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4820
    "Modified: 13.9.1997 / 01:07:11 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4821
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4822
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4823
searchForwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4824
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4825
     found evaluate block2."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4826
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4827
    |lineString col pattern match ignCase fullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4828
     patternSize
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4829
     line1 "{Class: SmallInteger}"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4830
     line2 "{Class: SmallInteger}"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4831
     p realPattern|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4832
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4833
    pattern := searchSpec pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4834
    match := searchSpec match.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4835
    ignCase := searchSpec ignoreCase.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4836
    fullWord := searchSpec fullWord.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4837
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4838
    patternSize := pattern size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4839
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4840
        self withCursor:Cursor questionMark do:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4841
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4842
            col := startCol + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4843
            line1 := startLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4844
            line2 := list size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4845
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4846
            (match and:[pattern includesUnescapedMatchCharacters]) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4847
                "perform a findMatchString (matching)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4848
                p := pattern species new:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4849
                (pattern startsWith:$*) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4850
                    p := p , '*'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4851
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4852
                p := p , pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4853
                (pattern endsWith:$*) ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4854
                    p := p , '*'
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4855
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4856
                realPattern := pattern.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4857
                (realPattern startsWith:$*) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4858
                    realPattern := realPattern copyFrom:2
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4859
                ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4860
                line1 to:line2 do:[:lnr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4861
                    lineString := list at:lnr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4862
                    lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4863
                        lineString := lineString asString string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4864
                        lineString isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4865
                            "/ first a crude check ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4866
                            (p match:lineString caseSensitive:ignCase not) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4867
                                "/ ok, there it is; look at which position
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4868
                                col := lineString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4869
                                        findMatchString:realPattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4870
                                        startingAt:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4871
                                        caseSensitive:ignCase not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4872
                                        ifAbsent:0.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4873
                                col ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4874
                                    ^ block1 value:lnr value:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4875
                                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4876
                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4877
                        ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4878
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4879
                    col := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4880
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4881
            ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4882
                "perform a findString (no matching)"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4883
                p := pattern "withoutMatchEscapes".
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4884
                line1 to:line2 do:[:lnr |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4885
                    lineString := list at:lnr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4886
                    lineString notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4887
                        lineString := lineString asString string.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4888
                        lineString isString ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4889
                            col := lineString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4890
                                    findString:p
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4891
                                    startingAt:col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4892
                                    ifAbsent:0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4893
                                    caseSensitive: ignCase not.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4894
                            col ~~ 0 ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4895
"/Transcript showCR:'---'.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4896
"/Transcript showCR:lineString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4897
"/Transcript showCR:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4898
"/Transcript showCR:(self findBeginOfWordAtLine:lnr col:col).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4899
"/Transcript showCR:(self findEndOfWordAtLine:lnr col:col).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4900
"/Transcript showCR:(lineString copyFrom:(self findBeginOfWordAtLine:lnr col:col) to:(self findEndOfWordAtLine:lnr col:col)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4901
                                (fullWord not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4902
                                    or:[ (self findBeginOfWordAtLine:lnr col:col) == col
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4903
                                          and:[ (self findEndOfWordAtLine:lnr col:col) == (col + patternSize - 1) ]]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4904
                                ) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4905
                                    ^ block1 value:lnr value:col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4906
                                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4907
                            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4908
                        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4909
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4910
                    col := 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4911
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4912
            ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4913
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4914
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4915
    "not found"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4916
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4917
    ^ block2 value
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4918
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4919
    "Created: / 13-09-1997 / 01:06:31 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4920
    "Modified: / 05-08-2012 / 12:22:42 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4921
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4922
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4923
standardWordCheck:char
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4924
    "the wordCheck is a predicate which returns true if the given character
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4925
     belongs to the (textual) word. Used with double click to select a word.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4926
     When editing code, typically characters which are part of an identifier
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4927
     are part of a word (underline, dollar, but no other non-letters).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4928
     The standardWordCheck aks the current userPreferences for details."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4929
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4930
    |prefs|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4931
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4932
    (prefs := UserPreferences current) whitespaceWordSelectMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4933
        "an extremely simple mode, where every non-space is treated as part of the word"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4934
        ^ char isSeparator not
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4935
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4936
    prefs extendedWordSelectMode ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4937
        "the typical mode, useful for text and code"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4938
        ^ char isNationalAlphaNumeric or:[char == $_]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4939
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4940
    "another typical mode, also useful for text and code"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4941
    ^ char isNationalAlphaNumeric
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4942
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4943
    "Modified (comment): / 17-03-2012 / 19:04:13 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4944
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4945
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4946
!ListView methodsFor:'tabulators'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4947
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4948
expandTabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4949
    "go through whole text expanding tabs into spaces.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4950
     This is meant to be called for text being imported from a file.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4951
     Therefore, 8-col tabs are assumed - independent of any private tab setting."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4952
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4953
    |line newLine nLines "{ Class: SmallInteger }"|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4954
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4955
    includesNonStrings := false.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4956
    list notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4957
        nLines := self size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4958
        1 to:nLines do:[:index |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4959
            line := self at:index.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4960
            line notNil ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4961
                (line isString) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4962
                    newLine := line withTabsExpanded.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4963
                    newLine ~~ line ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4964
                        list at:index put:newLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4965
                    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4966
                ] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4967
                    includesNonStrings := true.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4968
                ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4969
            ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4970
        ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4971
    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4972
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4973
    "Modified: 30.8.1995 / 19:06:37 / claus"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4974
    "Modified: 12.5.1996 / 12:48:03 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4975
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4976
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4977
nextTabAfter:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4978
    "return the next tab position after col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4979
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4980
    ^ self nextTabAfter:colNr in:tabPositions.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4981
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4982
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4983
nextTabAfter:colNr in:tabPositions
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4984
    "return the next tab position after col.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4985
     The second arg, tabPositions is a collection of tabStops."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4986
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4987
    |col      "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4988
     tabIndex "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4989
     thisTab  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4990
     nTabs    "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4991
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4992
    tabIndex := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4993
    col := colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4994
    thisTab := tabPositions at:tabIndex.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4995
    nTabs := tabPositions size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4996
    [thisTab <= col] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4997
	(tabIndex == nTabs) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4998
	    "/ fallback to mod-8 tabs if beyond tab-list.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  4999
	    thisTab := col + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5000
	    thisTab := thisTab + (8 - (thisTab \\ 8)).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5001
	    ^ thisTab
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5002
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5003
	tabIndex := tabIndex + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5004
	thisTab := tabPositions at:tabIndex
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5005
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5006
    ^ thisTab
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5007
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5008
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5009
prevTabBefore:colNr
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5010
    "return the prev tab position before col"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5011
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5012
    |col      "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5013
     tabIndex "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5014
     thisTab  "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5015
     nTabs    "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5016
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5017
    tabIndex := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5018
    col := colNr.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5019
    thisTab := tabPositions at:tabIndex.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5020
    nTabs := tabPositions size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5021
    [thisTab < col] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5022
	(tabIndex == nTabs) ifTrue:[^ thisTab].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5023
	tabIndex := tabIndex + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5024
	thisTab := tabPositions at:tabIndex
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5025
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5026
    (tabIndex == 1) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5027
	^ 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5028
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5029
    ^ tabPositions at:(tabIndex - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5030
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5031
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5032
setTab4
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5033
    "set 4-character tab stops"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5034
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5035
    tabPositions := self class tab4Positions.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5036
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5037
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5038
setTab8
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5039
    "set 8-character tab stops"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5040
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5041
    tabPositions := self class tab8Positions.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5042
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5043
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5044
setTabPositions:aVector
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5045
    "set tab stops"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5046
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5047
    tabPositions := aVector.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5048
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5049
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5050
withTabs:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5051
    "Assuming an 8-character tab,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5052
     compress multiple leading spaces to tabs, return a new line string
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5053
     or the original line, if no tabs where created.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5054
     good idea, to make this one a primitive, since its called
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5055
     many times when a big text is saved to a file."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5056
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5057
    |newLine eightSpaces nTabs|
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5058
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5059
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5060
     the code below is a hack, producing many garbage strings for lines
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5061
     which compress multiple tabs ... needs rewrite: saving big files
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5062
     stresses the garbage collector a bit ...
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5063
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5064
    line isNil ifTrue:[^ line].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5065
    eightSpaces := '        '.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5066
    (line startsWith:eightSpaces) ifFalse:[^ line].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5067
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5068
    nTabs := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5069
    newLine := line copyFrom:9.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5070
    [newLine startsWith:eightSpaces] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5071
	newLine := newLine copyFrom:9.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5072
	nTabs := nTabs + 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5073
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5074
    ^ (line species new:nTabs withAll:Character tab) asString , newLine.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5075
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5076
    "Modified: 23.2.1996 / 19:10:36 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5077
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5078
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5079
withTabs:tabulatorTable expand:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5080
    "expand tabs into spaces, return a new line string,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5081
     or original line, if no tabs are included.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5082
     good idea, to make this one a primitive, since it is called
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5083
     many times if a big text is read from a file."
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5084
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5085
    |tmpString nString nTabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5086
     currentMax "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5087
     dstIndex   "{ Class: SmallInteger }"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5088
     nextTab    "{ Class: SmallInteger }" |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5089
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5090
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5091
     the code below tries to avoid creating too much garbage;
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5092
     therefore, the string is scanned first for the number of
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5093
     tabs to get a rough idea of the final strings size.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5094
     (it could be done better, by computing the exact size
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5095
      required here ...)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5096
    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5097
    line isNil ifTrue:[^ line].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5098
    nTabs := line occurrencesOf:(Character tab).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5099
    nTabs == 0 ifTrue:[^ line].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5100
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5101
    currentMax := line size + (nTabs * 7).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5102
    tmpString := line species new:currentMax.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5103
    dstIndex := 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5104
    line do:[:character |
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5105
	(character == (Character tab)) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5106
	    nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5107
	    [dstIndex < nextTab] whileTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5108
		tmpString at:dstIndex put:(Character space).
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5109
		dstIndex := dstIndex + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5110
	    ]
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5111
	] ifFalse:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5112
	    tmpString at:dstIndex put:character.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5113
	    dstIndex := dstIndex + 1
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5114
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5115
	(dstIndex > currentMax) ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5116
	    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5117
	     this cannot happen with <= 8 tabs
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5118
	    "
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5119
	    currentMax := currentMax + currentMax.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5120
	    nString := line species new:currentMax.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5121
	    nString replaceFrom:1 to:(dstIndex - 1)
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5122
			   with:tmpString startingAt:1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5123
	    tmpString := nString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5124
	    nString := nil
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5125
	].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5126
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5127
	"make stc-optimizer happy
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5128
	 - no need to return value of ifTrue:/ifFalse above"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5129
	0
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5130
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5131
    dstIndex := dstIndex - 1.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5132
    dstIndex == currentMax ifTrue:[
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5133
	^ tmpString
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5134
    ].
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5135
    ^ tmpString copyTo:dstIndex
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5136
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5137
    "Modified: 23.2.1996 / 19:11:01 / cg"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5138
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5139
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5140
withTabsExpanded:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5141
    "expand tabs into spaces, return a new line string,
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5142
     or original line, if no tabs are included.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5143
     good idea, to make this one a primitive"
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5144
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5145
    ^ self withTabs:tabPositions expand:line
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5146
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5147
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5148
!ListView::HighlightArea methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5149
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5150
bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5151
    ^ bgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5152
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5153
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5154
bgColor:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5155
    bgColor := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5156
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5157
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5158
endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5159
    ^ endCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5160
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5161
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5162
endCol:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5163
    endCol := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5164
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5165
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5166
endLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5167
    ^ endLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5168
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5169
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5170
endLine:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5171
    endLine := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5172
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5173
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5174
fgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5175
    ^ fgColor
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5176
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5177
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5178
fgColor:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5179
    fgColor := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5180
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5181
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5182
startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5183
    ^ startCol
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5184
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5185
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5186
startCol:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5187
    startCol := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5188
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5189
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5190
startLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5191
    ^ startLine
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5192
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5193
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5194
startLine:something
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5195
    startLine := something.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5196
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5197
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5198
!ListView::SearchSpec methodsFor:'accessing'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5199
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5200
forward
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5201
    ^ forward ? true
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5202
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5203
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5204
fullWord
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5205
    ^ fullWord ? false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5206
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5207
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5208
ignoreCase
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5209
    ^ ignoreCase ? false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5210
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5211
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5212
match
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5213
    ^ match ? false
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5214
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5215
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5216
pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5217
    ^ pattern
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5218
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5219
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5220
pattern:patternString 
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5221
    pattern := patternString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5222
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5223
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5224
pattern:patternString ignoreCase:ignoredCaseBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5225
    pattern := patternString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5226
    ignoreCase := ignoredCaseBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5227
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5228
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5229
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5230
    pattern := patternString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5231
    ignoreCase := ignoredCaseBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5232
    match := matchBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5233
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5234
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5235
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean forward:forwardBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5236
    pattern := patternString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5237
    ignoreCase := ignoredCaseBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5238
    match := matchBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5239
    forward := forwardBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5240
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5241
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5242
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen forward:forwardBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5243
    pattern := patternString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5244
    ignoreCase := ignoredCaseBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5245
    match := matchBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5246
    variable := variableBoolen.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5247
    forward := forwardBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5248
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5249
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5250
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen fullWord:fullWordBoolen forward:forwardBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5251
    pattern := patternString.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5252
    ignoreCase := ignoredCaseBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5253
    match := matchBoolean.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5254
    variable := variableBoolen.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5255
    fullWord := fullWordBoolen.
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5256
    forward := forwardBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5257
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5258
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5259
variable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5260
    ^ variable
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5261
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5262
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5263
variable:variableBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5264
    variable := variableBoolean
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5265
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5266
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5267
!ListView class methodsFor:'documentation'!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5268
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5269
version
5132
045af422a364 class: ListView
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  5270
    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.391.2.2 2014-09-26 10:25:34 stefan Exp $'
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5271
!
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5272
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5273
version_CVS
5132
045af422a364 class: ListView
Stefan Vogel <sv@exept.de>
parents: 5023
diff changeset
  5274
    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.391.2.2 2014-09-26 10:25:34 stefan Exp $'
5023
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5275
! !
a18a03c5c572 GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff changeset
  5276