ListView.st
author Claus Gittinger <cg@exept.de>
Fri, 01 May 2009 19:23:26 +0200
changeset 3869 82b87c5ae995
parent 3854 4f0dbd8c4163
child 4015 8647dad37cb0
permissions -rw-r--r--
preps for multiple highlightAreas
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    12
"{ Package: 'stx:libwidg' }"
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    13
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    14
View subclass:#ListView
3563
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    15
	instanceVariableNames:'list firstLineShown nFullLinesShown nLinesShown fgColor bgColor
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    16
		partialLines leftMargin topMargin textStartLeft textStartTop
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    17
		innerWidth tabPositions lineSpacing fontHeight fontAscent
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    18
		fontIsFixedWidth fontWidth autoScroll autoScrollBlock
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    19
		autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    20
		listMsg viewOrigin listChannel backgroundAlreadyClearedColor
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    21
		scrollWhenUpdating scrollLocked lineEndCRLF highlightAreas'
3563
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    22
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    23
		UserDefaultTabPositions DefaultLeftMargin DefaultTopMargin'
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    24
	poolDictionaries:''
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    25
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    26
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    27
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    28
Object subclass:#HighlightArea
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    29
	instanceVariableNames:'startLine startCol endLine endCol fgColor bgColor'
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    30
	classVariableNames:''
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    31
	poolDictionaries:''
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    32
	privateIn:ListView
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    33
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    34
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
    35
!ListView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    36
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    37
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    38
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    39
 COPYRIGHT (c) 1989 by Claus Gittinger
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    40
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    41
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    42
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    43
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    44
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    45
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    46
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    47
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    48
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    49
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    50
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    51
documentation
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    52
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    53
    a View for (string-)lists.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    54
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    55
    This class can only passively display collections of strings-
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    56
    selections, editing, cursors etc. must be done in subclasses.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    57
    see SelectionInListView, TextView etc.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    58
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    59
    This code currently handles only fixed-height fonts correctly -
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    60
    should be rewritten in some places ...
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    61
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    62
    It can only scroll by full lines vertically (i.e. setting firstLineShown to ~~ 1)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    63
    which should be changed to have this behavior optionally for smooth scroll.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    64
120
claus
parents: 118
diff changeset
    65
    The text is internally kept in the list instance variable, and is supposed to consist
claus
parents: 118
diff changeset
    66
    of a collection (Ordered- or StringCollection) of line entries.
claus
parents: 118
diff changeset
    67
    Typically, individual entries are either strings or nil (for empty lines).
claus
parents: 118
diff changeset
    68
    However, any object which supports the displayOn: and widthIn: protocol can be
claus
parents: 118
diff changeset
    69
    used - see MultipleColumnListEntry as an example.
claus
parents: 118
diff changeset
    70
    Therefore, ListView (and all subclasses) are prepared to handle non-string entries
claus
parents: 118
diff changeset
    71
    (especially: attributed Text).
claus
parents: 118
diff changeset
    72
claus
parents: 118
diff changeset
    73
    The internal version of the text has tabulators expanded to blanks - when text is exchanged
claus
parents: 118
diff changeset
    74
    with an external medium (i.e. reading/writing files), these are expanded/compressed assuming
claus
parents: 118
diff changeset
    75
    a tab-setting of 8. This is done independent of the users tab setting, which is used
claus
parents: 118
diff changeset
    76
    while the text is edited. Thus, even if the tab setting is multiple of 4's, tabs are
claus
parents: 118
diff changeset
    77
    written in multiples of 8 when the text is saved. Since this is the default on all ascii
claus
parents: 118
diff changeset
    78
    terminals and printers, this assures that the text looks correctly indented when finally printed.
claus
parents: 118
diff changeset
    79
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    80
    Notice:
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    81
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    82
    ListView is one of the oldest widget classes in the current system and
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    83
    definitely requires some rewrite:
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    84
120
claus
parents: 118
diff changeset
    85
    Due to historic reasons (ListView implemented scrolling before the general
claus
parents: 118
diff changeset
    86
    scrolling code in View was added), this one does scrolling different from all other
claus
parents: 118
diff changeset
    87
    views. The general scrolling code (in View) uses the transformation for transparent scrolling.
claus
parents: 118
diff changeset
    88
    Here, the transformation is not used, instead it is done again, by keeping the firstLineShown
claus
parents: 118
diff changeset
    89
    (i.e. vertical offset) and leftOffset (horizontal offset).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    90
    The most annoying consequence of this is, that scrolling is done by lines here,
120
claus
parents: 118
diff changeset
    91
    while its done in pixels in the View class. Thus, be careful, when changing things
claus
parents: 118
diff changeset
    92
    (better: dont touch it ;-)
claus
parents: 118
diff changeset
    93
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    94
    Also, all controller functionality is completely performed by the listView
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    95
    (and subclasses) itself. It is still possible, to define and set a specialized
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    96
    controller, though. I.e. if you like to change the input behavior, define
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    97
    a corresponding controller class and intersect the keyXXX/buttonXXX messages
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    98
    there.
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    99
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   100
    This will be totally rewritten ... so dont depend on the internals; especially the scrolling
120
claus
parents: 118
diff changeset
   101
    code will be totally removed here and the inherited functionality be used in the next version.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   102
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   103
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   104
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   105
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   106
      list                <aCollection>           the text strings, a collection of lines.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   107
						  Nils may be used for empty lines.
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   108
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   109
      firstLineShown      <Number>                the index of the 1st visible line (1 ..)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   110
      leftOffset          <Number>                left offset for horizontal scroll
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   111
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   112
      nFullLinesShown     <Number>                the number of unclipped lines in visible area
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   113
						  (internal; updated on size changes)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   114
      nLinesShown         <Number>                the number of lines in visible area, incl. partial
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   115
						  (internal; updated on size changes)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   116
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   117
      fgColor             <Color>                 color to draw characters
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   118
      bgColor             <Color>                 the background
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   119
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   120
      partialLines        <Boolean>               allow last line to be partial displayed
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   121
      leftMargin          <Number>                margin at left in pixels
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   122
      topMargin           <Number>                margin at top in pixels
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   123
      textStartLeft       <Number>                margin + leftMargin (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   124
      textStartTop        <Number>                margin + topMargin (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   125
      innerWidth          <Number>                width - margins (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   126
      tabPositions        <aCollection>           tab stops (cols)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   127
      fontHeight          <Number>                font height in pixels (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   128
      fontAscent          <Number>                font ascent in pixels (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   129
      fontIsFixed         <Boolean>               true if its a fixed font (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   130
      fontWidth           <Number>                width of space (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   131
      lineSpacing         <Number>                pixels between lines
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   132
      lastSearchPattern   <String>                last pattern for searching
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   133
						  (kept to provide a default for next search)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   134
      lastSearchIgnoredCase   <Boolean>           last search ignored case
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   135
						  (kept to provide a default for next search)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   136
      wordCheck           <Block>                 rule used for check for word boundaries in word select
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   137
						  The default rule is to return true for alphaNumeric characters.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   138
						  (can be changed to allow for underscore and other
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   139
						   characters to be treated as alphaCharacters)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   140
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   141
      autoScrollBlock     <Block>                 block installed as timeoutBlock when doing an
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   142
						  autoScroll (internal)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   143
      autoScrollDeltaT                            computed scroll time delta in seconds (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   144
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   145
      includesNonStrings                          cached flag if any non-strings are in list
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   146
      widthOfWidestLine                           cached width of widest line
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   147
      listMsg                                     if view has a model and listMsg is non-nil,
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   148
						  this is sent to the model to aquired a new contents
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   149
						  whenever a change of the aspect  (aspectMsg) occurs.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   150
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   151
      viewOrigin                                  the current origin
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   152
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   153
      backgroundAlreadyClearedColor               internal; speedup by avoiding
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   154
						  multiple fills when drawing
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   155
						  internal lines
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   156
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   157
      scrollWhenUpdating
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   158
				<Symbol>        defines how the view is scrolled if the
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   159
						model changes its value by some outside activity
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   160
						(i.e. not by user input).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   161
						Can be one of:
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   162
						    #keep / nil     -> stay unchanged
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   163
						    #endOfText      -> scroll to the end
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   164
						    #beginOfText    -> scroll to the top
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   165
						The default is #beginOfText (i.e. scroll to top).
120
claus
parents: 118
diff changeset
   166
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   167
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   168
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   169
      textForegroundColor                         defaults to Black
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   170
      textBackgroundColor                         defaults to White
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   171
      textFont                                    defaults to defaultFont
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   172
      textTabPositions                            defaults to #(1 9 17 25 ...)
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   173
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   174
    [author:]
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   175
	Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   176
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   177
    [see also:]
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   178
	TextView EditTextView
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   179
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   180
"
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   181
!
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   182
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   183
examples
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   184
"
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   185
    ListViews alone are rarely used - its mostly an abstract superclass
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   186
    for TextView, EditTextView and SelectionInListView.
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   187
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   188
    anyway, here are a few examples:
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   189
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   190
     basic simple setup:
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   191
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   192
	|top l|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   193
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   194
	top := StandardSystemView new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   195
	top extent:100@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   196
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   197
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   198
	l list:#('one' 'two' 'three').
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   199
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   200
	top open
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   201
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   202
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   203
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   204
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   205
      specifying textMargins (these have NOTHING to do with the viewInset):
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   206
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   207
	|top l|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   208
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   209
	top := StandardSystemView new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   210
	top extent:100@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   211
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   212
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   213
	l list:#('one' 'two' 'three').
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   214
	l topMargin:10.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   215
	l leftMargin:20.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   216
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   217
	top open
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   218
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   219
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   220
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   221
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   222
      globally set the fg/bg colors:
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   223
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   224
	|top l|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   225
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   226
	top := StandardSystemView new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   227
	top extent:100@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   228
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   229
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   230
	l list:#('one' 'two' 'three').
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   231
	l foregroundColor:(Color white).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   232
	l backgroundColor:(Color blue).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   233
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   234
	top open
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   235
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   236
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   237
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   238
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   239
      non-string (text) entries:
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   240
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   241
	|top list l|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   242
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   243
	top := StandardSystemView new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   244
	top extent:100@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   245
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   246
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   247
	list := #('all' 'of' 'your' 'preferred' 'colors')
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   248
		with:#(red green blue 'orange' cyan)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   249
		collect:[:s :clr |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   250
			    Text string:s
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   251
				 emphasis:(Array with:#bold
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   252
						 with:(#color->(Color name:clr))) ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   253
	l list:list.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   254
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   255
	top open
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   256
									[exEnd]
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   257
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   258
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   259
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   260
      generic non-string entries:
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   261
      (notice: ColoredListEntry is obsoleted by Text)
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   262
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   263
	|top list l|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   264
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   265
	top := StandardSystemView new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   266
	top extent:100@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   267
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   268
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   269
	list := #('all' 'of' 'your' 'preferred' 'colors')
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   270
		with:#(red green blue 'orange' cyan)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   271
		collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   272
	l list:list.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   273
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   274
	top open
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   275
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   276
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   277
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   278
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   279
      using a model (default listMessage is aspectMessage):
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   280
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   281
	|top model l theModelsText|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   282
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   283
	model := Plug new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   284
	model respondTo:#modelsAspect
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   285
		   with:[ theModelsText ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   286
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   287
	top := StandardSystemView new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   288
	top extent:100@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   289
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   290
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   291
	l model:model.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   292
	l aspect:#modelsAspect.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   293
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   294
	top open.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   295
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   296
	Delay waitForSeconds:3.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   297
	theModelsText := #('foo' 'bar' 'baz').
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   298
	model changed:#modelsAspect.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   299
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   300
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   301
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   302
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   303
      using a model with different aspects
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   304
      for two listViews:
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   305
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   306
	|top model l1 l2 plainText|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   307
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   308
	plainText := #('').
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   309
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   310
	model := Plug new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   311
	model respondTo:#modelsUppercaseText
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   312
		   with:[ plainText asStringCollection
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   313
			      collect:[:l | l asUppercase]].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   314
	model respondTo:#modelsLowercaseText
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   315
		   with:[ plainText asStringCollection
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   316
			      collect:[:l | l asLowercase]].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   317
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   318
	top := StandardSystemView extent:200@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   319
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   320
	l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   321
	l1 model:model.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   322
	l1 aspect:#modelsAspect.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   323
	l1 listMessage:#modelsUppercaseText.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   324
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   325
	l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   326
	l2 model:model.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   327
	l2 aspect:#modelsAspect.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   328
	l2 listMessage:#modelsLowercaseText.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   329
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   330
	top open.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   331
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   332
	Delay waitForSeconds:3.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   333
	plainText := #('foo' 'bar' 'baz').
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   334
	model changed:#modelsAspect.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   335
									[exEnd]
3256
0e978bc1d5fd examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents: 3253
diff changeset
   336
0e978bc1d5fd examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents: 3253
diff changeset
   337
      using a big list (100000 lines):
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   338
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   339
	|bigList top lv|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   340
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   341
	bigList := (1 to:100000) collect:[:lineNr | 'List line Nr. ' , lineNr printString].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   342
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   343
	top := StandardSystemView extent:200@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   344
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   345
	lv := ScrollableView for:ListView in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   346
	lv origin:0.0 @ 0.0 corner:1.0 @ 1.0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   347
	lv list:bigList expandTabs:false scanForNonStrings:false includesNonStrings:false.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   348
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   349
	top open.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   350
									[exEnd]
3256
0e978bc1d5fd examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents: 3253
diff changeset
   351
0e978bc1d5fd examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents: 3253
diff changeset
   352
      using a huge virtual list (1 mio simulated lines):
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   353
									[exBegin]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   354
	|virtualList top lv|
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   355
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   356
	virtualList := Plug new.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   357
	virtualList inheritFrom:SequenceableCollection.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   358
	virtualList respondTo:#size with:[ 1000000 ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   359
	virtualList respondTo:#at:  with:[:lineNr | 'List line Nr. ' , lineNr printString ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   360
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   361
	top := StandardSystemView extent:200@200.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   362
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   363
	lv := ScrollableView for:ListView in:top.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   364
	lv origin:0.0 @ 0.0 corner:1.0 @ 1.0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   365
	lv list:virtualList expandTabs:false scanForNonStrings:false includesNonStrings:false.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   366
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   367
	top open.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   368
									[exEnd]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   369
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   370
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   371
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   372
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   373
!ListView class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   374
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   375
defaultTabPositions
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   376
    "return an array containing the styleSheets default tab positions"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   377
3777
4a9854ac7ab0 default to 4-tabs
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
   378
    ^ DefaultTabPositions ? self tab4Positions
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   379
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   380
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   381
defaultTabPositions:aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   382
    "set the array containing the styleSheets tab positions"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   383
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   384
    DefaultTabPositions := aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   385
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   386
    "
3777
4a9854ac7ab0 default to 4-tabs
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
   387
     ListView defaultTabPositions:(ListView tab4Positions)
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   388
    "
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   389
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   390
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   391
tab4Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   392
    "return an array containing tab positions for 4-col tabs"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   393
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   394
    ^ #(1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   395
	85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145)
120
claus
parents: 118
diff changeset
   396
!
claus
parents: 118
diff changeset
   397
claus
parents: 118
diff changeset
   398
tab8Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   399
    "return an array containing tab positions for 8-col tabs"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   400
120
claus
parents: 118
diff changeset
   401
    ^ #(1 9 17 25 33 41 49 57 65 73 81 89 97 105 113 121 129 137 145)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   402
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   403
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   404
updateStyleCache
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   405
    "extract values from the styleSheet and cache them in class variables"
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   406
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   407
    <resource: #style (#'text.foregroundColor' #'text.backgroundColor'
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   408
		       #'text.tabPositions'
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   409
		       #'text.font')>
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   410
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   411
    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   412
    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:White.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   413
    DefaultFont := StyleSheet fontAt:'text.font'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   414
    DefaultTabPositions := StyleSheet at:'text.tabPositions'.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   415
    DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions].
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   416
    DefaultLeftMargin := 0.5.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   417
    DefaultTopMargin := 0.5.
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   418
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   419
    "Modified: 20.10.1997 / 15:05:30 / cg"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   420
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   421
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   422
userDefaultTabPositions
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   423
    "return an array containing the users default tab positions"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   424
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   425
    ^ UserDefaultTabPositions
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   426
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   427
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   428
userDefaultTabPositions:aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   429
    "set the array containing the users tab positions"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   430
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   431
    UserDefaultTabPositions := aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   432
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   433
    "
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   434
     self userDefaultTabPositions:(self tab4Positions)
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   435
    "
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   436
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   437
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   438
!ListView methodsFor:'accessing'!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   439
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   440
innerHeight
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   441
    "return the number of pixels visible of the contents
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   442
     - redefined since ListView adds another margin to start the text
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   443
     somewhat to indented from the 3D border."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   444
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   445
    ^ height - (2 * margin) - topMargin
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   446
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   447
339
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   448
wordCheckBlock:aBlock
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   449
    "set the word-check block - this block is called with a character argument,
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   450
     when the end/beginning of a word is searched.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   451
     It should return true, if the character belongs to the word.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   452
     The default block is set in #initialize, and returns true for alphanumeric
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   453
     (national) characters.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   454
     Applications may change it to include underlines, dollars or other characters.
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   455
     (a C/C++ editor would include underlines ...)"
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   456
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   457
    wordCheck := aBlock.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   458
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   459
    "Modified: 22.5.1996 / 12:26:55 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   460
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   461
2133
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
   462
!ListView methodsFor:'accessing-behavior'!
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   463
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   464
lineEndCRLF
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   465
    ^ lineEndCRLF ? false
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   466
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   467
    "Created: / 04-07-2006 / 19:05:01 / fm"
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   468
!
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   469
2325
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   470
scrollWhenUpdating
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   471
    "return the scroll behavior, when I get a new text
2325
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   472
     (via the model or the #contents/#list)
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   473
     Possible returnValues are:
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   474
	#keep / nil     -> no change
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   475
	#endOfText      -> scroll to the end
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   476
	#beginOfText    -> scroll to the top
3116
2df69a526f06 default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
   477
     The default is #keep.
2325
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   478
     This may be useful for fields which get new values assigned from
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   479
     the program (i.e. not from the user)"
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   480
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   481
    ^ scrollWhenUpdating
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   482
!
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   483
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   484
scrollWhenUpdating:aSymbolOrNil
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   485
    "define how to scroll, when I get a new text
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   486
     (via the model or the #contents/#list)
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   487
     Allowed arguments are:
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   488
	#keep / nil     -> no change
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   489
	#endOfText      -> scroll to the end
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   490
	#beginOfText    -> scroll to the top
3116
2df69a526f06 default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
   491
     The default is #keep.
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   492
     This may be useful for fields which get new values assigned from
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   493
     the program (i.e. not from the user)"
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   494
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   495
    scrollWhenUpdating := aSymbolOrNil
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   496
! !
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   497
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   498
!ListView methodsFor:'accessing-contents'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   499
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   500
add:aString
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   501
    "add a line and redisplay"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   502
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   503
    |fontHeightBefore|
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   504
2967
fb6061a81f8d initialize list if nil in add:
penk
parents: 2926
diff changeset
   505
    list isNil ifTrue:[list := OrderedCollection new].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   506
    list add:aString.
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   507
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   508
    includesNonStrings ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   509
	includesNonStrings := (aString notNil and:[aString isString not]).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   510
	includesNonStrings ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   511
	    fontHeightBefore := fontHeight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   512
	    self getFontParameters.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   513
	    fontHeightBefore ~~ fontHeight ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   514
		self invalidate
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   515
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   516
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   517
    ].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   518
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   519
    widthOfWidestLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   520
	self recomputeWidthOfWidestLineFor:aString
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   521
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   522
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   523
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   524
	self redrawLine:(self size).
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   525
    ].
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   526
    self contentsChanged.             "recompute scrollbars"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   527
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   528
    "Modified: 22.10.1996 / 23:18:47 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   529
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   530
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   531
add:aString beforeIndex:index
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   532
    "add a line and redisplay"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   533
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   534
    |lastShown|
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   535
1351
03d1b138f98f add:aString beforeIndex:
ca
parents: 1338
diff changeset
   536
    list isNil ifTrue:[list := OrderedCollection new].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   537
    list add:aString beforeIndex:index.
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   538
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   539
    widthOfWidestLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   540
	self recomputeWidthOfWidestLineFor:aString
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   541
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   542
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   543
    includesNonStrings ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   544
	includesNonStrings := (aString notNil and:[aString isString not]).
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   545
"/        includesNonStrings ifTrue:[self getFontParameters].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   546
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   547
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   548
	lastShown := self lastLineShown.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   549
	index <= 2 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   550
	    self invalidate
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   551
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   552
	    index to:lastShown do:[:eachLine |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   553
		self invalidateLine:eachLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   554
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   555
	].
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   556
    ].
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   557
    self contentsChanged.             "recompute scrollbars"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   558
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   559
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   560
	"/ self selection isNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   561
	    self scrollToBottom.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   562
	"/ ]
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   563
    ].
65
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   564
!
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   565
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   566
addAll:aCollectionOfLines beforeIndex:index
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   567
    "add a bunch of lines and redisplay"
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   568
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   569
    |lastShown|
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   570
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   571
    list isNil ifTrue:[list := OrderedCollection new].
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   572
    aCollectionOfLines do:[:eachLine |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   573
	list addAll:aCollectionOfLines beforeIndex:index.
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   574
    ].
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   575
    includesNonStrings ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   576
	aCollectionOfLines do:[:eachLine |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   577
	    includesNonStrings := includesNonStrings or:[(eachLine notNil and:[eachLine isString not])].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   578
	]
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   579
    ].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   580
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   581
    widthOfWidestLine := nil. "/ i.e. unknown
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   582
    self textChanged.
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   583
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   584
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   585
	lastShown := self lastLineShown.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   586
	((index-1) <= lastShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   587
	    index <= 2 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   588
		self invalidate
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   589
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   590
		index-1 to:lastShown do:[:eachLine |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   591
		    self invalidateLine:eachLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   592
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   593
		"/  self redrawFromLine:index-1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   594
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   595
	].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   596
    ].
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   597
    self contentsChanged.             "recompute scrollbars"
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   598
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   599
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   600
	"/ self selection isNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   601
	    self scrollToBottom.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   602
	"/ ]
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   603
    ].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   604
!
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   605
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   606
at:lineNr
120
claus
parents: 118
diff changeset
   607
    "retrieve a line; return nil if beyond end-of-text.
claus
parents: 118
diff changeset
   608
     this allows textViews to be used like collections in some places."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   609
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   610
    list isNil ifTrue:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   611
    (lineNr between:1 and:self size) ifFalse:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   612
    ^ list at:lineNr
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   613
!
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   614
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   615
at:index put:aString
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   616
    "change a line and redisplay"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   617
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   618
    |fontHeightBefore widthBefore|
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   619
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   620
    fontHeightBefore := fontHeight.
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   621
    widthBefore := widthOfWidestLine.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   622
    self withoutRedrawAt:index put:aString.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   623
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   624
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   625
	fontHeightBefore ~= fontHeight ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   626
	    "/ must redraw everything
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   627
	    self invalidate.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   628
	    ^ self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   629
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   630
	self redrawLine:index.
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   631
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   632
"/ the code below is wrong - we really have to redraw everything, if the
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   633
"/ fontHeight changes (due to a labelAndIcon in the list).
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   634
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   635
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   636
"/        "/ this could have changed the font height;
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   637
"/        "/ must clear all below last line, if it became smaller
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   638
"/        fontHeightBefore > fontHeight ifTrue:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   639
"/            (self listLineIsVisible:(self size)) ifTrue:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   640
"/                self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1))
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   641
"/                                    corner:(width-margin) @ (height-margin).
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   642
"/            ].
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   643
"/            self redrawFromLine:index
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   644
"/        ] ifFalse:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   645
"/            self redrawLine:index
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   646
"/        ].
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   647
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   648
	"/ asynchronous:
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   649
"/        visibleLine := self listLineToVisibleLine:index.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   650
"/        visibleLine notNil ifTrue:[
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   651
"/            y := self yOfVisibleLine:visibleLine.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   652
"/            self invalidate:((margin @ y) extent:(width@fontHeight))
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   653
"/        ].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   654
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   655
	widthBefore ~~ widthOfWidestLine ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   656
	    self contentsChanged
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   657
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   658
    ]
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   659
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   660
    "Modified: / 26.7.1998 / 13:36:33 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   661
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   662
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   663
characterAtCharacterPosition:charPos
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   664
    "return the character at a 1-based character position.
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   665
     Return a space character if nothing is there
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2687
diff changeset
   666
     (i.e. beyond the end of the line or below the last line)"
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   667
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   668
    |line col|
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   669
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   670
    line := self lineOfCharacterPosition:charPos.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   671
    col := charPos - (self characterPositionOfLine:line col:1) + 1.
2443
9a1258c6dcbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
   672
    col == 0 ifTrue:[^ Character cr].
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   673
    ^ self characterAtLine:line col:col
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   674
!
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   675
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   676
characterAtLine:lineNr col:colNr
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   677
    "return the character at physical line/col.
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   678
     The lineNr and colNr arguments start at 1, for the top-left cgaracter.
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   679
     Return a space character if nothing is there
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2687
diff changeset
   680
     (i.e. beyond the end of the line or below the last line)"
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   681
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   682
    |line|
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   683
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   684
    list notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   685
	line := self listAt:lineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   686
	line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   687
	    (line size >= colNr) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   688
		^ line at:colNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   689
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   690
	]
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   691
    ].
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   692
    ^ Character space
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   693
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   694
    "Created: 29.4.1996 / 12:11:00 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   695
    "Modified: 29.4.1996 / 12:12:41 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   696
!
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   697
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   698
contents
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   699
    "return the contents as a string"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   700
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   701
    list isNil ifTrue:[^ ''].
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   702
    self lineEndCRLF ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   703
	^ list asStringCollection asStringWith:(String crlf)
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   704
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   705
    ^ list asStringCollection asString
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   706
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   707
    "Modified: / 04-07-2006 / 19:18:47 / fm"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   708
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   709
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   710
contents:something
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   711
    "set the contents (either a String or a Collection of strings)
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   712
     also scroll to top. See #setContents:, which does not scroll.
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   713
     If the argument is a string, it is converted
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   714
     to a collection of line-strings here."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   715
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   716
    |l|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   717
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   718
    l := something.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   719
    l notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   720
	l isString ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   721
	    l := l asStringCollection
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   722
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   723
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   724
    self list:l
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   725
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   726
    "Modified: 5.6.1997 / 11:11:54 / cg"
51
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   727
!
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   728
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   729
from:from to:to do:aBlock
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   730
    "evaluate aBlock on some of my lines"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   731
3256
0e978bc1d5fd examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents: 3253
diff changeset
   732
    list from:from to:to do:aBlock.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   733
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   734
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   735
grow:n
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   736
    "grow our list"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   737
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   738
    ^ list grow:n.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   739
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   740
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   741
lineAtY:y
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   742
    "return the lineNr for a given y-(view-)coordinate"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   743
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   744
    |visibleLine|
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   745
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   746
    visibleLine := self visibleLineOfY:y.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   747
    visibleLine isNil ifTrue:[^ nil].
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   748
    ^ self visibleLineToListLine:visibleLine.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   749
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   750
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   751
list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   752
    "return the contents as a collection of strings.
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   753
     This returns the views internal list - modifying it may confuse
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   754
     the listView."
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   755
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   756
    ^ list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   757
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   758
    "Modified: 5.6.1997 / 11:10:54 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   759
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   760
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   761
list:aCollection
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   762
    "set the contents (a collection of strings or list entries)
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   763
     and scroll as specified in scrollWhenUpdating (default:top-left).
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   764
     See also #setList:, which does not scroll.
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   765
     Tabs are expanded (to spaces).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   766
     The passed list is scanned for nonStrings
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   767
     (remembered to optimize later redraws)."
128
claus
parents: 127
diff changeset
   768
claus
parents: 127
diff changeset
   769
    self list:aCollection expandTabs:true
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   770
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   771
    "Modified: 5.6.1997 / 11:10:45 / cg"
128
claus
parents: 127
diff changeset
   772
!
claus
parents: 127
diff changeset
   773
claus
parents: 127
diff changeset
   774
list:aCollection expandTabs:expand
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   775
    "set the contents (a collection of strings)
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   776
     and scroll as specified in scrollWhenUpdating (default:top-left).
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   777
     If expand is true, tabs are expanded (to spaces).
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   778
     The passed list is scanned for nonStrings (remembered to optimize
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   779
     later redraws)."
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   780
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   781
    self list:aCollection expandTabs:expand scanForNonStrings:true
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   782
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   783
    "Modified: 5.6.1997 / 11:09:44 / cg"
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   784
!
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   785
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   786
list:aCollection expandTabs:expand scanForNonStrings:scan
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   787
    "set the contents (a collection of strings)
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   788
     and scroll as specified in scrollWhenUpdating (default:top-left).
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   789
     If expand is true, tabs are expanded (to spaces).
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   790
     If scan is true, scan the passed list for nonStrings; otherwise,
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   791
     assume that it does contain non-strings
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   792
     (remembered to optimize later redraws)."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   793
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   794
    self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   795
	list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   796
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   797
    "Modified: 5.6.1997 / 12:40:35 / cg"
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   798
!
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   799
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   800
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   801
    "set the contents (a collection of strings)
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   802
     and scroll as specified in scrollWhenUpdating (default:top-left).
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   803
     If expand is true, tabs are expanded (to spaces).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   804
     If scan is true, scan the passed list for nonStrings;
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   805
     otherwise, take the information from the nonStrings arg.
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   806
     (the nonStrings information is remembered to optimize later redraws & height computations)."
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   807
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   808
    |oldFirst oldLeft nonStringsBefore fontHeightBefore
3821
5cba956b774a cadsoft
Claus Gittinger <cg@exept.de>
parents: 3819
diff changeset
   809
     scrollToEnd scrollToTop newLeftOffset wText same firstLine|
2891
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
   810
2911
f9dc65c59f63 use == when comparing list for being the same
Claus Gittinger <cg@exept.de>
parents: 2900
diff changeset
   811
    "/ see if there is a change at all.
f9dc65c59f63 use == when comparing list for being the same
Claus Gittinger <cg@exept.de>
parents: 2900
diff changeset
   812
    "/ use to compare using =, but thats not enough in case of emphasis change.
2891
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
   813
    aCollection size == list size ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   814
	same := true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   815
	aCollection size > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   816
	    aCollection with:list do:[:eachNewLine :eachOldLine |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   817
		(eachNewLine == eachOldLine)
2911
f9dc65c59f63 use == when comparing list for being the same
Claus Gittinger <cg@exept.de>
parents: 2900
diff changeset
   818
"/                ((eachNewLine species == eachOldLine species)
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   819
"/                and:[eachNewLine = eachOldLine])
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   820
		ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   821
		    same := false.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   822
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   823
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   824
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   825
	same ifTrue:[^ self].
2891
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
   826
    ].
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   827
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   828
    scrollToTop := scrollWhenUpdating == #begin or:[scrollWhenUpdating == #beginOfText].
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   829
    scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   830
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   831
    (aCollection isNil and:[list isNil]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   832
	"no contents change"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   833
	scrollToTop ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   834
	    self scrollToTop.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   835
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   836
	    scrollToEnd ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   837
		self scrollToBottom.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   838
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   839
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   840
	self scrollToLeft.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   841
	^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   842
    ].
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   843
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   844
    lineEndCRLF := (aCollection size > 0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   845
		    and:[(firstLine := aCollection at:1) isString
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   846
		    and:[firstLine notEmpty
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   847
		    and:[firstLine string endsWith:Character return]]]).
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   848
    lineEndCRLF ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   849
	list := aCollection
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   850
		    collect:[:eachLineWithCROrNil |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   851
			eachLineWithCROrNil isNil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   852
			    ifTrue:nil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   853
			    ifFalse:[(eachLineWithCROrNil endsWith:Character return)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   854
				     ifTrue:[eachLineWithCROrNil copyButLast:1]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   855
				     ifFalse:[eachLineWithCROrNil]]].
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   856
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   857
	list := aCollection.
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   858
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   859
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   860
    nonStringsBefore := includesNonStrings.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   861
    fontHeightBefore := fontHeight.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   862
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   863
152
claus
parents: 148
diff changeset
   864
    list notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   865
	expand ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   866
	    self expandTabs
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   867
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   868
	    scan ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   869
		includesNonStrings := list contains:[:e | e isString not].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   870
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   871
		includesNonStrings := nonStrings
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   872
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   873
	].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   874
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   875
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   876
	self getFontParameters.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   877
    ].
152
claus
parents: 148
diff changeset
   878
125
claus
parents: 121
diff changeset
   879
    widthOfWidestLine := nil.   "/ i.e. unknown
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   880
    oldFirst := firstLineShown.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   881
    oldLeft := viewOrigin x.
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   882
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   883
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   884
	self computeNumberOfLinesShown.
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   885
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   886
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   887
    newLeftOffset := viewOrigin x.
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   888
    scrollToTop ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   889
	firstLineShown := 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   890
	newLeftOffset := 0.
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   891
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   892
	scrollToEnd ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   893
	    firstLineShown := (list size - nFullLinesShown + 1) max:1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   894
	    newLeftOffset := 0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   895
	]
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   896
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   897
    newLeftOffset > 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   898
	wText := self widthOfContents.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   899
	(viewOrigin x + self innerWidth) > wText ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   900
	    newLeftOffset := (wText - self innerWidth) max:0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   901
	].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   902
    ].
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   903
    newLeftOffset ~= oldLeft ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   904
	viewOrigin := newLeftOffset @ viewOrigin y.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   905
    ].
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   906
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   907
    realized ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   908
	self contentsChanged.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   909
	"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   910
	 dont use scroll here to avoid double redraw
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   911
	"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   912
	viewOrigin := viewOrigin isNil ifTrue:[0@0] ifFalse:[(viewOrigin x) @ 0].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   913
	transformation := nil.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   914
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   915
	oldFirst ~~ firstLineShown ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   916
	    self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   917
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   918
	shown ifTrue:[
3624
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   919
self invalidate.
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   920
"/            self redrawFromVisibleLine:1 to:nLinesShown.
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   921
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   922
"/            fontHeightBefore > fontHeight ifTrue:[
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   923
"/                (self listLineIsVisible:(self size)) ifTrue:[
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   924
"/"/                    self clearRectangle:((margin @ (self yOfVisibleLine:nLinesShown+1))
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   925
"/"/                                        corner:(width-margin) @ (height-margin)).
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   926
"/                ].
bf7a940f3c60 invalidate instead of immediate redraw, when the list changes
Claus Gittinger <cg@exept.de>
parents: 3621
diff changeset
   927
"/            ]
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   928
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   929
    ]
153
claus
parents: 152
diff changeset
   930
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   931
    "Modified: / 30-08-1995 / 19:07:13 / claus"
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   932
    "Created: / 05-06-1997 / 12:40:06 / cg"
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   933
    "Modified: / 04-07-2006 / 19:12:39 / fm"
3339
ec4214f718df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3317
diff changeset
   934
    "Modified: / 22-08-2006 / 11:59:56 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   935
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   936
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   937
listAt:lineNr
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   938
    "given a lineNumber, return the corresponding string
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   939
     This is used for accessing; i.e. for non-string entries, this
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   940
     returns the corresponding string."
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   941
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   942
    |l|
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   943
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   944
    list isNil ifTrue:[^ nil].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   945
    (lineNr between:1 and:self size) ifFalse:[^ nil].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   946
    l := self at:lineNr.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   947
    l isNil ifTrue:[^ l].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   948
    ^ self visibleStringFrom:l "/ l asString
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   949
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   950
    "Modified: 7.9.1995 / 15:54:59 / claus"
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   951
!
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
   952
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   953
removeFromIndex:startLineNr toIndex:endLineNr
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   954
    "delete some lines"
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   955
3442
418b14cb6a78 do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
   956
    |nLines widestLineRemoved|
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   957
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   958
    list isNil ifTrue:[^ self].
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   959
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   960
    widestLineRemoved := self widthOfWidestLineBetween:startLineNr and:endLineNr.
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   961
    list removeFromIndex:startLineNr toIndex:(endLineNr min:list size).
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   962
3442
418b14cb6a78 do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
   963
    widthOfWidestLine == widestLineRemoved ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   964
	widthOfWidestLine := nil. "/ i.e. unknown
3442
418b14cb6a78 do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
   965
    ].
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   966
    self textChanged.
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   967
2237
43f0318a830e scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents: 2233
diff changeset
   968
    ((startLineNr <= self lastLineShown)
43f0318a830e scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents: 2233
diff changeset
   969
    and:[endLineNr >= firstLineShown]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   970
	startLineNr to:self lastLineShown do:[:eachLine |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   971
	    self invalidateLine:eachLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   972
	].
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   973
    ].
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   974
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   975
    nLines := list size.
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   976
    (firstLineShown >= nLines) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   977
	self makeLineVisible:nLines
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   978
    ].
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   979
    self contentsChanged.
3442
418b14cb6a78 do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
   980
418b14cb6a78 do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
   981
    "Modified: / 01-01-1970 / 01:00:00 / cg"
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   982
!
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   983
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   984
removeIndex:lineNr
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   985
    "delete a line, redraw the view"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   986
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
   987
    |visLine w h x
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   988
     srcY "{ Class: SmallInteger }" |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   989
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   990
    (self removeIndexWithoutRedraw:lineNr) ifFalse:[^ self].
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   991
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   992
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   993
     is there a need to redraw ?
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   994
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   995
    shown ifFalse:[^ self].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   996
    visLine := self listLineToVisibleLine:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   997
    visLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   998
	w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
1433
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   999
"/        x := textStartLeft.
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
  1000
"/ CLAUS fixes leftOver selection pixels
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1001
	w := w + leftMargin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1002
	x := margin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1003
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1004
	srcY := topMargin + (visLine * fontHeight).
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1005
"/        h := ((nLinesShown - visLine) * fontHeight).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1006
	h := (height - margin - srcY).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1007
	h > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1008
	    self catchExpose.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1009
	    self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1010
		copyFrom:self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1011
		x:x y:srcY
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1012
		toX:x y:(srcY - fontHeight)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1013
		width:w height:h
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1014
		async:true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1015
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1016
	self redrawVisibleLine:nFullLinesShown.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1017
	"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1018
	 redraw last partial line - if any
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1019
	"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1020
	(nFullLinesShown ~~ nLinesShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1021
	    self redrawVisibleLine:nLinesShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1022
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1023
	h > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1024
	    self waitForExpose
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1025
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1026
    ]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1027
1460
b9929a029249 dont bitBlt if height is <= 0
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
  1028
    "Modified: / 27.2.1998 / 12:36:59 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1029
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1030
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1031
removeIndexWithoutRedraw:lineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1032
    "delete a line, given its lineNr - no redraw;
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1033
     return true, if something was really deleted (so sender knows,
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1034
     if a redraw is needed)"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1035
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1036
    (list isNil or:[lineNr > self size]) ifTrue:[^ false].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1037
    list removeIndex:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1038
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1039
    lineNr < firstLineShown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1040
	firstLineShown := firstLineShown - 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1041
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1042
    self contentsChanged.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1043
    ^ true
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1044
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1045
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1046
replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1047
    "replace some lines"
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1048
3198
759c05feb9eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3179
diff changeset
  1049
    list isNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1050
	list := OrderedCollection new.
3198
759c05feb9eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3179
diff changeset
  1051
    ].
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1052
    list replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex.
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1053
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1054
    widthOfWidestLine := nil. "/ i.e. unknown
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1055
    self textChanged.
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1056
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1057
    ((startLineNr <= self lastLineShown)
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1058
    and:[endLineNr >= firstLineShown]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1059
	self invalidate.
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1060
    ].
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1061
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1062
    self contentsChanged.
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1063
!
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1064
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1065
setContents:something
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1066
    "set the contents (either a string or a Collection of strings)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1067
     dont change position (i.e. do not scroll).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1068
     This can be used to update a self-changing list
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1069
     (for example: a file list being shown, without disturbing user too much).
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1070
     Compare with #contents:, which scrolls to top."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1071
2891
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1072
    |l|
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1073
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1074
    l := something.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1075
    l notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1076
	l isString ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1077
	    l := l asStringCollection
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1078
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1079
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1080
    self setList:l.
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1081
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1082
    "Modified: 18.12.1995 / 22:20:43 / stefan"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1083
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1084
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1085
setList:aCollection
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1086
    "set the contents (a collection of strings);
153
claus
parents: 152
diff changeset
  1087
     do not change position (i.e. do not scroll).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1088
     This can be used to update a self-changing list
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1089
     (for example: a file list being shown, without disturbing user too much)"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1090
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1091
    ^ self setList:aCollection expandTabs:true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1092
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1093
153
claus
parents: 152
diff changeset
  1094
setList:aCollection expandTabs:expandTabs
claus
parents: 152
diff changeset
  1095
    "set the contents (a collection of strings);
claus
parents: 152
diff changeset
  1096
     do not change position (i.e. do not scroll).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1097
     This can be used to update a self-changing list
153
claus
parents: 152
diff changeset
  1098
     (for example: a file list being shown, without disturbing the user too much)"
claus
parents: 152
diff changeset
  1099
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1100
    self setList:aCollection expandTabs:expandTabs redraw:true
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1101
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1102
    "Modified: / 22.4.1998 / 11:12:24 / cg"
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1103
!
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1104
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1105
setList:aCollection expandTabs:expandTabs redraw:doRedraw
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1106
    "set the contents (a collection of strings);
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1107
     do not change position (i.e. do not scroll).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1108
     This can be used to update a self-changing list
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1109
     (for example: a file list being shown, without disturbing the user too much)"
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1110
2926
322d9be4ce54 clear -> clearView
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1111
    |oldFirst nonStringsBefore|
153
claus
parents: 152
diff changeset
  1112
claus
parents: 152
diff changeset
  1113
    (aCollection isNil and:[list isNil]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1114
	"no change"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1115
	^ self
153
claus
parents: 152
diff changeset
  1116
    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1117
153
claus
parents: 152
diff changeset
  1118
    list := aCollection.
claus
parents: 152
diff changeset
  1119
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1120
    nonStringsBefore := includesNonStrings.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1121
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1122
153
claus
parents: 152
diff changeset
  1123
    list notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1124
	expandTabs ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1125
	    self expandTabs
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1126
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1127
	    includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1128
	].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1129
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1130
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1131
	self getFontParameters.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1132
	self computeNumberOfLinesShown.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1133
    ].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1134
2926
322d9be4ce54 clear -> clearView
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1135
    "/ new: reposition horizontally if too big
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1136
    widthOfWidestLine := nil.   "/ i.e. unknown
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1137
    innerWidth >= self widthOfContents ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1138
	viewOrigin := 0 @ viewOrigin y.
153
claus
parents: 152
diff changeset
  1139
    ].
claus
parents: 152
diff changeset
  1140
    self contentsChanged.
claus
parents: 152
diff changeset
  1141
2926
322d9be4ce54 clear -> clearView
Claus Gittinger <cg@exept.de>
parents: 2913
diff changeset
  1142
    "/ new: reposition vertically if too big
153
claus
parents: 152
diff changeset
  1143
    (firstLineShown + nFullLinesShown) > self size ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1144
	oldFirst := firstLineShown.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1145
	firstLineShown := self size - nFullLinesShown + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1146
	firstLineShown < 1 ifTrue:[firstLineShown := 1].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1147
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1148
	viewOrigin y:(firstLineShown - 1 * fontHeight).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1149
	self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1150
	shown ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1151
	    self clearView.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1152
	]
153
claus
parents: 152
diff changeset
  1153
    ].
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1154
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1155
    (shown and:[doRedraw]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1156
	  self redrawFromVisibleLine:1 to:nLinesShown
153
claus
parents: 152
diff changeset
  1157
    ]
claus
parents: 152
diff changeset
  1158
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1159
    "Modified: / 18.12.1995 / 23:27:54 / stefan"
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1160
    "Created: / 22.4.1998 / 11:11:51 / cg"
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1161
    "Modified: / 26.7.1998 / 13:46:49 / cg"
153
claus
parents: 152
diff changeset
  1162
!
claus
parents: 152
diff changeset
  1163
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1164
size
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1165
    "return the size (i.e. number of lines)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1166
     this allows textViews to be used like collections in some places."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1167
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1168
    ^ list size.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1169
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1170
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1171
stringAtLine:lineNr from:col1 to:col2
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1172
    "return the substring starting at physical line/col1, up-to and
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1173
     including col2.
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1174
     The lineNr and colNr arguments start at 1, for the top-left character.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1175
     Fills the string with space characters at the right.
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2687
diff changeset
  1176
     (i.e. beyond the end of the line or below the last line)"
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1177
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1178
    |line len s|
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1179
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1180
    len := col2 - col1 + 1.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1181
    list notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1182
	line := self listAt:lineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1183
	line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1184
	    (line size >= col1) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1185
		s := line copyFrom:col1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1186
		s size < len ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1187
		    ^ s paddedTo:len
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1188
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1189
		^ s copyTo:len
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1190
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1191
	]
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1192
    ].
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1193
    ^ String new:len withAll:Character space
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1194
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1195
    "Created: 7.1.1997 / 19:58:43 / cg"
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1196
!
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1197
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1198
textFromCharacterPosition:charPos1 to:charPos2
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1199
    "return some text as a collection of (line-)strings."
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1200
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1201
    |line1 col1 line2 col2|
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1202
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1203
    line1 := self lineOfCharacterPosition:charPos1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1204
    col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1205
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1206
    line2 := self lineOfCharacterPosition:charPos2.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1207
    col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1208
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1209
    ^ self textFromLine:line1 col:col1 toLine:line2 col:col2.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1210
!
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1211
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1212
textFromLine:startLine col:startCol toLine:endLine col:endCol
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1213
    "return some text as a collection of (line-)strings."
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1214
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1215
    |text sz index last|
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1216
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1217
    (startLine == endLine) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1218
	"part of a line"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1219
	^ StringCollection with:(self listAt:startLine from:startCol to:endCol)
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1220
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1221
    sz := endLine - startLine + 1.
2687
b6e87b6b88a1 checkin from browser
penk
parents: 2667
diff changeset
  1222
    sz < 1 ifTrue:[^ nil].
b6e87b6b88a1 checkin from browser
penk
parents: 2667
diff changeset
  1223
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1224
    text := StringCollection new:sz.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1225
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1226
    "get 1st and last (possibly) partial lines"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1227
    text at:1 put:(self listAt:startLine from:startCol).
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1228
    endCol == 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1229
	last := ''
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1230
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1231
	last := self listAt:endLine to:endCol.
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1232
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1233
    text at:sz put:last.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1234
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1235
    "get bulk of text"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1236
    index := 2.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1237
    (startLine + 1) to:(endLine - 1) do:[:lineNr |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1238
	text at:index put:(self listAt:lineNr).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1239
	index := index + 1
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1240
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1241
    ^ text
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1242
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1243
    "Created: / 22.2.2000 / 23:53:06 / cg"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1244
!
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1245
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1246
withoutRedrawAt:index put:aString
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1247
    "change a line without redisplay and WITHOUT any sizeChange notifications.
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1248
     Somewhat dangerous, since scrollBars will not be informed about contents-changes.
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1249
     Use only if multiple lines are to be changed, and a sizeChanged is invoked by some other
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1250
     means at the end."
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1251
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1252
    |didIncludeNonStrings oldLine|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1253
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1254
    self checkForExistingLine:index.
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1255
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1256
    oldLine := self listAt:index.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1257
    list at:index put:aString.
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1258
    oldLine ~= aString ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1259
	self textChanged
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1260
    ].
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1261
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1262
    didIncludeNonStrings := includesNonStrings.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1263
    includesNonStrings ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1264
	includesNonStrings := (aString notNil and:[aString isString not]).
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1265
    ] ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1266
	(aString isNil or:[aString isString]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1267
	    includesNonStrings := (list findFirst:[:l | l notNil and:[l isString not]]) ~~ 0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1268
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1269
    ].
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1270
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1271
    includesNonStrings ~~ didIncludeNonStrings ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1272
	self getFontParameters.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1273
	self computeNumberOfLinesShown
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1274
    ].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1275
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1276
    widthOfWidestLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1277
	self recomputeWidthOfWidestLineFor:aString
1963
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1278
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1279
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1280
    "Modified: / 26.7.1998 / 13:00:14 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1281
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1282
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1283
!ListView methodsFor:'accessing-look'!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1284
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1285
backgroundColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1286
    "return the background color"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1287
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1288
    ^ bgColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1289
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1290
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1291
backgroundColor:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1292
    "set the background color of the contents"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1293
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1294
    bgColor ~~ aColor ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1295
	bgColor := aColor.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1296
	self viewBackground:bgColor.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1297
	self invalidate "/ clear; redraw
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1298
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1299
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1300
    "Modified: 3.5.1997 / 10:27:40 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1301
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1302
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1303
font:aFont
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1304
    "set the font for all shown text.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1305
     Redraws everything.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1306
     CAVEAT: with the addition of Text objects,
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1307
	     this method is going to be obsoleted by a textStyle
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1308
	     method, which allows specific control over
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1309
	     normalFont/boldFont/italicFont parameters."
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1310
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1311
    aFont isNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1312
	^ self error:'nil font' mayProceed:true
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1313
    ].
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1314
    font ~~ aFont ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1315
	super font:(aFont onDevice:device).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1316
	preferredExtent := nil.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1317
	widthOfWidestLine := nil. "/ i.e. unknown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1318
	self getFontParameters.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1319
	realized ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1320
	    (font graphicsDevice == device) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1321
		self computeNumberOfLinesShown.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1322
		shown ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1323
		    self redrawFromVisibleLine:1 to:nLinesShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1324
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1325
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1326
	    self contentsChanged
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1327
	]
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1328
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1329
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1330
    "Modified: 5.7.1996 / 17:55:34 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1331
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1332
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1333
fontHeight:pixels
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1334
    "set the lines height - thats the number of pixels,
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1335
     by which lines are vertically separated."
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1336
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1337
    fontHeight ~~ pixels ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1338
	fontHeight := pixels.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1339
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1340
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1341
    "Created: 17.4.1997 / 01:41:33 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1342
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1343
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1344
foregroundColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1345
    "return the foreground color"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1346
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1347
    ^ fgColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1348
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1349
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1350
foregroundColor:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1351
    "set the foreground color"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1352
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1353
    fgColor ~~ aColor ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1354
	fgColor := aColor.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1355
	self invalidate
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1356
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1357
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1358
    "Modified: 29.5.1996 / 16:19:02 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1359
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1360
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1361
foregroundColor:color1 backgroundColor:color2
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1362
    "set both foreground and background colors"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1363
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1364
    ((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1365
	fgColor := color1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1366
	bgColor := color2.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1367
	self invalidate
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1368
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1369
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1370
    "Modified: 29.5.1996 / 16:19:05 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1371
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1372
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1373
innerHorizontalMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1374
    "return the margin between the left border and the 1st col"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1375
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1376
    ^ leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1377
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1378
    "Created: 16.1.1996 / 19:28:23 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1379
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1380
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1381
innerVerticalMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1382
    "return the margin between the top border and the 1st line"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1383
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1384
    ^ topMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1385
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1386
    "Created: 16.1.1996 / 19:28:00 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1387
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1388
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1389
leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1390
    "return the margin to left of 1st col"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1391
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1392
    ^ leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1393
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1394
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1395
leftMargin:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1396
    "set the margin between the left border and the 1st col"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1397
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1398
    leftMargin := aNumber.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1399
    textStartLeft := aNumber + margin.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1400
    innerWidth := width - aNumber - margin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1401
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1402
    "Modified: 28.2.1996 / 19:32:55 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1403
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1404
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1405
level:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1406
    "set the 3D level - caught here to update text-position variables
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1407
     (which avoids many computations later)"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1408
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1409
    |newMargin|
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1410
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1411
    aNumber ~~ level ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1412
	newMargin := aNumber abs.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1413
	textStartLeft := leftMargin + newMargin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1414
	textStartTop := topMargin + newMargin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1415
	innerWidth := width - textStartLeft - newMargin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1416
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1417
	super level:aNumber.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1418
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1419
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1420
    "Modified: 11.8.1997 / 02:59:15 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1421
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1422
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1423
lineSpacing:pixels
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1424
    "set the lineSpacing - thats an additional number of pixels,
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1425
     by which lines are vertically separated."
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1426
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1427
    lineSpacing ~~ pixels ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1428
	lineSpacing := pixels.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1429
	self getFontParameters.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1430
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1431
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1432
    "Modified: 22.5.1996 / 12:22:29 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1433
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1434
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1435
partialLines:aBoolean
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1436
    "allow/disallow display of a last partial line"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1437
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1438
    partialLines := aBoolean.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1439
    self computeNumberOfLinesShown
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1440
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1441
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1442
topMargin:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1443
    "set the margin between the top border and the 1st line"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1444
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1445
    topMargin := aNumber.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1446
    textStartTop := topMargin + margin.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1447
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1448
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1449
viewBackground:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1450
    super viewBackground:aColor.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1451
    self isTextView ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1452
	self backgroundColor:aColor
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1453
    ].
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1454
! !
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1455
118
claus
parents: 116
diff changeset
  1456
!ListView methodsFor:'accessing-mvc'!
claus
parents: 116
diff changeset
  1457
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1458
addModelInterfaceTo:aDictionary
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1459
    "see comment in View>>modelInterface"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1460
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1461
    super addModelInterfaceTo:aDictionary.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1462
    aDictionary at:#listMessage put:listMsg
118
claus
parents: 116
diff changeset
  1463
!
claus
parents: 116
diff changeset
  1464
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1465
listMessage
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1466
    "return the listMsg selector;
125
claus
parents: 121
diff changeset
  1467
     if non-nil, this is the message sent to the model (if any) to aquire
claus
parents: 121
diff changeset
  1468
     a new text upon change of the aspect.
120
claus
parents: 118
diff changeset
  1469
     This defaults to the aspect-selector."
118
claus
parents: 116
diff changeset
  1470
125
claus
parents: 121
diff changeset
  1471
    ^ listMsg
claus
parents: 121
diff changeset
  1472
!
claus
parents: 121
diff changeset
  1473
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1474
listMessage:aSymbol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1475
    "ST-80 compatibility: set the listMsg selector;
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1476
     if non-nil, this will be sent to the model (if any) to aquire a
125
claus
parents: 121
diff changeset
  1477
     new text upon change of the aspect.
claus
parents: 121
diff changeset
  1478
     This defaults to the aspect-selector."
claus
parents: 121
diff changeset
  1479
claus
parents: 121
diff changeset
  1480
    listMsg := aSymbol.
120
claus
parents: 118
diff changeset
  1481
!
claus
parents: 118
diff changeset
  1482
907
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1483
model:aModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1484
    "define the receivers model, from which the text is
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1485
     to be aquired via list- or aspect-messages, whenever its aspect
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1486
     changes."
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1487
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1488
    super model:aModel.
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1489
    self getListFromModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1490
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1491
    "Created: 31.12.1996 / 14:56:43 / stefan"
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1492
!
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1493
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1494
on:aModel aspect:aspectSymbol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1495
    "ST-80 compatibility"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1496
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1497
    ^ self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:nil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1498
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1499
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1500
on:aModel aspect:aspectSymbol change:changeSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1501
    "ST-80 compatibility"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1502
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1503
    ^self on:aModel aspect:aspectSymbol change:changeSymbol list:aspectSymbol menu:nil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1504
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1505
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1506
on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol menu:menuSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1507
    "ST-80 compatibility"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1508
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1509
    aspectSymbol notNil ifTrue:[aspectMsg := aspectSymbol.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1510
			     listMsg isNil ifTrue:[listMsg := aspectSymbol]].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1511
    listSymbol notNil ifTrue:[listMsg := listSymbol].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1512
    changeSymbol notNil ifTrue:[changeMsg := changeSymbol].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1513
    menuMsg := menuSymbol.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1514
    self model:aModel.
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1515
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1516
    "Modified: 2.1.1997 / 16:11:16 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1517
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1518
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1519
on:aModel aspect:aspectSymbol change:changeSymbol menu:menuSymbol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1520
    "ST-80 compatibility"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1521
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1522
    ^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1523
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1524
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1525
on:aModel aspect:aspectSymbol list:listSymbol menu:menuSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1526
    "ST-80 compatibility"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1527
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1528
    ^ self on:aModel aspect:aspectSymbol change:nil list:listSymbol menu:menuSymbol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1529
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1530
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1531
on:aModel aspect:aspectSymbol menu:menuSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1532
    "ST-80 compatibility"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1533
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1534
    ^self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:menuSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1535
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1536
2227
58426f7611f2 category changes
Claus Gittinger <cg@exept.de>
parents: 2225
diff changeset
  1537
!ListView methodsFor:'change & update'!
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1538
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1539
update:something with:aParameter from:changedObject
2322
7d8f3c26a047 react to list-change messages
martin
parents: 2316
diff changeset
  1540
    |idx|
7d8f3c26a047 react to list-change messages
martin
parents: 2316
diff changeset
  1541
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1542
    changedObject == model ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1543
	model isList ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1544
	    list ~~ model ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1545
		something == #at: ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1546
		    idx := aParameter isCollection ifTrue:[aParameter at:1]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1547
						  ifFalse:[aParameter].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1548
		    ^ self at:aParameter put:(model at:idx).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1549
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1550
		something == #insert: ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1551
		    (list size + 1) >= aParameter ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1552
			^ self add:(model at:aParameter) beforeIndex:aParameter
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1553
		    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1554
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1555
		something == #remove: ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1556
		    list size >= aParameter ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1557
			^ self removeIndex:aParameter
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1558
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1559
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1560
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1561
	    self getListFromModel.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1562
	    ^ self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1563
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1564
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1565
	(aspectMsg notNil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1566
	and:[something == aspectMsg]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1567
	    self getListFromModel.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1568
	    ^ self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1569
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1570
	something isNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1571
	    "/ model changed (not more information)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1572
	    self getListFromModel.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1573
	    ^ self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1574
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1575
	something == #size ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1576
	    self getListFromModelScroll:false.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1577
	    ^ self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1578
	].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1579
    ].
3425
883607c8a0df care for listChannel changes
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  1580
    changedObject == listChannel ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1581
	self getListFromModel.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1582
	^ self
3425
883607c8a0df care for listChannel changes
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  1583
    ].
883607c8a0df care for listChannel changes
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  1584
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1585
    ^ super update:something with:aParameter from:changedObject
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1586
3425
883607c8a0df care for listChannel changes
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  1587
    "Modified: / 08-11-2006 / 19:40:29 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1588
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1589
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1590
!ListView methodsFor:'drawing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1591
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1592
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1593
    "draw a visible line range in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1594
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1595
    |y         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1596
     x         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1597
     startLine "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1598
     endLine   "{ Class: SmallInteger }"
2089
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1599
     listSize e sH l|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1600
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1601
    y := self yOfVisibleLine:startVisLineNr.
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1602
    sH := lineSpacing // 2.
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1603
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1604
    backgroundAlreadyClearedColor == bg ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1605
	self paint:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1606
	self fillRectangleX:margin
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1607
			  y:y-sH
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1608
		      width:(width - (margin * 2))
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1609
		     height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1610
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1611
    list isNil ifTrue:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1612
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1613
    y := y + fontAscent.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1614
    listSize := self size.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1615
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1616
    startLine := startVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1617
    endLine := endVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1618
    (startLine == 0) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1619
	y := y + fontHeight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1620
	startLine := startLine + 1
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1621
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1622
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1623
    (endLine > listSize) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1624
	e := listSize
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1625
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1626
	e := endLine
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1627
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1628
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1629
    (startLine <= e) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1630
	x := textStartLeft - viewOrigin x.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1631
	self paint:fg on:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1632
	"/ dont use list from:to:do:, to allow for subclasses to redefine the enumeration (TableView)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1633
	self from:startLine to:e do:[:line |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1634
	    line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1635
		"/ remove lines color emphasis, to enforce color.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1636
		"/ otherwise blue text is not visible if selection-bg is blue
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1637
		l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1638
		self displayOpaqueString:l x:x y:y
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1639
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1640
	    y := y + fontHeight
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1641
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1642
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1643
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1644
    "Modified: / 15.12.1999 / 23:19:39 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1645
!
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1646
131
claus
parents: 128
diff changeset
  1647
drawLine:line atX:x inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1648
    "draw a given string at visible lines position with
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1649
     given x position in fg/bg. Clears the whole line before drawing the string.
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1650
     Low level entry; not meant for public use."
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1651
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1652
    |y l|
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1653
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1654
    y := self yOfVisibleLine:visLineNr.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1655
    backgroundAlreadyClearedColor == bg ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1656
	self paint:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1657
	self fillRectangleX:margin y:y - (lineSpacing//2)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1658
		      width:(width - (2 * margin))
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1659
		     height:fontHeight.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1660
    ].
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1661
    line notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1662
	self paint:fg on:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1663
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1664
	"/ remove lines color emphasis, to enforce color.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1665
	"/ otherwise blue text is not visible if selection-bg is blue.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1666
	"/ this is only done in EditTextViews and subClasses.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1667
	self suppressEmphasisInSelection ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1668
	    l := line
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1669
	] ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1670
	    l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1671
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1672
	self displayOpaqueString:l x:x y:(y + fontAscent)
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1673
    ]
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1674
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1675
    "Modified: / 15.12.1999 / 23:19:46 / cg"
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1676
!
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1677
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1678
drawLine:line fromX:x inVisible:visLineNr with:fg and:bg
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1679
    "draw a given string at visible lines position with
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1680
     given x position in fg/bg. Clears partial line before drawing the string.
131
claus
parents: 128
diff changeset
  1681
     Low level entry; not meant for public use."
claus
parents: 128
diff changeset
  1682
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1683
    |y l|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1684
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1685
    y := self yOfVisibleLine:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1686
    line notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1687
	self paint:fg on:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1688
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1689
	"/ remove lines color emphasis, to enforce color.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1690
	"/ otherwise blue text is not visible if selection-bg is blue
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1691
	l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1692
	self displayOpaqueString:l x:x y:(y + fontAscent)
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1693
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1694
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1695
    "Modified: / 15.12.1999 / 23:19:55 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1696
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1697
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1698
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1699
    "draw single character at col index of visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1700
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1701
    |y yf x len lineString characterString w|
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1702
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1703
    lineString := lineStringArg.
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1704
    len := lineString size.
1927
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1705
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  1706
    x := (self xOfCol:col inVisibleLine:visLineNr) - viewOrigin x.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1707
    y := self yOfVisibleLine:visLineNr.
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1708
    yf := y - (lineSpacing // 2).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1709
2576
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1710
    self paint:bg.
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1711
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1712
    (lineString notNil and:[lineString isString not]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1713
	w := lineString widthFrom:col to:(col min:len) on:self.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1714
	w <= 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1715
	    w := font width.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1716
	    self fillRectangleX:x y:yf width:w height:fontHeight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1717
	    self paint:fg
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1718
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1719
	self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1720
	    self drawVisibleLine:visLineNr with:fg and:bg
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1721
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1722
	^ self
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1723
    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1724
2654
a183d27e53a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2649
diff changeset
  1725
    (lineString isNil or:[col > len]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1726
	self fillRectangleX:x y:yf width:(font width) height:fontHeight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1727
	self paint:fg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1728
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1729
	characterString := lineString copyFrom:col to:col.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1730
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1731
	"/ remove lines color emphasis, to enforce color.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1732
	"/ otherwise blue text is not visible if selection-bg is blue
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1733
	characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1734
	w := characterString widthOn:self.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1735
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1736
	self fillRectangleX:x y:yf width:w height:fontHeight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1737
	self paint:fg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1738
	self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1739
	    self displayString:characterString x:x y:(y + fontAscent)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1740
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1741
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1742
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1743
    "Modified: / 15.12.1999 / 23:21:12 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1744
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1745
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1746
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1747
    "draw part of a visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1748
2576
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1749
    |y yf x lineString len characterString w w2 endCol sCol eCol|
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1750
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1751
    "/ hack - please rewrite
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1752
    endCol := endColOrNil ? lineStringArg size.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1753
    (endCol >= startCol) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1754
	sCol := startCol max:1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1755
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1756
	lineString := lineStringArg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1757
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1758
	x := (self xOfCol:sCol inVisibleLine:visLineNr) - viewOrigin x.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1759
	y := (self yOfVisibleLine:visLineNr).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1760
	yf := y - (lineSpacing // 2).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1761
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1762
	len := lineString size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1763
	(lineString notNil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1764
	and:[lineString isString not or:[ lineString hasChangeOfEmphasis ]])
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1765
	ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1766
	    w := lineString widthFrom:sCol to:(endCol min:len) on:self.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1767
	    endCol > len ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1768
		sCol > len ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1769
		    w2 := (endCol - sCol + 1) * fontWidth.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1770
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1771
		    w2 := (endCol - len + 1) * fontWidth.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1772
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1773
		self paint:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1774
		self fillRectangleX:x+w y:yf width:w2 height:fontHeight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1775
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1776
	    w > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1777
		self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1778
		    self drawVisibleLine:visLineNr with:fg and:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1779
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1780
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1781
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1782
	    (sCol > len) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1783
		backgroundAlreadyClearedColor == bg ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1784
		    len := endCol - sCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1785
		    self paint:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1786
		    self fillRectangleX:x y:yf
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1787
				   width:(fontWidth * len)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1788
				  height:fontHeight
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1789
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1790
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1791
		eCol := endCol.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1792
		(endCol > len) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1793
		    backgroundAlreadyClearedColor == bg ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1794
			characterString := lineString string species new:endCol.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1795
			characterString replaceFrom:1 to:len with:lineString startingAt:1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1796
			lineString := characterString.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1797
		    ] ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1798
			eCol := len.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1799
		    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1800
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1801
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1802
		"/ remove any color emphasis, to enforce drawing in fg/bg
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1803
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1804
		lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1805
		backgroundAlreadyClearedColor == bg ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1806
		    (lineString isMemberOf:String) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1807
			fontIsFixedWidth ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1808
			    w := (eCol - sCol + 1) * fontWidth
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1809
			] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1810
			    w := font widthOf:lineString from:sCol to:eCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1811
			]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1812
		    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1813
			w := lineString widthFrom:sCol to:endCol on:self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1814
		    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1815
		    self paint:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1816
		    self fillRectangleX:x y:yf
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1817
				  width:w
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1818
				  height:fontHeight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1819
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1820
		self paint:fg on:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1821
		w notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1822
		    "/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1823
		    self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1824
			self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1825
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1826
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1827
		    self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1828
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1829
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1830
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1831
    ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1832
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1833
    "Modified: / 15.12.1999 / 23:21:43 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1834
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1835
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1836
drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1837
    "draw right part of a visible line from startCol to end of line in fg/bg"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1838
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1839
    |y x index1 index2 lineWithoutColor|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1840
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1841
    (startCol < 1) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1842
	index1 := 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1843
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1844
	index1 := startCol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1845
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1846
    y := self yOfVisibleLine:visLineNr.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  1847
    x := (self xOfCol:index1 inVisibleLine:visLineNr) - viewOrigin x.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1848
    backgroundAlreadyClearedColor == bg ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1849
	self paint:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1850
	self fillRectangleX:x y:y - (lineSpacing // 2)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1851
		      width:(width + viewOrigin x - x)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1852
		     height:fontHeight.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1853
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1854
    lineString notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1855
	lineString isString ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1856
	    self drawLine:lineString inVisible:visLineNr from:startCol to:nil with:fg and:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1857
	] ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1858
	    lineWithoutColor := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1859
	    index2 := lineWithoutColor size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1860
	    (index2 < index1) ifTrue:[^ self].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1861
	    (index1 <= index2) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1862
		self paint:fg on:bg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1863
		self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1864
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1865
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1866
    ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1867
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1868
    "Modified: / 15.12.1999 / 23:24:40 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1869
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1870
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1871
drawLine:line inVisible:visLineNr with:fg and:bg
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1872
    "draw a given string at visible lines position in fg/bg"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1873
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1874
    self drawLine:line atX:(textStartLeft - viewOrigin x) inVisible:visLineNr with:fg and:bg
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1875
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1876
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1877
drawVisibleLine:visLineNr col:col with:fg and:bg
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1878
    "draw single character at col index of visible line in fg/bg"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1879
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1880
    self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1881
	drawLine:(self visibleAt:visLineNr)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1882
	inVisible:visLineNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1883
	col:col
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1884
	with:fg and:bg
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1885
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1886
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1887
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1888
    "draw part of a visible line in fg/bg"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1889
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1890
    self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1891
	drawLine:(self visibleAt:visLineNr)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1892
	inVisible:visLineNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1893
	from:startCol to:endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1894
	with:fg and:bg
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1895
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1896
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1897
drawVisibleLine:visLineNr from:startCol with:fg and:bg
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1898
    "draw right part of a visible line from startCol to end of line in fg/bg"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1899
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1900
    self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1901
	drawLine:(self visibleAt:visLineNr)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1902
	inVisible:visLineNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1903
	from:startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1904
	with:fg and:bg
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1905
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1906
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1907
drawVisibleLine:visLineNr with:fg and:bg
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1908
    "draw a visible line in fg/bg"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1909
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1910
    self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1911
	drawLine:(self visibleAt:visLineNr)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1912
	atX:(textStartLeft - viewOrigin x)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1913
	inVisible:visLineNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1914
	with:fg
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1915
	and:bg
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1916
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1917
    "Modified: 28.2.1996 / 19:30:23 / cg"
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1918
!
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1919
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1920
fillRectangleX:x y:y width:w height:h
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1921
    "fill rectangle; checks whether the rectangle already is filled with
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1922
     the current paint (#redrawX:y:w:h).
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1923
    "
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1924
    backgroundAlreadyClearedColor ~~ paint ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1925
	super fillRectangleX:x y:y width:w height:h
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1926
    ]
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1927
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1928
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1929
!
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1930
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1931
invalidateLine:line
1466
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1932
    "invalidate the area of a single line.
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1933
     This arranges for that line to be redrawn asynchronously (later).
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1934
     If multiple such invalidations arrive, those areas may be lumped
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1935
     together for a block update.
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1936
     The update takes place when the windowGroup process gets a chance to
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1937
     process expose events."
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1938
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1939
    |yTop visLineNr|
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1940
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1941
    visLineNr := self listLineToVisibleLine:line.
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1942
    visLineNr notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1943
	yTop := self yOfVisibleLine:visLineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1944
	yTop isNil ifTrue:[^ self]. "/ not visible
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1945
	(yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1946
	self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1947
	    invalidateDeviceRectangle:(Rectangle
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1948
			    left:margin top:yTop
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1949
			    width:(width - (2 * margin)) height:fontHeight)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1950
	    repairNow:false.
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1951
    ]
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1952
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1953
    "Created: / 5.3.1998 / 01:24:19 / cg"
1466
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1954
    "Modified: / 5.3.1998 / 13:41:31 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1955
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1956
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  1957
!ListView methodsFor:'event handling'!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1958
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1959
contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1960
    "contents changed - move origin up if possible"
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1961
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1962
    |listSize newOrigin|
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1963
890
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1964
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1965
	list notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1966
	    listSize := self numberOfLines.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1967
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1968
	    listSize == 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1969
		widthOfWidestLine := 0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1970
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1971
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1972
	    "
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1973
	     if we are beyond the end, scroll up a bit
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1974
	    "
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1975
	    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1976
		newOrigin := listSize - nFullLinesShown + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1977
		newOrigin < 1 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1978
		    newOrigin := 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1979
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1980
		self scrollToLine: newOrigin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1981
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1982
	].
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1983
    ].
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1984
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1985
    ^ super contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1986
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1987
    "Modified: 18.11.1996 / 19:50:07 / stefan"
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1988
    "Modified: 5.3.1997 / 15:50:46 / cg"
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1989
!
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1990
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1991
keyPress:key x:x y:y
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1992
    "a key was pressed - handle page-keys here"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1993
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1994
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1995
			  #BeginOfText #EndOfText
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1996
			  #ScrollUp #ScrollDown )>
2731
0f3c02f592d0 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2707
diff changeset
  1997
    |n|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1998
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1999
    (key == #PreviousPage) ifTrue: [^ self pageUp].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2000
    (key == #NextPage)     ifTrue: [^ self pageDown].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2001
    (key == #HalfPageUp)   ifTrue: [^ self halfPageUp].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2002
    (key == #HalfPageDown) ifTrue: [^ self halfPageDown].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2003
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2004
    (key == #BeginOfText) ifTrue:[^ self scrollToTop].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2005
    (key == #EndOfText) ifTrue:[^ self scrollToBottom].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2006
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2007
    (key == #ScrollUp) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2008
	n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollUp).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2009
	^ self scrollUp:n
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2010
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2011
    (key == #ScrollDown) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2012
	n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollDown).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2013
	^ self scrollDown:n
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2014
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2015
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2016
    super keyPress:key x:x y:y
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2017
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2018
2273
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2019
mapped
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2020
    self stopAutoScroll.
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2021
    super mapped
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2022
!
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2023
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2024
mouseWheelZoom:amount
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2025
    "ALT-wheel action"
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2026
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2027
    |oldSize newSize delta mul|
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2028
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2029
    amount > 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2030
	"/ delta := 1.  mul := 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2031
	delta := 0.  mul := 1.2.
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2032
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2033
	"/ delta := -1. mul := 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2034
	delta := 0. mul := 0.8.
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2035
    ].
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2036
3842
88de8b4c49ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3836
diff changeset
  2037
    font sizeUnit == #px ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2038
	oldSize := font size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2039
	newSize := ((oldSize + delta)* mul) max:2.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2040
	newSize ~= oldSize ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2041
	    self font:(font asSize:newSize).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2042
	]
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2043
    ].
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2044
!
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2045
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2046
redrawX:x y:y width:w height:h
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2047
    "a region must be redrawn"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2048
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2049
    |startCol endCol line saveClip
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2050
     startLine "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2051
     stopLine  "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2052
    |
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2053
127
claus
parents: 125
diff changeset
  2054
    shown ifFalse:[^ self].
claus
parents: 125
diff changeset
  2055
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2056
    startLine := self visibleLineOfY:y.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2057
    stopLine := self visibleLineOfY:(y + h).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2058
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2059
    saveClip := clipRect.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2060
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2061
    self paint:bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2062
    self fillRectangleX:x y:y width:w height:h.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2063
    backgroundAlreadyClearedColor := bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2064
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2065
    (includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2066
	"includes non strings or area is big enough redraw whole lines"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2067
	self redrawFromVisibleLine:startLine to:stopLine
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2068
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2069
	line := self visibleAt:startLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2070
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2071
	(fontIsFixedWidth and:[line isMemberOf:String]) ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2072
	    "start/end col has to be computed for each line"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2073
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2074
	    startLine to:stopLine do:[:i |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2075
		startCol := self colOfX:x inVisibleLine:i.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2076
		endCol := self colOfX:(x + w) inVisibleLine:i.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2077
		startCol > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2078
		    endCol > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2079
			self redrawVisibleLine:i from:startCol to:endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2080
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2081
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2082
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2083
	] ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2084
	    "start/end col is the same for all lines"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2085
	    startCol := self colOfX:x inVisibleLine:startLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2086
	    endCol := self colOfX:(x + w) inVisibleLine:startLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2087
	    startCol > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2088
		endCol > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2089
		    startLine to:stopLine do:[:i |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2090
			line := self visibleAt:i.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2091
			(line isMemberOf:String) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2092
			    self redrawVisibleLine:i from:startCol to:endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2093
			] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2094
			    self redrawVisibleLine:i
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2095
			]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2096
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2097
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2098
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2099
	]
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2100
    ].
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2101
    backgroundAlreadyClearedColor := nil.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2102
    self clippingRectangle:saveClip.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2103
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2104
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2105
sizeChanged:how
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2106
    "size changed - move origin up if possible"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2107
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2108
    super sizeChanged:how.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
  2109
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2110
    self computeNumberOfLinesShown.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2111
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2112
    innerWidth := width - textStartLeft - margin.
1972
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2113
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
  2114
"/ Makes trouble when fighting with SelListViews sizeChanged-positioning ...
1972
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2115
"/
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2116
"/    shown ifFalse:[^ self].
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2117
"/    list isNil ifTrue:[^ self].
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2118
"/
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2119
"/    listSize := self numberOfLines.
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2120
"/    "
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2121
"/     if we are beyond the end, scroll up a bit
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2122
"/    "
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2123
"/    ((firstLineShown + nFullLinesShown) >= listSize) ifTrue:[
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2124
"/        self scrollToBottom.
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2125
"/        ^ self
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  2126
"/    ].
643
89c06c80ff2a redraw in sizeChange
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
  2127
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  2128
    "Modified: / 18.11.1996 / 19:37:02 / stefan"
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  2129
    "Modified: / 27.1.1998 / 14:10:04 / cg"
2273
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2130
!
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2131
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2132
unmap
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2133
    self stopAutoScroll.
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2134
    super unmap
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2135
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2136
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2137
!ListView methodsFor:'initialization'!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2138
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2139
create
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2140
    super create.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2141
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2142
    "I cache font parameters here - they are used so often ..."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2143
    self getFontParameters.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2144
    self computeNumberOfLinesShown.
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2145
    fgColor := fgColor onDevice:device.
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2146
    bgColor := bgColor onDevice:device
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2147
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2148
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2149
defaultControllerClass
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2150
    self class == ListView ifTrue:[^ ListViewController].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2151
    ^ super defaultControllerClass
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2152
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2153
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2154
fetchDeviceResources
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2155
    "fetch device colors, to avoid reallocation at redraw time"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2156
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2157
    super fetchDeviceResources.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2158
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2159
    fgColor notNil ifTrue:[fgColor := fgColor onDevice:device].
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2160
    bgColor notNil ifTrue:[bgColor := bgColor onDevice:device].
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2161
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2162
    "Created: 14.1.1997 / 00:12:12 / cg"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2163
!
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2164
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2165
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  2166
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  2167
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2168
    |n|
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2169
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2170
    super initStyle.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2171
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  2172
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device]
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  2173
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2174
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2175
    n isInteger ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2176
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2177
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2178
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2179
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2180
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2181
    n isInteger ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2182
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2183
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2184
    self leftMargin:n.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2185
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2186
    lineSpacing := 0.
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2187
    fgColor := DefaultForegroundColor.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2188
    bgColor := DefaultBackgroundColor.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2189
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2190
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2191
initialize
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2192
    super initialize.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2193
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2194
    viewOrigin := 0@0.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2195
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2196
    textStartTop := topMargin + margin.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2197
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2198
    bitGravity := #NorthWest.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2199
    list := nil.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2200
    firstLineShown := 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2201
    nFullLinesShown := 1. "just any value ..."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2202
    nLinesShown := 1.     "just any value"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2203
    partialLines := true.
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  2204
    tabPositions := UserDefaultTabPositions ? DefaultTabPositions.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  2205
    includesNonStrings := false.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2206
    self getFontParameters.
3312
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2207
    self initializeWordCheckAction.
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2208
    scrollWhenUpdating := #keep. "/ #beginOfText.
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2209
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2210
    autoScroll := true.
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2211
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2212
    "Modified: / 03-07-2006 / 17:03:59 / cg"
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2213
!
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2214
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2215
initializeWordCheckAction
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2216
    wordCheck := [:char | self standardWordCheck:char].
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2217
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2218
    "Created: / 03-07-2006 / 17:03:50 / cg"
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2219
!
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2220
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2221
realize
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2222
    |sz|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2223
2305
f2850e54b0ab only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  2224
    self extentChangedFlag ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2225
	self computeNumberOfLinesShown.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2226
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2227
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2228
    firstLineShown ~~ 1 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2229
	sz := self size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2230
	firstLineShown + nLinesShown > sz ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2231
	    self scrollToLine:sz - nLinesShown.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2232
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2233
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2234
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2235
    super realize.
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  2236
1081
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2237
"/ old: fetch models value on realize;
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2238
"/ new: fetch value when model is assigned.
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2239
"/
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2240
"/    model notNil ifTrue:[
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2241
"/        self getListFromModel.
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2242
"/    ]
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2243
825
d115a0923b7d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 820
diff changeset
  2244
    "Modified: 15.8.1996 / 13:08:56 / stefan"
1081
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2245
    "Modified: 28.2.1997 / 19:44:19 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2246
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2247
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2248
recreate
2258
806d3b8a6e97 comment
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2249
    "recreate after a snapin or a migration"
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2250
    |n|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2251
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2252
    super recreate.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2253
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2254
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2255
     recompute margins and font parameters
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2256
     - display may have different resolution/font sizes.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2257
    "
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2258
"/    topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2259
"/    self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2260
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2261
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2262
    n isInteger ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2263
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2264
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2265
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2266
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2267
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2268
    n isInteger ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2269
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2270
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2271
    self leftMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2272
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2273
    self getFontParameters
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2274
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2275
    "Modified: / 26.9.1998 / 17:09:32 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2276
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2277
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2278
!ListView methodsFor:'private'!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2279
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2280
absoluteLineToVisibleLine:absLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2281
    "given an absolute line (1..) return visible linenr or nil"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2282
2976
8da6c9b6bc3e Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2967
diff changeset
  2283
    <resource:#obsolete>
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2284
    self obsoleteMethodWarning:'use #listLineToVisibleLine:'.
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2285
    ^ self listLineToVisibleLine:absLineNr
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2286
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2287
"/    absLineNr isNil ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2288
"/    (absLineNr < firstLineShown) ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2289
"/    (absLineNr >= (firstLineShown + nLinesShown)) ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2290
"/    ^ absLineNr - firstLineShown + 1
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2291
"/
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2292
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2293
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2294
checkForExistingLine:lineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2295
    "check if a line for lineNr exists; if not, expand text"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2296
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2297
    list isNil ifTrue: [
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2298
	list := StringCollection new:lineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2299
	self contentsChanged
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2300
    ] ifFalse: [
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2301
	lineNr > (list size) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2302
	    self grow:lineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2303
	    self contentsChanged
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2304
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2305
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2306
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2307
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2308
colOfX:x inVisibleLine:visLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2309
    "given a visible lineNr and x-coordinate, return colNr"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2310
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2311
    |lineString linePixelWidth xRel runCol posLeft posRight done
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  2312
     hasEmphasis oPosRight oPosLeft|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2313
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2314
    xRel := x - textStartLeft + viewOrigin x.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2315
    (xRel <= 0) ifTrue:[^ 1].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2316
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2317
    lineString := self visibleAt:visLineNr.
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2318
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2319
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2320
     for fix fonts, this is easy ...
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2321
    "
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2322
    (fontIsFixedWidth
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2323
    and:[lineString isNil
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2324
	  or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2325
	^ (xRel // fontWidth) + 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2326
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2327
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2328
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2329
     for variable fonts, more work is required ...
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2330
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2331
    lineString notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2332
	lineString := self visibleStringFrom:lineString.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2333
	(hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2334
	    linePixelWidth := lineString widthOn:self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2335
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2336
	    lineString := lineString string.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2337
	    linePixelWidth := font widthOf:lineString.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2338
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2339
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2340
	linePixelWidth := 0
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2341
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2342
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2343
    (linePixelWidth <= xRel) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2344
	fontWidth == 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2345
	    "
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2346
	     although this 'cannot happen',
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2347
	     it seems that X reports this width for some strange fonts ...
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2348
	    "
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2349
	    ^ lineString size
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2350
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2351
	^ lineString size + ((xRel - linePixelWidth) // fontWidth) + 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2352
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2353
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2354
    "/ cannot simply count individual characters,
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2355
    "/ since kerning or other non-linear effects may be involved ...
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2356
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2357
    runCol := lineString size // 2.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2358
    (runCol == 0) ifTrue:[runCol := 1].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2359
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2360
    hasEmphasis ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2361
	posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2362
	posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2363
    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2364
	posLeft := font widthOf:lineString from:1 to:(runCol - 1).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2365
	posRight := font widthOf:lineString from:1 to:runCol.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2366
    ].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2367
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2368
    done := (posLeft <= xRel) and:[posRight > xRel].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2369
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2370
    [done] whileFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2371
	oPosRight := posRight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2372
	oPosLeft := posLeft.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2373
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2374
	(posRight <= xRel) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2375
	    runCol := runCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2376
	    posLeft := posRight.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2377
	    hasEmphasis ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2378
		posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2379
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2380
		posRight := font widthOf:lineString from:1 to:runCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2381
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2382
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2383
	    (posLeft > xRel) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2384
		runCol := runCol - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2385
		(runCol == 0) ifTrue:[^ 0].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2386
		posRight := posLeft.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2387
		hasEmphasis ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2388
		    posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2389
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2390
		    posLeft := font widthOf:lineString from:1 to:(runCol - 1)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2391
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2392
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2393
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2394
	done := (posLeft <= xRel) and:[posRight > xRel].
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2395
"234567890123456789012345678901234567890"
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2396
	((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2397
	    "/ paranoia: just in case there are unprintable characters
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2398
	    "/ (avoid endless loop if the binary search does not make progress)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2399
	    done := true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2400
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2401
    ].
1777
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2402
"/self paint:Color red.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2403
"/self displayRectangleX:posLeft+textStartLeft-viewOrigin x y:(self yOfVisibleLine:visLineNr)
1777
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2404
"/                       width:(posRight-posLeft) height:fontHeight.
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2405
"/self paint:Color black.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2406
    ^ runCol
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2407
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2408
    "Modified: / 8.9.1998 / 21:18:42 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2409
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2410
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2411
computeNumberOfLinesShown
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2412
    "recompute the number of visible lines"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2413
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2414
    |innerHeight|
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2415
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2416
    innerHeight := self innerHeight.
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2417
    nFullLinesShown := (innerHeight + lineSpacing) // fontHeight.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2418
    nLinesShown := nFullLinesShown.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2419
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2420
    partialLines ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2421
	((nLinesShown * fontHeight) < innerHeight) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2422
	    nLinesShown := nLinesShown + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2423
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2424
    ]
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2425
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2426
    "Modified: 29.5.1996 / 14:48:43 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2427
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2428
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2429
convertRTF:aList
3844
f7fba2703e0c Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3842
diff changeset
  2430
    <resource: #obsolete>
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2431
    "this is a q&d RTF to poor-text converter which removes any rich stuff.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2432
     - a first shot 'til  DocumentView is finished ..."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2433
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2434
    |newList newLine charIndex inEscape char special|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2435
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2436
    self obsoleteMethodWarning.
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2437
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2438
    newList := StringCollection new:200.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2439
    newList grow:0.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2440
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2441
    newLine := ''.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2442
    aList do:[:line |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2443
	((line size == 0) or:[line isBlank]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2444
	    newList add:newLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2445
	    newLine := ''
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2446
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2447
	    special := ((line at:1) == ${) or:[(line includes:$\)].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2448
	    special := special or:[(line at:1) == $}].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2449
	    special ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2450
		newList add:(newLine , line)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2451
	    ] ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2452
		charIndex := 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2453
		[charIndex <= line size] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2454
		    char := line at:charIndex.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2455
		    ((char == ${ ) or:[char == $} ]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2456
			"left-brace: ignore rest of line"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2457
			charIndex := line size + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2458
		    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2459
			(char == $\) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2460
			    inEscape := true
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2461
			] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2462
			    inEscape ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2463
				(char == Character space) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2464
				    inEscape := false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2465
				]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2466
			    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2467
				newLine := newLine copyWith:char
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2468
			    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2469
			].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2470
			charIndex := charIndex + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2471
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2472
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2473
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2474
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2475
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2476
    ^ newList
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2477
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2478
    "Modified: 18.5.1996 / 14:03:16 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2479
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2480
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2481
getFontParameters
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2482
    "get some info of the used font. They are cached since we use them often ..
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2483
     The code below uses the fonts average height parameters - these
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2484
     are not OK for some oversized national characters (such as A-dieresis).
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2485
     Therefore, this method should be redefined in views which will be used
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2486
     with national characters (i.e. editTextViews)."
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2487
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2488
    |hMax|
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2489
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2490
    font := font onDevice:device.
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2491
    hMax := font height.
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2492
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2493
    includesNonStrings == true ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2494
	"/
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2495
	"/ find maximum height of lines
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2496
	"/
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2497
	hMax := list inject:hMax into:[:maxSoFar :thisLine |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2498
					thisLine isNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2499
					    maxSoFar
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2500
					] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2501
					    (thisLine isMemberOf:String) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2502
						maxSoFar
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2503
					    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2504
						maxSoFar max:(thisLine heightOn:self)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2505
					    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2506
					]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2507
			      ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2508
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2509
    ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2510
    fontHeight := hMax + lineSpacing.
2565
Michael Beyl <mb@exept.de>
parents: 2564
diff changeset
  2511
    fontAscent := font ascent. "/ maxAscent. -- see SelectionInListViews selection in motif style
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2512
    fontWidth := font width.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2513
    fontIsFixedWidth := font isFixedWidth.
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2514
1260
5a548d4c6724 handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
  2515
    "Modified: 3.7.1997 / 12:24:25 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2516
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2517
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2518
getListFromModel
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2519
    "ask my model (if any) for the text via the listMsg.
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2520
     If there is no listMessage, try aspect for backward compatibility."
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2521
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2522
    |text msg|
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2523
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2524
    model notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2525
	msg := listMsg ? aspectMsg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2526
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2527
	msg notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2528
	    text := model perform:msg.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2529
	    text notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2530
		text := text asStringCollection.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2531
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2532
  "/ SV: this compare does not work, if model uses (i.e. updates)
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2533
  "/ the same stringCollection as the view!!
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2534
"/            text ~= list ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2535
		scrollLocked == true ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2536
		    self setList:text
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2537
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2538
		    self list:text
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2539
		]
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2540
"/            ].
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2541
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2542
    ].
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2543
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2544
    "Modified: 26.4.1996 / 14:09:42 / cg"
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2545
    "Modified: 19.2.1997 / 12:08:50 / stefan"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2546
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2547
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2548
getListFromModelScroll:aBoolean
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2549
    "ask my model (if any) for the text via the listMsg.
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2550
     If there is no listMessage, try aspect for backward compatibility.
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2551
     Scrolling is suppressed here"
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2552
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2553
    |prev|
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2554
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2555
    prev := scrollLocked.
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2556
    scrollLocked := true.
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2557
    [
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2558
	self getListFromModel
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  2559
    ] ensure:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2560
	scrollLocked := prev.
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2561
    ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2562
!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2563
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2564
line:line withoutEmphasis:emphasisToRemove
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2565
    (line notNil
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2566
    and:[line isString]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2567
	^ line withoutEmphasis:emphasisToRemove.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2568
    ].
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2569
    ^ line
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2570
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2571
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2572
listAt:lineNr from:startCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2573
    "return right substring from startCol to end of a line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2574
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2575
    |line|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2576
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2577
    line := self listAt:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2578
    line isNil ifTrue:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2579
    (startCol > line size) ifTrue:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2580
    ^ line copyFrom:startCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2581
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2582
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2583
listAt:lineNr from:startCol to:endCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2584
    "return substring from startCol to endCol of a line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2585
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2586
    |line stop lineLen|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2587
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2588
    line := self listAt:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2589
    line isNil ifTrue:[^ nil].
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2590
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2591
    lineLen := line size.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2592
    (startCol > lineLen) ifTrue:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2593
    stop := endCol.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2594
    (stop > lineLen) ifTrue:[stop := lineLen].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2595
    ^ line copyFrom:startCol to:stop
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2596
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2597
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2598
listAt:lineNr to:endCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2599
    "return left substring from start to endCol of a line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2600
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2601
    |line stop|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2602
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2603
    line := self listAt:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2604
    line isNil ifTrue:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2605
    stop := endCol.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2606
    (stop > line size) ifTrue:[stop := line size].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2607
    ^ line copyTo:stop
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2608
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2609
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2610
listLineIsVisible:listLineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2611
    "return true,  if a particular line is visible"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2612
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2613
    |visibleLineNr "{ Class: SmallInteger }"|
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2614
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2615
    shown ifFalse:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2616
    listLineNr isNil ifTrue:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2617
    visibleLineNr := listLineNr + 1 - firstLineShown.
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2618
    ^ (visibleLineNr between:1 and:nLinesShown)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2619
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2620
    "Created: / 26.7.1998 / 13:24:16 / cg"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2621
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2622
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2623
listLineToVisibleLine:listLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2624
    "given a list line (1..) return visible linenr or nil"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2625
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2626
    |visibleLineNr "{ Class: SmallInteger }"|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2627
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2628
    shown ifFalse:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2629
    listLineNr isNil ifTrue:[^ nil].
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2630
    visibleLineNr := listLineNr - firstLineShown + 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2631
    (visibleLineNr between:1 and:nLinesShown) ifFalse:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2632
    ^ visibleLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2633
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2634
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2635
recomputeWidthOfWidestLineFor:aString
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2636
    |w|
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2637
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2638
    widthOfWidestLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2639
	aString isString ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2640
	    w := font widthOf:aString
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2641
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2642
	    w := aString widthOn:self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2643
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2644
	w > widthOfWidestLine ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2645
	    widthOfWidestLine := w.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2646
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2647
	    widthOfWidestLine := nil "/ means: unknown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2648
	].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2649
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2650
    ^ widthOfWidestLine
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2651
!
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2652
2225
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2653
suppressEmphasisInSelection
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2654
    "selection is shown with original emphasis"
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2655
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2656
    ^ false
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2657
!
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2658
2181
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2659
textChanged
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2660
    "ignored here"
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2661
!
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2662
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2663
visibleAt:visibleLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2664
    "return what is visible at line (numbers start at 1).
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2665
     This is used for redrawing; i.e. for non-string entries, this
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2666
     returns the original."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2667
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2668
    |listLineNr listsize|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2669
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2670
    listLineNr := visibleLineNr + firstLineShown - 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2671
    (listLineNr == 0) ifTrue:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2672
    (list notNil) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2673
	listsize := self size
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2674
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2675
	listsize := 0
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2676
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2677
    (listLineNr <= listsize) ifTrue:[^ self at:listLineNr].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2678
    ^ ''
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2679
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2680
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2681
visibleLineOfY:y
3818
cd51d5b4d162 comment
Claus Gittinger <cg@exept.de>
parents: 3777
diff changeset
  2682
    "given a y-coordinate, return the visible lineNr
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2683
     - works for fix-height fonts only"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2684
1448
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2685
    ^ (((y - textStartTop) // fontHeight) + 1) max:1
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2686
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2687
    "Modified: / 13.2.1998 / 20:57:26 / stefan"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2688
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2689
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2690
visibleLineToAbsoluteLine:visibleLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2691
    "given a visible line (1..) return absolut linenr"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2692
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2693
    visibleLineNr isNil ifTrue:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2694
    ^ visibleLineNr + firstLineShown - 1
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2695
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2696
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2697
visibleLineToListLine:visibleLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2698
    "given a visible line (1..) return linenr in list or nil
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2699
     (this one returns nil if the given visibleLineNr is one of the
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2700
     separators)"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2701
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2702
    |listLineNr  "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2703
     listsize    "{ Class: SmallInteger }" |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2704
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2705
    visibleLineNr isNil ifTrue:[^ nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2706
    listLineNr := visibleLineNr + firstLineShown - 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2707
    (listLineNr == 0) ifTrue:[^nil].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2708
    listsize := self size.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2709
    (listLineNr <= listsize) ifTrue:[^ listLineNr].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2710
    ^ nil
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2711
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2712
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2713
visibleStringFrom:aString
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2714
    ^ aString asString
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2715
!
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2716
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2717
widthForScrollBetween:firstLine and:lastLine
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2718
    "return the width in pixels for a scroll between firstLine and lastLine.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2719
     - used to optimize scrolling, by limiting the scrolled area.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2720
     Subclasses with selections or other additional visible stuff should redefine
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2721
     this method."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2722
957
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2723
    ^ innerWidth
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2724
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2725
"/    "for small width, its not worth searching for
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2726
"/     longest line ...
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2727
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2728
"/    (width < 300) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2729
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2730
"/    "for large lists, search may take longer than scrolling full
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2731
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2732
"/    self size > 2000 ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2733
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2734
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2735
"/     if there is a pattern-background, we have to scroll everything
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2736
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2737
"/    (viewBackground isColor not
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2738
"/     or:[viewBackground isDithered]) ifTrue:[
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2739
"/        ^ width
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2740
"/    ].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2741
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2742
"/    w := self widthOfWidestLineBetween:firstLine and:lastLine.
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2743
"/    (w > innerWidth) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2744
"/    ^ w
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2745
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2746
    "Modified: 17.1.1997 / 17:44:12 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2747
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2748
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2749
widthOfLineString:entry
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2750
    "return the width of an entry"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2751
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2752
    entry isNil ifTrue:[^ 0].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2753
    entry isString ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2754
	^ font widthOf:entry
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2755
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2756
    ^ entry widthOn:self
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2757
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2758
    "Modified: 12.5.1996 / 20:09:53 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2759
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2760
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2761
widthOfWidestLineBetween:firstLine and:lastLine
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2762
    "return the width in pixels of the widest line in a range
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2763
     - used to optimize scrolling, by limiting the scrolled area"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2764
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2765
    |max      "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2766
     first    "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2767
     last     "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2768
     thisLen  "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2769
     listSize "{ Class: SmallInteger }" |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2770
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2771
    includesNonStrings ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2772
	^ width
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2773
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2774
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2775
    fontIsFixedWidth ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2776
	^ (self lengthOfLongestLineBetween:firstLine and:lastLine) * fontWidth
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2777
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2778
    listSize := self size.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2779
    max := 0.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2780
    first := firstLine.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2781
    last := lastLine.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2782
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2783
    (first > listSize) ifTrue:[^ max].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2784
    (last > listSize) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2785
	last := listSize
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2786
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2787
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2788
    self from:first to:last do:[:line |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2789
	line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2790
	    thisLen := font widthOf:line.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2791
	    (thisLen > max) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2792
		max := thisLen
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2793
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2794
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2795
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2796
    ^ max
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2797
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2798
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2799
withoutAnyColorEmphasis:line
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2800
    ^ self withoutBackgroundColorEmphasis:(self withoutColorEmphasis:line)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2801
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2802
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2803
withoutBackgroundColorEmphasis:line
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2804
    ^ self line:line withoutEmphasis:#backgroundColor
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2805
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2806
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2807
withoutColorEmphasis:line
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2808
    ^ self line:line withoutEmphasis:#color
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2809
!
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2810
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2811
withoutColorEmphasis:line ifFg:fg andBg:bg
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2812
    "/ remove lines color emphasis, to enforce color.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2813
    "/ otherwise blue text is not visible if selection-bg is blue
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2814
    (line notNil
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2815
    and:[line isString
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2816
    and:[line hasChangeOfEmphasis
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2817
    and:[fg ~= fgColor or:[bg ~= bgColor]]]]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2818
	^ self line:line withoutEmphasis:#color
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2819
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2820
    ^ line
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2821
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2822
    "Modified: / 15.12.1999 / 23:17:30 / cg"
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2823
    "Created: / 15.12.1999 / 23:19:30 / cg"
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2824
!
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2825
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2826
xOfCol:col inVisibleLine:visLineNr
2209
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2827
    "given a visible line- and colNr, return the x-coordinate in view"
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2828
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2829
    |line lineSize tcol lText|
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2830
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2831
    col == 1 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2832
	lText := 0
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2833
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2834
	tcol := col - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2835
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2836
	line := self visibleAt:visLineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2837
	(fontIsFixedWidth
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2838
	and:[line isNil or:[line isMemberOf:String]])
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2839
	ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2840
	    lText := (tcol * fontWidth)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2841
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2842
	    line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2843
		lineSize := line size
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2844
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2845
		lineSize := 0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2846
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2847
	    (lineSize == 0) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2848
		lText := (tcol * fontWidth)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2849
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2850
		(lineSize < col) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2851
		    lText := (line widthOn:self) + (fontWidth * (tcol - lineSize))
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2852
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2853
		    (line isMemberOf:String) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2854
			lText := (font widthOf:line from:1 to:tcol)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2855
		    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2856
			lText := line widthFrom:1 to:tcol on:self.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2857
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2858
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2859
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2860
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2861
    ].
2209
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2862
    ^ lText + textStartLeft
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2863
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2864
    "Modified: / 3.9.1998 / 21:56:33 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2865
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2866
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2867
yOfLine:lineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2868
    "given a physical lineNr, return y-coordinate in view
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2869
     - works for fix-height fonts only"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2870
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2871
    ^ self yOfVisibleLine:(self listLineToVisibleLine:lineNr)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2872
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2873
    "Created: / 26.7.1998 / 13:23:16 / cg"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2874
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2875
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2876
yOfVisibleLine:visLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2877
    "given a visible lineNr, return y-coordinate in view
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2878
     - works for fix-height fonts only"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2879
3819
23dc786223cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3818
diff changeset
  2880
    "/ care for visLineNr being nil during initialization
23dc786223cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3818
diff changeset
  2881
    ^ (((visLineNr ? 1) - 1) * fontHeight) + textStartTop
3398
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2882
!
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2883
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2884
yVisibleToLineNr:yVisible
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2885
    |vL|
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2886
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2887
    vL := self visibleLineOfY:yVisible.
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2888
    ^ self visibleLineToListLine:vL
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2889
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  2890
    "Created: / 20-09-2006 / 15:29:12 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2891
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2892
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2893
!ListView methodsFor:'queries'!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2894
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2895
characterPositionOfLine:lineNr col:col
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2896
    "given a line/col position, return the character index within the contents-string,
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2897
     - used with Compilers error-positioning, which is based on character positions
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2898
     of the contents-string."
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2899
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  2900
    |lineString pos lineEndCharSize|
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  2901
3854
4f0dbd8c4163 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
  2902
    lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1].
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2903
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2904
    self checkForExistingLine:lineNr.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2905
    pos := 1.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2906
    1 to:(lineNr - 1) do:[:lnr |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2907
	lineString := self at:lnr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2908
	lineString notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2909
	    pos := pos + lineString size
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2910
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2911
	pos := pos + lineEndCharSize   "the return-character"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2912
    ].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2913
    ^ pos + col - 1
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  2914
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  2915
    "Modified: / 04-07-2006 / 19:14:25 / fm"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2916
!
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2917
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2918
colOfCharacterPosition:charPos
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2919
    "given a character index within the contents-string,
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2920
     return the column number where the character is
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2921
     - used to find line to hilight from Compilers error-position"
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2922
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2923
    |line|
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2924
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2925
    line := self lineOfCharacterPosition:charPos.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2926
    ^ charPos - (self characterPositionOfLine:line col:1) + 1.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2927
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2928
!
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  2929
1525
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2930
currentLine
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2931
    "the current line (for relative gotos);
1525
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2932
     since listViews have no cursor, the first shown line is returned here.
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2933
     Redefined in editTextView, to return the cursors line."
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2934
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2935
    ^ firstLineShown
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2936
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2937
    "Created: / 17.5.1998 / 20:07:36 / cg"
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2938
!
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2939
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2940
firstLineShown
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2941
    "return the index of the first (possibly partial) visible line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2942
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2943
    ^ firstLineShown
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2944
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2945
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2946
heightForLines:numberOfLines
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2947
    "return the height of the receiver, if numberOfLines are to be displayed"
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2948
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2949
    "need a device font for query"
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2950
    font := font onDevice:device.
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2951
    ^ numberOfLines * fontHeight + topMargin + font descent + (lineSpacing) + (margin * 2)
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2952
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2953
    "Created: 27.1.1996 / 16:55:39 / cg"
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2954
!
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2955
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2956
heightOfContents
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2957
    "return the height of the contents in pixels
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2958
     - used for scrollbar interface"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2959
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2960
    | numLines |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2961
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2962
    numLines := self numberOfLines.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2963
    numLines == 0 ifTrue:[^ 0].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2964
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2965
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2966
    "/ kludge for last partial line
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2967
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2968
"/    nFullLinesShown ~~ nLinesShown ifTrue:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2969
"/        numLines := numLines + 1
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2970
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2971
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2972
     need device-font for query
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2973
    "
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2974
    font := font onDevice:device.
2649
Claus Gittinger <cg@exept.de>
parents: 2648
diff changeset
  2975
    ^ numLines * fontHeight "dont take font height here - think of LabelAndIcons"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2976
"/                            + textStartTop
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2977
			    - (lineSpacing // 2)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2978
			    + (font descent)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2979
"/                            + (font descent)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2980
"/                            + (font descent * 2) "makes it look better"
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2981
				.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2982
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2983
"/    "it used to be that code - which is wrong"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2984
"/    (nLinesShown == nFullLinesShown) ifTrue:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2985
"/        ^ numLines * fontHeight
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2986
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2987
"/    "add one - otherwise we cannot make last line
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2988
"/     fully visible since scrolling is done by full lines only"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2989
"/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2990
"/    ^ (numLines + 1) * fontHeight
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2991
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2992
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2993
lastLineShown
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2994
    "return the index of the last (possibly partial) visible line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2995
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2996
    ^ firstLineShown + nLinesShown
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2997
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2998
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2999
leftIndentOfLine:lineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3000
    "return the number of spaces at the left in line, lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3001
     returns 0 for empty lines."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3002
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  3003
    |lineString indent|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3004
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3005
    lineString := self listAt:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3006
    lineString notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3007
	indent := lineString leftIndent.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3008
	indent == lineString size ifTrue:[^ 0].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3009
	^ indent.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3010
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3011
    ^ 0
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  3012
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  3013
    "Modified: 20.4.1996 / 19:30:38 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3014
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3015
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3016
lengthOfLongestLine
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3017
    "return the length (in characters) of the longest line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3018
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3019
    ^ self lengthOfLongestLineBetween:1 and:self size
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3020
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3021
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3022
lengthOfLongestLineBetween:firstLine and:lastLine
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3023
    "return the length (in characters) of the longest line in a line-range"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3024
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3025
    |max      "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3026
     thisLen  "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3027
     listSize "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3028
     first    "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3029
     last     "{ Class: SmallInteger }" |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3030
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3031
    list isNil ifTrue:[^ 0].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3032
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3033
    listSize := self size.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3034
    max := 0.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3035
    first := firstLine.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3036
    last := lastLine.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3037
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3038
    (first > listSize) ifTrue:[^ max].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3039
    (last > listSize) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3040
	last := listSize
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3041
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3042
    self from:first to:last do:[:lineString |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3043
	lineString notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3044
	    thisLen := lineString size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3045
	    (thisLen > max) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3046
		max := thisLen
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3047
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3048
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3049
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3050
    ^ max
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3051
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3052
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3053
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3054
lineIsFullyVisible:line
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3055
    "is line fully visible?"
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3056
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3057
    (line >= firstLineShown
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3058
     and:[ line < (firstLineShown + nFullLinesShown) ]) ifTrue:[ ^ true ].
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3059
    ^ false.
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3060
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3061
    "Created: 26.4.1996 / 14:36:45 / cg"
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3062
!
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3063
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3064
lineIsVisible:line
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3065
    "is line visible?"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3066
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3067
    (line >= firstLineShown and:[ line < (firstLineShown + nLinesShown) ]) ifTrue:[ ^ true ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3068
    ^ false.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3069
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3070
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3071
lineOfCharacterPosition:charPos
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3072
    "given a character index within the contents-string,
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3073
     return the lineNumber where the character is
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3074
     - used to find line to hilight from Compilers error-position"
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3075
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3076
    |lineNr sum lastLine lineEndCharSize|
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3077
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3078
    lineEndCharSize := self lineEndCRLF ifTrue:2 ifFalse:1.
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3079
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3080
    lineNr := 1.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3081
    sum := 0.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3082
    lastLine := self size.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3083
    [(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3084
	sum := sum + (self at:lineNr) size + lineEndCharSize.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3085
	lineNr := lineNr + 1
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3086
    ].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3087
    sum == charPos ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3088
	^ lineNr
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3089
    ].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3090
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3091
    ^ lineNr - 1
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3092
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3093
    "Modified: / 05-04-1998 / 17:19:28 / cg"
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3094
    "Modified: / 04-07-2006 / 19:13:32 / fm"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3095
!
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3096
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3097
numberOfLines
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3098
    "return the number of lines the text has"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3099
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3100
    ^ self size
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3101
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3102
678
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3103
preferredExtentForLines:numLines cols:numCols
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3104
    ^ (((font widthOf:'x') * numCols + margin + margin)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3105
      @
688
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  3106
      (fontHeight * numLines + margin + margin + font descent + lineSpacing + topMargin)).
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  3107
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  3108
    "Modified: 26.5.1996 / 12:26:41 / cg"
678
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3109
!
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3110
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3111
widthOfContents
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3112
    "return the width of the contents in pixels
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3113
     - used for scrollbar interface"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3114
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  3115
    |max f d lengthOfLongestString|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3116
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3117
    list isNil ifTrue:[^ 0].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3118
    widthOfWidestLine notNil ifTrue:[^ widthOfWidestLine + (leftMargin * 2)].
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  3119
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3120
    (d := device) isNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3121
	"/ mhmh - really dont know yet
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3122
	d := Screen current
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  3123
    ].
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3124
    f := font := font onDevice:d.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3125
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3126
    includesNonStrings ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3127
	max := list
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3128
		   inject:0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3129
		   into:[:maxSoFar :entry |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3130
			     (
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3131
				 entry isNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3132
				     0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3133
				 ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3134
				    entry isString ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3135
					f widthOf:entry
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3136
				    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3137
					entry widthOn:self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3138
				    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3139
				 ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3140
			     ) max:maxSoFar.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3141
			]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3142
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3143
	fontIsFixedWidth ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3144
	    max := lengthOfLongestString := 0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3145
	    list notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3146
		list do:[:line |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3147
		    line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3148
			(line isString and:[line hasChangeOfEmphasis not]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3149
			    line size > lengthOfLongestString ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3150
				lengthOfLongestString := line size
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3151
			    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3152
			] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3153
			    max := max max:(line widthOn:self)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3154
			]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3155
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3156
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3157
		max := max max:(lengthOfLongestString * fontWidth)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3158
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3159
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3160
	    false "fontIsFixedWidth" ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3161
		max := self lengthOfLongestLine * fontWidth
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3162
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3163
		max := 0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3164
		list notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3165
		    list do:[:line |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3166
			line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3167
			    max := max max:(line widthOn:self)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3168
			]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3169
		    ].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  3170
    "/                max := max max:(f widthOf:list)
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3171
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3172
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3173
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3174
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3175
    widthOfWidestLine := max.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3176
    ^ max + (leftMargin * 2)
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  3177
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  3178
    "Modified: / 24.9.1998 / 18:21:08 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3179
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3180
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3181
widthOfLine:lineNr
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3182
    "return the width of a line in pixels"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3183
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3184
    |line f d|
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3185
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3186
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3187
    lineNr > list size ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3188
    line := list at:lineNr.
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3189
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3190
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3191
    (d := device) isNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3192
	"/ mhmh - really dont know yet
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3193
	d := Screen current
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3194
    ].
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3195
    f := font := font onDevice:d.
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3196
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3197
    line isString ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3198
	^ f widthOf:line
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3199
    ].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3200
    ^ line widthOn:self
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3201
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3202
    "Created: / 10.11.1998 / 23:59:20 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3203
    "Modified: / 11.11.1998 / 15:25:07 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3204
!
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3205
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3206
xOriginOfContents
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3207
    "return the horizontal origin of the contents in pixels
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3208
     - used for scrollbar interface"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3209
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3210
    ^ viewOrigin x
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3211
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3212
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3213
yOriginOfContents
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3214
    "return the vertical origin of the contents in pixels
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3215
     - used for scrollbar interface"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3216
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3217
    ^ (firstLineShown - 1) * fontHeight
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3218
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3219
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3220
!ListView methodsFor:'redrawing'!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3221
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3222
flash
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3223
    "show contents in reverse colors for a moment - to wakeup the user :-)"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3224
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3225
    self redrawInverted.
292
f46dea5bdd51 use new Delay wait
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
  3226
    Delay waitForSeconds:0.1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3227
    self redraw
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3228
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3229
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3230
     Transcript flash
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3231
     Transcript redrawInverted
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3232
     Transcript redraw
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3233
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3234
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3235
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3236
redraw
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3237
    "redraw complete view"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3238
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3239
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3240
	self redrawFromVisibleLine:1 to:nLinesShown
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3241
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3242
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3243
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3244
redrawFromLine:lineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3245
    "redraw starting at linrNr"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3246
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3247
    |visibleLine first|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3248
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3249
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3250
	"if first line to redraw is above 1st visible line,
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3251
	 start redraw at 1st visible line"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3252
	(lineNr < firstLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3253
	    first := firstLineShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3254
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3255
	    first := lineNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3256
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3257
	visibleLine := self listLineToVisibleLine:first.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3258
	visibleLine notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3259
	    self redrawFromVisibleLine:visibleLine to:nLinesShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3260
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3261
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3262
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3263
2605
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3264
redrawFromLine:startLine col:startCol toLine:endLine col:endCol
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3265
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3266
	self redrawLine:startLine from:startCol.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3267
	endLine > (startLine+1) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3268
	    self redrawFromLine:startLine+1 to:endLine-1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3269
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3270
	self redrawLine:endLine from:1 to:endCol.
2605
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3271
    ]
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3272
!
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3273
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3274
redrawFromLine:start to:end
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3275
    "redraw lines from start to end"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3276
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3277
    |visibleFirst visibleLast first last lastLineShown|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3278
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3279
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3280
	lastLineShown := firstLineShown + nLinesShown - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3281
	(start <= lastLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3282
	    (end >= firstLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3283
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3284
		"if first line to redraw is above 1st visible line,
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3285
		 start redraw at 1st visible line"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3286
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3287
		(start < firstLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3288
		    first := firstLineShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3289
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3290
		    first := start
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3291
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3292
		(end > lastLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3293
		    last := lastLineShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3294
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3295
		    last := end
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3296
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3297
		visibleFirst := self listLineToVisibleLine:first.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3298
		visibleLast := self listLineToVisibleLine:last.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3299
		self redrawFromVisibleLine:visibleFirst to:visibleLast
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3300
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3301
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3302
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3303
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3304
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3305
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3306
    "redraw a visible line range"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3307
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3308
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3309
	self drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fgColor and:bgColor
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3310
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3311
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3312
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3313
redrawInverted
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3314
    "show contents in reverse colors"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3315
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3316
    |savFg savBg|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3317
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3318
    savFg := fgColor.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3319
    savBg := bgColor.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3320
    fgColor := savBg.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3321
    bgColor := savFg.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3322
    self redraw.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3323
    fgColor := savFg.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3324
    bgColor := savBg.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3325
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3326
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3327
redrawLine:lineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3328
    "redraw a list line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3329
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3330
    |visibleLine|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3331
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3332
    visibleLine := self listLineToVisibleLine:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3333
    visibleLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3334
	self redrawVisibleLine:visibleLine
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3335
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3336
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3337
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3338
redrawLine:lineNr col:col
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3339
    "redraw a single character"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3340
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3341
    |visibleLine|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3342
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3343
    visibleLine := self listLineToVisibleLine:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3344
    visibleLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3345
	self redrawVisibleLine:visibleLine col:col
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3346
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3347
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3348
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3349
redrawLine:lineNr from:startCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3350
    "redraw a list line from startCol to end of line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3351
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3352
    |visibleLine|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3353
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3354
    visibleLine := self listLineToVisibleLine:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3355
    visibleLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3356
	self redrawVisibleLine:visibleLine from:startCol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3357
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3358
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3359
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3360
redrawLine:lineNr from:startCol to:endCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3361
    "redraw a list line from startCol to endCol"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3362
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3363
    |visibleLine|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3364
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3365
    visibleLine := self listLineToVisibleLine:lineNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3366
    visibleLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3367
	self redrawVisibleLine:visibleLine from:startCol to:endCol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3368
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3369
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3370
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3371
redrawVisibleLine:visLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3372
    "redraw a visible line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3373
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3374
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3375
	self drawVisibleLine:visLineNr with:fgColor and:bgColor
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3376
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3377
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3378
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3379
redrawVisibleLine:visLineNr col:col
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3380
    "redraw single character at col index of visible line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3381
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3382
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3383
	self drawVisibleLine:visLineNr col:col with:fgColor and:bgColor
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3384
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3385
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3386
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3387
redrawVisibleLine:visLineNr from:startCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3388
    "redraw right part of a visible line from startCol to end of line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3389
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3390
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3391
	self drawVisibleLine:visLineNr from:startCol with:fgColor and:bgColor
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3392
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3393
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3394
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3395
redrawVisibleLine:visLineNr from:startCol to:endCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3396
    "redraw part of a visible line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3397
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3398
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3399
	startCol == endCol ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3400
	    self redrawVisibleLine:visLineNr col:startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3401
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3402
	    self drawVisibleLine:visLineNr from:startCol to:endCol with:fgColor and:bgColor
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3403
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3404
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3405
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3406
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3407
!ListView methodsFor:'scrolling'!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3408
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3409
gotoLine:aLineNumber
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3410
    "position to line aLineNumber; this may be redefined
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3411
     in subclasses (for example to move the cursor also)"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3412
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3413
    ^ self scrollToLine:aLineNumber
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3414
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3415
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3416
halfPageDown
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3417
    "scroll down half a page"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3418
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3419
    self scrollDown:(nFullLinesShown // 2)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3420
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3421
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3422
halfPageUp
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3423
    "scroll up half a page"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3424
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3425
    self scrollUp:(nFullLinesShown // 2)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3426
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3427
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3428
horizontalScrollStep
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3429
    "return the amount to scroll when stepping up/down.
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3430
     Here, the scrolling unit is characters."
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3431
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3432
    ^ font width
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3433
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3434
    "Created: / 21.5.1999 / 15:55:06 / cg"
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3435
!
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3436
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3437
makeColVisible:aCol inLine:aLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3438
    "if column aCol is not visible, scroll horizontal to make it visible"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3439
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3440
    |xWant xVis visLnr|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3441
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3442
    (aCol isNil or:[shown not]) ifTrue:[^ self].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3443
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3444
    visLnr := self listLineToVisibleLine:aLineNr.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3445
    visLnr isNil ifTrue:[^ self].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3446
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3447
    xWant := self xOfCol:aCol inVisibleLine:visLnr.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3448
    xVis := xWant - viewOrigin x.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3449
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3450
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3451
     dont scroll, if already visible
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3452
     (but scroll, if not in inner 20%..80% of visible area)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3453
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3454
"/    ((xVis >= (width // 5)) and:[xVis <= (width * 4 // 5)]) ifTrue:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3455
"/        ^ self
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3456
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3457
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3458
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3459
     no, the above does not look good, if you click / select at the
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3460
     far right - makes selecting so difficult ...
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3461
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3462
    (xVis >= 0 and:[xVis < (width - font width)]) ifTrue:[^ self].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3463
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3464
    self scrollHorizontalTo:(xWant - (width // 2)).
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3465
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3466
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3467
makeLineVisible:aListLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3468
    "if aListLineNr is not visible, scroll to make it visible.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3469
     Numbering starts with 1 for the very first line of the text."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3470
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3471
    |bott newTopLine|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3472
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3473
    (aListLineNr isNil "or:[shown not]") ifTrue:[^ self].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3474
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3475
"/  Old code follows. It is no longer used, because:
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3476
"/      1. we must maintain our viewOrigin (not maintained in this code!!)
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3477
"/      2. we must inform our dependents about originChanges.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3478
"/
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3479
"/    shown ifFalse:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3480
"/        firstLineShown := (aListLineNr - 1) max:1.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3481
"/        firstLineShown > (list size - nFullLinesShown) ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3482
"/            firstLineShown := list size - nFullLinesShown
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3483
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3484
"/        list size <= nFullLinesShown ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3485
"/            firstLineShown := 1
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3486
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3487
"/        ^ self
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3488
"/    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  3489
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3490
    (self needScrollToMakeLineVisible:aListLineNr) ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3491
	^ self
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3492
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3493
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3494
    (aListLineNr < nFullLinesShown) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3495
	"/ at the very top of the list - show from top
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3496
	newTopLine := 1
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3497
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3498
	(nFullLinesShown < 3) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3499
	    "/ a small view - show from that line
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3500
	    newTopLine := aListLineNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3501
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3502
	    bott := self numberOfLines - (nFullLinesShown - 1).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3503
	    (aListLineNr > bott) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3504
		"/ at the end of the list - show the bottom of the list
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3505
		newTopLine := bott
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3506
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3507
		"/ somewhere else - place selected line into the middle of
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3508
		"/ the view
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3509
		newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3510
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3511
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3512
    ].
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3513
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3514
    self scrollToLine:newTopLine.
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3515
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3516
    "Modified: / 18.12.1996 / 17:48:22 / stefan"
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3517
    "Modified: / 7.8.1998 / 15:14:12 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3518
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3519
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3520
makeVisible:someString
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3521
    "if nescessary, scroll to make the (first)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3522
     line containing someString visible."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3523
1808
097b86f1473e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3524
    |index list|
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3525
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3526
    (list := self list) notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3527
	index := list indexOf:someString.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3528
	index ~~ 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3529
	    self makeLineVisible:index
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3530
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3531
    ]
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3532
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3533
    "Modified: 9.9.1997 / 10:10:13 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3534
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3535
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3536
needScrollToMakeLine:aListLineNr
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3537
    "return true, if a scroll is needd to make a line visible.
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3538
     Numbering starts with 1 for the very first line of the text."
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3539
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3540
    (aListLineNr >= firstLineShown) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3541
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3542
	    ^ false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3543
	]
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3544
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3545
    ^ true
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3546
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3547
    "Created: / 7.8.1998 / 15:13:51 / cg"
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3548
    "Modified: / 7.8.1998 / 15:14:44 / cg"
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3549
!
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3550
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3551
needScrollToMakeLineVisible:aListLineNr
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3552
    "return true, if a scroll is needd to make a line visible.
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3553
     Numbering starts with 1 for the very first line of the text."
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3554
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3555
    (aListLineNr >= firstLineShown) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3556
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3557
	    ^ false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3558
	]
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3559
    ].
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3560
    ^ true
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3561
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3562
    "Created: / 7.8.1998 / 15:13:51 / cg"
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3563
    "Modified: / 7.8.1998 / 15:14:44 / cg"
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3564
!
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3565
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3566
pageDown
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3567
    "change origin to display next page"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3568
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3569
    self scrollTo:(viewOrigin + (0 @ height))
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3570
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3571
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3572
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3573
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3574
pageUp
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3575
    "change origin to display previous page"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3576
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3577
    self scrollTo:(viewOrigin - (0 @ height))
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3578
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3579
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3580
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3581
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3582
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3583
scrollDown:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3584
    "change origin to scroll down some lines (towards the bottom of the text)"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3585
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3586
    nLines ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3587
	self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3588
	       redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3589
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3590
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3591
    "Modified: / 21.5.1999 / 15:59:52 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3592
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3593
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3594
scrollDownPixels:pix
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3595
    "change origin to scroll down some pixels
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3596
     (towards the bottom of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3597
     THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3598
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3599
    pix > 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3600
	self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3601
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3602
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3603
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3604
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3605
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3606
scrollHorizontalTo:aPixelOffset
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3607
    "change origin to make aPixelOffset be the left col"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3608
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3609
    |nPixel|
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3610
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3611
    nPixel := aPixelOffset - viewOrigin x.
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3612
    nPixel ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3613
	self scrollTo:(viewOrigin + (nPixel @ 0)) redraw:true
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3614
    ]
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3615
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3616
    "Modified: / 3.3.1999 / 22:55:20 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3617
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3618
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3619
scrollLeft:nPixel
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3620
    "change origin to scroll left some cols"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3621
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3622
    nPixel ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3623
	self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3624
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3625
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3626
    "Modified: / 21.5.1999 / 15:59:16 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3627
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3628
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3629
scrollRight:nPixel
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3630
    "change origin to scroll right some cols"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3631
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3632
    nPixel ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3633
	self scrollTo:(self viewOrigin + (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3634
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3635
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3636
    "Modified: / 21.5.1999 / 15:59:21 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3637
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3638
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3639
scrollSelectDown
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3640
    "just a template - I do not know anything about selections"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3641
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3642
    ^ self subclassResponsibility
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3643
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3644
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3645
scrollSelectUp
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3646
    "just a template - I do not know anything about selections"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3647
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3648
    ^ self subclassResponsibility
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3649
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3650
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3651
scrollToBottom
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3652
    "change origin to show end of text"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3653
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3654
    "scrolling to the end is not really correct (i.e. should scroll to list size - nFullLinesShown),
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3655
     but scrollDown: will adjust it ..."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3656
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3657
    self scrollToLine:(self size)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3658
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3659
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3660
scrollToCol:aColNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3661
    "change origin to make aColNr be the left col"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3662
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3663
    |pxlOffset leftOffset|
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3664
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3665
    leftOffset := viewOrigin x.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3666
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3667
    aColNr == 1 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3668
	leftOffset ~~ 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3669
	    self scrollLeft:leftOffset.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3670
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3671
	^ self
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3672
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3673
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3674
    pxlOffset := font width * (aColNr - 1).
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3675
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3676
    pxlOffset < leftOffset ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3677
	self scrollLeft:(leftOffset - pxlOffset)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3678
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3679
	pxlOffset > leftOffset ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3680
	    self scrollRight:(pxlOffset - leftOffset)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3681
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3682
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3683
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3684
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3685
scrollToLeft
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3686
    "change origin to start (left) of text"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3687
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3688
    viewOrigin x ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3689
	self scrollToCol:1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3690
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3691
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3692
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3693
scrollToLine:aLineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3694
    "change origin to make aLineNr be the top line"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3695
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3696
    aLineNr < firstLineShown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3697
	self scrollUp:(firstLineShown - aLineNr)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3698
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3699
	aLineNr > firstLineShown ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3700
	    self scrollDown:(aLineNr - firstLineShown)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3701
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3702
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3703
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3704
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3705
scrollToPercent:percentOrigin
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3706
    "scroll to a position given in percent of total"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3707
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3708
    "kludge - ListView thinks in lines"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3709
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3710
    self scrollHorizontalToPercent:percentOrigin x.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3711
    self scrollVerticalToPercent:percentOrigin y.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3712
!
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3713
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3714
scrollToTop
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3715
    "change origin to start of text"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3716
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3717
    self scrollToLine:1
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3718
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3719
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3720
scrollUp:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3721
    "change origin to scroll up some lines (towards the top of the text)"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3722
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3723
    nLines ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3724
	self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3725
	       redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3726
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3727
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3728
    "Modified: / 21.5.1999 / 15:59:45 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3729
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3730
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3731
scrollUpPixels:pix
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3732
    "change origin to scroll up some pixels
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3733
     (towards the top of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3734
    THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3735
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3736
    pix > 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3737
	self scrollTo:(viewOrigin - (0 @ pix)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3738
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3739
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3740
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3741
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3742
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3743
scrollVerticalToPercent:percent
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3744
    "scroll to a position given in percent of total"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3745
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3746
    |nL lineNr|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3747
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3748
    nL := self numberOfLines.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3749
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3750
    "/ kludge for last partial line
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3751
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3752
    nFullLinesShown ~~ nLinesShown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3753
	nL := nL + 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3754
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3755
    lineNr := (((nL * percent) asFloat / 100.0) + 0.5) asInteger + 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3756
    self scrollToLine:lineNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3757
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3758
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3759
startAutoScrollDown:yDistance
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3760
    "setup for auto-scroll down (when button-press-moving below view)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3761
     - timeDelta for scroll is computed from distance"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3762
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3763
    self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3764
	startAutoScrollVertical:yDistance
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3765
	scrollSelector:#scrollSelectDown
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3766
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3767
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3768
startAutoScrollHorizontal:xDistance scrollSelector:scrollSelector
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3769
    "setup for auto-scroll left/right (when button-press-moving to the right of the view)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3770
     - timeDelta for scroll is computed from distance"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3771
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3772
    |deltaT mm|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3773
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3774
    autoScroll ifFalse:[^ self].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3775
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3776
    mm := xDistance // self horizontalIntegerPixelPerMillimeter + 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3777
    deltaT := 0.5 / mm.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3778
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3779
    (deltaT = autoScrollDeltaT) ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3780
	autoScrollDeltaT := deltaT.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3781
	autoScrollBlock isNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3782
	    autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3783
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3784
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3785
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3786
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3787
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3788
startAutoScrollLeft:xDistance
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3789
    "setup for auto-scroll up (when button-press-moving to the left of the view)
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3790
     - timeDelta for scroll is computed from distance"
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3791
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3792
    self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3793
	startAutoScrollHorizontal:xDistance negated
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3794
	scrollSelector:#scrollSelectLeft
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3795
!
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3796
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3797
startAutoScrollRight:xDistance
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3798
    "setup for auto-scroll down (when button-press-moving to the right of the view)
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3799
     - timeDelta for scroll is computed from distance"
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3800
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3801
    self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3802
	startAutoScrollHorizontal:xDistance
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3803
	scrollSelector:#scrollSelectRight
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3804
!
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3805
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3806
startAutoScrollUp:yDistance
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3807
    "setup for auto-scroll up (when button-press-moving below view)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3808
     - timeDelta for scroll is computed from distance"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3809
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3810
    self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3811
	startAutoScrollVertical:yDistance negated
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3812
	scrollSelector:#scrollSelectUp
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3813
!
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3814
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3815
startAutoScrollVertical:yDistance scrollSelector:scrollSelector
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3816
    "setup for auto-scroll up (when button-press-moving below view)
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3817
     - timeDelta for scroll is computed from distance"
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3818
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3819
    |deltaT mm|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3820
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3821
    autoScroll ifFalse:[^ self].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3822
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  3823
    mm := yDistance // self verticalIntegerPixelPerMillimeter + 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3824
    deltaT := 0.5 / mm.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3825
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3826
    (deltaT = autoScrollDeltaT) ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3827
	autoScrollDeltaT := deltaT.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3828
	autoScrollBlock isNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3829
	    autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3830
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3831
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3832
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3833
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3834
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3835
stopAutoScroll
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3836
    "stop any auto-scroll"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3837
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3838
    autoScrollBlock notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3839
	self compressMotionEvents:true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3840
	Processor removeTimedBlock:autoScrollBlock.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3841
	autoScrollBlock := nil.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3842
	autoScrollDeltaT := nil
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3843
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3844
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3845
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3846
verticalScrollStep
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3847
    "return the amount to scroll when stepping up/down.
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3848
     Here, the scrolling unit is lines."
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3849
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3850
    ^ 1
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3851
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3852
    "Created: / 21.5.1999 / 14:00:12 / cg"
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3853
!
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3854
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3855
viewOrigin
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3856
    "return the viewOrigin; thats the coordinate of the contents
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3857
     which is shown topLeft in the view
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3858
     (i.e. the origin of the visible part of the contents)."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3859
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3860
    ^ viewOrigin
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3861
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3862
2316
c259fe3a937b category change
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  3863
!ListView methodsFor:'scrolling-basic'!
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3864
2331
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3865
additionalMarginForHorizontalScroll
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3866
    "return the number of pixels by which we may scroll more than the actual
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3867
     width of the document would allow.
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3868
     This is redefined by editable textViews, to allo for the cursor
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3869
     to be visible if it is positioned right behind the longest line of text.
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3870
     The default returned here is the width of a blank (to beautify italic text)"
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3871
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3872
    ^ font width
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3873
!
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3874
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3875
scrollTo:anOrigin redraw:doRedraw
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3876
    "change origin to have newOrigin be visible at the top-left.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3877
     The argument defines the integer device coordinates of the new top-left
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3878
     point.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3879
    "
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3880
    |dltOrg
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3881
     noLn "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3882
     max  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3883
     tmp  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3884
     h    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3885
     w    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3886
     y0   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3887
     y1   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3888
     y    "{ Class:SmallInteger }"
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3889
     x    "{ Class:SmallInteger }"
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3890
     delta newFirstLine newViewOrigin
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3891
     hBefore wBefore inv wg|
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3892
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3893
    hBefore := height.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3894
    wBefore := width.
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3895
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3896
    dltOrg := anOrigin - viewOrigin.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3897
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3898
"/  compute valid horizontal offset x
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3899
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3900
    (x := dltOrg x) ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3901
	tmp := viewOrigin x + x.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3902
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3903
	x < 0 ifTrue:[                                          "/ scrolling left
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3904
	    tmp < 0 ifTrue:[x := 0 - viewOrigin x]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3905
	] ifFalse:[                                             "/ scrolling right
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3906
	 "/ allows scrolling to the right of widest line
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3907
	    max := self widthOfContents + (self additionalMarginForHorizontalScroll).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3908
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3909
	    tmp + width > max ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3910
		x := (max - viewOrigin x - width) max:0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3911
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3912
	]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3913
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3914
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3915
"/  compute valid vertical offset measured in lines
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3916
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3917
    (y := dltOrg y // fontHeight) ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3918
	tmp := firstLineShown + y.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3919
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3920
	y < 0 ifTrue:[                                          "/ scrolling up
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3921
	    tmp < 1 ifTrue:[y := 1 - firstLineShown]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3922
	] ifFalse:[                                             "/ scrolling down
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3923
	    max := self size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3924
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3925
	    tmp + nFullLinesShown > max ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3926
		y := (max - firstLineShown - nFullLinesShown + 1) max:0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3927
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3928
	]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3929
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3930
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3931
    (x == 0 and:[y == 0]) ifTrue:[                              "/ has viewOrigin changed ?
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3932
	^ self
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3933
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3934
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3935
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3936
    (noLn := y) ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3937
	y := y * fontHeight
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3938
    ].
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3939
    delta := (x @ y).
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3940
1582
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3941
    newFirstLine := firstLineShown + noLn.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3942
    newViewOrigin := viewOrigin + delta.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3943
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3944
    (shown and:[doRedraw]) ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3945
	self originWillChange.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3946
	firstLineShown := newFirstLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3947
	viewOrigin := newViewOrigin.
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
  3948
viewOrigin x < 0 ifTrue:[self error:'bad view origin'].
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3949
	^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3950
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3951
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3952
"/    (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[               "/ outstanding expose events
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3953
"/        self invalidate.                                        "/ redraw all
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3954
"/        self originWillChange.
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3955
"/        ^ self originChanged:(x @ y )
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3956
"/    ].
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3957
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3958
    (     (y ~~ 0 and:[x ~~ 0])         "/ both x and y changed
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3959
      or:[(noLn abs) >= nLinesShown     "/ at least one area is
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3960
      or:[(x abs) > (width // 4 * 3)]]  "/ big enough to redraw all
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3961
    ) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3962
	self originWillChange.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3963
	firstLineShown := newFirstLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3964
	viewOrigin := newViewOrigin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3965
	self invalidate.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3966
	^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3967
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3968
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3969
    "/ OLD:
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3970
    "/ self repairDamage.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  3971
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3972
    (wg := self windowGroup) notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3973
	wg processRealExposeEventsFor:self.
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3974
    ].
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3975
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3976
    self originWillChange.
1970
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3977
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3978
    "/ make certain, that all drawing is complete
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3979
    "/ device sync.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3980
1975
0eda51a6d48e uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents: 1972
diff changeset
  3981
    self catchExpose.
1970
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3982
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3983
    x == 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3984
	"/ scrolling vertical
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3985
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3986
	y0 := textStartTop + (y abs).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3987
	h  := hBefore - margin - y0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3988
	w  := wBefore - margin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3989
	y > 0 ifTrue:[                                          "/ copy down
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3990
	    "/ kludge: if the selection highlighting draws into the textStartTop area,
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3991
	    "/ the copy below leaves some selection depris in the top area.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3992
	    "/ Therefore, clear the top area.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3993
	    "/ (should avoid this, in case we know there cannot be anything
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3994
	    "/  there - selection is nil or >= firstLineShown).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3995
	    self clearDeviceRectangleX:margin y:margin width:width-margin-margin height:(textStartTop-margin).
1983
3261af8573c6 scrolling redraw bug on w32
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
  3996
"/            self invalidateDeviceRectangle:((margin@margin) corner:(width-margin@textStartTop)) repairNow:false.
1977
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  3997
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3998
	    self copyFrom:self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3999
			x:0 y:y0 toX:0 y:textStartTop
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4000
		    width:w height:h async:true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4001
	    y1 := h - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4002
	    y0 := y0 + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4003
	] ifFalse:[                                             "/ copy up
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4004
	    self copyFrom:self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4005
			x:margin y:textStartTop toX:margin y:y0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4006
		    width:w height:h async:true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4007
	    y1 := 0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4008
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4009
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4010
	inv := (margin@y1) extent:(w@y0).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4011
    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4012
	"/ scrolling horizontal
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4013
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4014
	x > 0 ifTrue:[                                          "/ scrolling right
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4015
	    y0 := margin + x.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4016
	    y1 := wBefore - y0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4017
	] ifFalse:[                                             "/ scrolling left
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4018
	    y0 := margin - x.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4019
	    y1 := 0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4020
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4021
	h := hBefore - margin - margin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4022
	w := wBefore - margin - y0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4023
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4024
	x > 0 ifTrue:[                                          "/ copy right
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4025
	    self copyFrom:self x:y0 y:margin toX:margin y:margin
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4026
		    width:w height:h async:true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4027
	] ifFalse:[                                             "/ copy left
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4028
	    "/self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4029
	    self copyFrom:self x:margin y:margin toX:y0 y:margin
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4030
		    width:w height:h async:true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4031
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4032
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4033
	inv := (y1@margin) extent:(y0@h).
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4034
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4035
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4036
    firstLineShown := newFirstLine.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4037
    viewOrigin := newViewOrigin.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  4038
1885
Claus Gittinger <cg@exept.de>
parents: 1884
diff changeset
  4039
    self invalidateDeviceRectangle:inv repairNow:false.
1712
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  4040
1975
0eda51a6d48e uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents: 1972
diff changeset
  4041
    self originChanged:delta.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  4042
    self waitForExpose.
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  4043
2202
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  4044
    (wg := self windowGroup) notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4045
	wg processRealExposeEventsFor:self.
2202
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  4046
    ].
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  4047
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4048
"/    (hBefore ~= height or:[wBefore ~= width]) ifTrue:[
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4049
"/        self halt.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4050
"/    ].
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4051
1983
3261af8573c6 scrolling redraw bug on w32
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
  4052
    "Modified: / 11.8.1999 / 19:40:47 / cg"
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4053
! !
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4054
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4055
!ListView methodsFor:'searching'!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4056
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4057
findBeginOfWordAtLine:selectLine col:selectCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4058
    "return the col of first character of the word at given line/col.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4059
     If the character under the initial col is a space character, return
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4060
     the first col of the blank-block."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4061
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4062
    |beginCol thisCharacter|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4063
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4064
    beginCol := selectCol.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4065
    thisCharacter := self characterAtLine:selectLine col:beginCol.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4066
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4067
    "is this acharacter within a word ?"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4068
    (wordCheck value:thisCharacter) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4069
	[wordCheck value:thisCharacter] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4070
	    beginCol := beginCol - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4071
	    beginCol < 1 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4072
		^ 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4073
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4074
	    thisCharacter := self characterAtLine:selectLine col:beginCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4075
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4076
	beginCol := beginCol + 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4077
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4078
	"nope - maybe its a space"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4079
	thisCharacter == Character space ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4080
	    [beginCol > 1 and:[thisCharacter == Character space]] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4081
		beginCol := beginCol - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4082
		thisCharacter := self characterAtLine:selectLine col:beginCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4083
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4084
	    thisCharacter ~~ Character space ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4085
		beginCol := beginCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4086
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4087
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4088
	    "select single character"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4089
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4090
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4091
    ^ beginCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4092
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4093
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4094
findEndOfWordAtLine:selectLine col:selectCol
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4095
    "return the col of last character of the word at given line/col.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4096
     If the character under the initial col is a space character, return
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4097
     the last col of the blank-block.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4098
     Return 0 if we should wrap to next line (for spaces)"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4099
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4100
    |endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4101
     len    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4102
     thisCharacter|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4103
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4104
    endCol := selectCol.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4105
    endCol == 0 ifTrue:[endCol := 1].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4106
    thisCharacter := self characterAtLine:selectLine col:endCol.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4107
2900
0feab01d5b27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2891
diff changeset
  4108
    len := (self listAt:selectLine) size.
0feab01d5b27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2891
diff changeset
  4109
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4110
    "is this acharacter within a word ?"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4111
    (wordCheck value:thisCharacter) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4112
	[wordCheck value:thisCharacter] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4113
	    endCol := endCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4114
	    endCol > len ifTrue:[ ^ len ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4115
	    thisCharacter := self characterAtLine:selectLine col:endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4116
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4117
	endCol := endCol - 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4118
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4119
	"nope - maybe its a space"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4120
	thisCharacter == Character space ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4121
	    endCol > len ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4122
		"select rest to end"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4123
		endCol := 0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4124
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4125
		thisCharacter := self characterAtLine:selectLine col:endCol.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4126
		[endCol <= len and:[thisCharacter == Character space]] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4127
		    endCol := endCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4128
		    thisCharacter := self characterAtLine:selectLine col:endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4129
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4130
		endCol := endCol - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4131
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4132
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4133
	    "select single character"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4134
	]
125
claus
parents: 121
diff changeset
  4135
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4136
    ^ endCol.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4137
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4138
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4139
searchBackwardFor:pattern ignoreCase:ignCase startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4140
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4141
     found evaluate block2.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4142
     Sorry, but pattern is no regular expression pattern (yet)"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4143
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4144
    |lineString
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4145
     found firstChar1 firstChar2 c pc
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4146
     col         "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4147
     cc          "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4148
     patternSize "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4149
     line1       "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4150
     lineSize    "{ Class: SmallInteger }" |
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4151
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4152
    patternSize := pattern size.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4153
    (list notNil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4154
    and:[startLine > 0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4155
    and:[patternSize ~~ 0]])
2508
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4156
    ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4157
	self withCursor:Cursor questionMark do:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4158
	    col := startCol - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4159
	    firstChar1 := pattern at:1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4160
	    ignCase ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4161
		firstChar1 := firstChar1 asLowercase.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4162
		firstChar2 := firstChar1 asUppercase.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4163
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4164
		firstChar2 := firstChar1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4165
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4166
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4167
	    line1 := startLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4168
	    line1 > list size ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4169
		line1 := list size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4170
		col := -999
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4171
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4172
		col > (list at:line1) size ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4173
		    col := -999
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4174
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4175
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4176
	    line1 to:1 by:-1 do:[:lnr |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4177
		lineString := list at:lnr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4178
		lineString notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4179
		    lineString := lineString asString
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4180
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4181
		lineString notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4182
		    lineSize := lineString size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4183
		    col == -999 ifTrue:[col := lineSize - patternSize + 1].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4184
		    [(col > 0)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4185
		     and:[(c := lineString at:col) ~= firstChar1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4186
		     and:[c ~= firstChar2]]] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4187
			col := col - 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4188
		    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4189
		    [col > 0] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4190
			cc := col.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4191
			found := true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4192
			1 to:patternSize do:[:cnr |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4193
			    cc > lineSize ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4194
				found := false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4195
			    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4196
				pc := pattern at:cnr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4197
				c := lineString at:cc.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4198
				pc ~= c ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4199
				    (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4200
					found := false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4201
				    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4202
				]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4203
			    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4204
			    cc := cc + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4205
			].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4206
			found ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4207
			    ^ block1 value:lnr value:col.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4208
			].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4209
			col := col - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4210
			[(col > 0)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4211
			and:[(c := lineString at:col) ~= firstChar1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4212
			and:[c ~= firstChar2]]] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4213
			    col := col - 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4214
			]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4215
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4216
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4217
		col := -999.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4218
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4219
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4220
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4221
    "not found"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4222
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4223
    ^ block2 value
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4224
2508
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4225
    "Created: / 13.9.1997 / 01:06:19 / cg"
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4226
    "Modified: / 23.12.2001 / 13:14:23 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4227
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4228
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4229
searchBackwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4230
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4231
     found evaluate block2.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4232
     Sorry, but pattern is no regular expression pattern (yet)"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4233
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4234
    ^ self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4235
	searchBackwardFor:pattern
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4236
	ignoreCase:false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4237
	startingAtLine:startLine col:startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4238
	ifFound:block1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4239
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4240
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4241
    "Modified: 13.9.1997 / 01:07:36 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4242
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4243
3576
469c653bd012 searchForward with match argument
fm
parents: 3570
diff changeset
  4244
searchForwardFor:pattern ignoreCase:ignCase match: match startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4245
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4246
     found evaluate block2."
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4247
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4248
    |lineString col patternSize
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4249
     line1 "{Class: SmallInteger}"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4250
     line2 "{Class: SmallInteger}"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4251
     p realPattern|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4252
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4253
    patternSize := pattern size.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4254
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4255
	self withCursor:Cursor questionMark do:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4256
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4257
	    col := startCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4258
	    line1 := startLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4259
	    line2 := list size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4260
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4261
	    (match and:[pattern includesUnescapedMatchCharacters]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4262
		"perform a findMatchString (matching)"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4263
		p := pattern species new:0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4264
		(pattern startsWith:$*) ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4265
		    p := p , '*'
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4266
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4267
		p := p , pattern.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4268
		(pattern endsWith:$*) ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4269
		    p := p , '*'
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4270
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4271
		realPattern := pattern.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4272
		(realPattern startsWith:$*) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4273
		    realPattern := realPattern copyFrom:2
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4274
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4275
		line1 to:line2 do:[:lnr |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4276
		    lineString := list at:lnr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4277
		    lineString notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4278
			"/ first a crude check ...
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4279
			(p match:lineString ignoreCase:ignCase) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4280
			    "/ ok, there it is; look at which position
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4281
			    col := lineString
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4282
					findMatchString:realPattern
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4283
					startingAt:col
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4284
					ignoreCase:ignCase
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4285
					ifAbsent:0.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4286
			    col ~~ 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4287
				^ block1 value:lnr value:col.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4288
			    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4289
			].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4290
		    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4291
		    col := 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4292
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4293
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4294
		"perform a findString (no matching)"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4295
		p := pattern "withoutMatchEscapes".
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4296
		line1 to:line2 do:[:lnr |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4297
		    lineString := list at:lnr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4298
		    lineString notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4299
			lineString := lineString asString
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4300
		    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4301
		    lineString isString ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4302
			col := lineString
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4303
				    findString:p
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4304
				    startingAt:col
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4305
				    ifAbsent:0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4306
				    caseSensitive: ignCase not.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4307
			col ~~ 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4308
			    ^ block1 value:lnr value:col.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4309
			]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4310
		    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4311
		    col := 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4312
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4313
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4314
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4315
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4316
    "not found"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4317
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4318
    ^ block2 value
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  4319
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4320
    "Created: 13.9.1997 / 01:06:31 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4321
    "Modified: 13.9.1997 / 01:11:28 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4322
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4323
3576
469c653bd012 searchForward with match argument
fm
parents: 3570
diff changeset
  4324
searchForwardFor:pattern ignoreCase:ignCase startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
469c653bd012 searchForward with match argument
fm
parents: 3570
diff changeset
  4325
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
469c653bd012 searchForward with match argument
fm
parents: 3570
diff changeset
  4326
     found evaluate block2."
469c653bd012 searchForward with match argument
fm
parents: 3570
diff changeset
  4327
469c653bd012 searchForward with match argument
fm
parents: 3570
diff changeset
  4328
    self searchForwardFor:pattern ignoreCase:ignCase match: true startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
469c653bd012 searchForward with match argument
fm
parents: 3570
diff changeset
  4329
!
469c653bd012 searchForward with match argument
fm
parents: 3570
diff changeset
  4330
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4331
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4332
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4333
     found evaluate block2."
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4334
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4335
    ^ self
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4336
	searchForwardFor:pattern
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4337
	ignoreCase:false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4338
	startingAtLine:startLine col:startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4339
	ifFound:block1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4340
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4341
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4342
    "Modified: 13.9.1997 / 01:07:11 / cg"
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  4343
!
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  4344
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  4345
standardWordCheck:char
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  4346
    UserPreferences current whitespaceWordSelectMode ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4347
	^ char isSeparator not
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  4348
    ].
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  4349
    UserPreferences current extendedWordSelectMode ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4350
	^ char isNationalAlphaNumeric or:[char == $_]
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  4351
    ].
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  4352
    ^ char isNationalAlphaNumeric
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  4353
! !
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4354
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4355
!ListView methodsFor:'tabulators'!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4356
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4357
expandTabs
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4358
    "go through whole text expanding tabs into spaces.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4359
     This is meant to be called for text being imported from a file.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4360
     Therefore, 8-col tabs are assumed - independent of any private tab setting."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4361
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4362
    |line newLine nLines "{ Class: SmallInteger }"|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4363
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4364
    includesNonStrings := false.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4365
    list notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4366
	nLines := self size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4367
	1 to:nLines do:[:index |
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4368
	    line := self at:index.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4369
	    line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4370
		line isString ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4371
		    newLine := line withTabsExpanded.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4372
		    newLine ~~ line ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4373
			list at:index put:newLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4374
		    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4375
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4376
		    includesNonStrings := true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4377
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4378
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4379
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4380
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4381
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4382
    "Modified: 30.8.1995 / 19:06:37 / claus"
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  4383
    "Modified: 12.5.1996 / 12:48:03 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4384
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4385
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4386
nextTabAfter:colNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4387
    "return the next tab position after col"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4388
3151
fc183d8ff88c next-tab: fallback to mod-8 tabs if beyond tab-list
Claus Gittinger <cg@exept.de>
parents: 3150
diff changeset
  4389
    ^ self nextTabAfter:colNr in:tabPositions.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4390
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4391
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4392
nextTabAfter:colNr in:tabPositions
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4393
    "return the next tab position after col.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4394
     The second arg, tabPositions is a collection of tabStops."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4395
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4396
    |col      "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4397
     tabIndex "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4398
     thisTab  "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4399
     nTabs    "{ Class: SmallInteger }" |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4400
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4401
    tabIndex := 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4402
    col := colNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4403
    thisTab := tabPositions at:tabIndex.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4404
    nTabs := tabPositions size.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4405
    [thisTab <= col] whileTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4406
	(tabIndex == nTabs) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4407
	    "/ fallback to mod-8 tabs if beyond tab-list.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4408
	    thisTab := col + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4409
	    thisTab := thisTab + (8 - (thisTab \\ 8)).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4410
	    ^ thisTab
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4411
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4412
	tabIndex := tabIndex + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4413
	thisTab := tabPositions at:tabIndex
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4414
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4415
    ^ thisTab
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4416
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4417
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4418
prevTabBefore:colNr
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4419
    "return the prev tab position before col"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4420
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4421
    |col      "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4422
     tabIndex "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4423
     thisTab  "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4424
     nTabs    "{ Class: SmallInteger }" |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4425
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4426
    tabIndex := 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4427
    col := colNr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4428
    thisTab := tabPositions at:tabIndex.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4429
    nTabs := tabPositions size.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4430
    [thisTab < col] whileTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4431
	(tabIndex == nTabs) ifTrue:[^ thisTab].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4432
	tabIndex := tabIndex + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4433
	thisTab := tabPositions at:tabIndex
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4434
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4435
    (tabIndex == 1) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4436
	^ 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4437
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4438
    ^ tabPositions at:(tabIndex - 1)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4439
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4440
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4441
setTab4
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4442
    "set 4-character tab stops"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4443
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4444
    tabPositions := self class tab4Positions.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4445
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4446
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4447
setTab8
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4448
    "set 8-character tab stops"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4449
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4450
    tabPositions := self class tab8Positions.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4451
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4452
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4453
setTabPositions:aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4454
    "set tab stops"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4455
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4456
    tabPositions := aVector.
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4457
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4458
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4459
withTabs:line
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4460
    "Assuming an 8-character tab,
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4461
     compress multiple leading spaces to tabs, return a new line string
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4462
     or the original line, if no tabs where created.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4463
     good idea, to make this one a primitive, since its called
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4464
     many times when a big text is saved to a file."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4465
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4466
    |newLine eightSpaces nTabs|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4467
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4468
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4469
     the code below is a hack, producing many garbage strings for lines
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4470
     which compress multiple tabs ... needs rewrite: saving big files
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4471
     stresses the garbage collector a bit ...
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4472
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4473
    line isNil ifTrue:[^ line].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4474
    eightSpaces := '        '.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4475
    (line startsWith:eightSpaces) ifFalse:[^ line].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4476
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4477
    nTabs := 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4478
    newLine := line copyFrom:9.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4479
    [newLine startsWith:eightSpaces] whileTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4480
	newLine := newLine copyFrom:9.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4481
	nTabs := nTabs + 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4482
    ].
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4483
    ^ (line species new:nTabs withAll:Character tab) asString , newLine.
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4484
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4485
    "Modified: 23.2.1996 / 19:10:36 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4486
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4487
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4488
withTabs:tabulatorTable expand:line
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4489
    "expand tabs into spaces, return a new line string,
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4490
     or original line, if no tabs are included.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4491
     good idea, to make this one a primitive, since it is called
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4492
     many times if a big text is read from a file."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4493
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4494
    |tmpString nString nTabs
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4495
     currentMax "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4496
     dstIndex   "{ Class: SmallInteger }"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4497
     nextTab    "{ Class: SmallInteger }" |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4498
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4499
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4500
     the code below tries to avoid creating too much garbage;
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4501
     therefore, the string is scanned first for the number of
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4502
     tabs to get a rough idea of the final strings size.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4503
     (it could be done better, by computing the exact size
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4504
      required here ...)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4505
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4506
    line isNil ifTrue:[^ line].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4507
    nTabs := line occurrencesOf:(Character tab).
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4508
    nTabs == 0 ifTrue:[^ line].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4509
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4510
    currentMax := line size + (nTabs * 7).
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4511
    tmpString := line species new:currentMax.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4512
    dstIndex := 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4513
    line do:[:character |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4514
	(character == (Character tab)) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4515
	    nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4516
	    [dstIndex < nextTab] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4517
		tmpString at:dstIndex put:(Character space).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4518
		dstIndex := dstIndex + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4519
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4520
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4521
	    tmpString at:dstIndex put:character.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4522
	    dstIndex := dstIndex + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4523
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4524
	(dstIndex > currentMax) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4525
	    "
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4526
	     this cannot happen with <= 8 tabs
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4527
	    "
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4528
	    currentMax := currentMax + currentMax.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4529
	    nString := line species new:currentMax.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4530
	    nString replaceFrom:1 to:(dstIndex - 1)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4531
			   with:tmpString startingAt:1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4532
	    tmpString := nString.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4533
	    nString := nil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4534
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4535
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4536
	"make stc-optimizer happy
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4537
	 - no need to return value of ifTrue:/ifFalse above"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4538
	0
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4539
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4540
    dstIndex := dstIndex - 1.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4541
    dstIndex == currentMax ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4542
	^ tmpString
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4543
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4544
    ^ tmpString copyTo:dstIndex
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4545
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4546
    "Modified: 23.2.1996 / 19:11:01 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4547
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4548
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4549
withTabsExpanded:line
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4550
    "expand tabs into spaces, return a new line string,
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4551
     or original line, if no tabs are included.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4552
     good idea, to make this one a primitive"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4553
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4554
    ^ self withTabs:tabPositions expand:line
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4555
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4556
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4557
!ListView::HighlightArea methodsFor:'accessing'!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4558
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4559
bgColor
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4560
    ^ bgColor
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4561
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4562
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4563
bgColor:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4564
    bgColor := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4565
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4566
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4567
endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4568
    ^ endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4569
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4570
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4571
endCol:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4572
    endCol := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4573
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4574
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4575
endLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4576
    ^ endLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4577
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4578
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4579
endLine:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4580
    endLine := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4581
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4582
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4583
fgColor
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4584
    ^ fgColor
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4585
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4586
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4587
fgColor:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4588
    fgColor := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4589
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4590
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4591
startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4592
    ^ startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4593
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4594
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4595
startCol:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4596
    startCol := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4597
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4598
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4599
startLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4600
    ^ startLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4601
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4602
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4603
startLine:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4604
    startLine := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4605
! !
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4606
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  4607
!ListView class methodsFor:'documentation'!
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4608
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4609
version
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4610
    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.336 2009-05-01 17:23:26 cg Exp $'
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4611
! !