ListView.st
author Claus Gittinger <cg@exept.de>
Tue, 29 Oct 2002 11:18:16 +0100
changeset 2649 0aaedfe83442
parent 2648 190351d07ce1
child 2654 a183d27e53a3
permissions -rw-r--r--
oops
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
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
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
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    13
"{ Package: 'stx:libwidg' }"
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    14
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    15
View subclass:#ListView
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    16
	instanceVariableNames:'list firstLineShown nFullLinesShown nLinesShown fgColor bgColor
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    17
		partialLines leftMargin topMargin textStartLeft textStartTop
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    18
		innerWidth tabPositions lineSpacing fontHeight fontAscent
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    19
		fontIsFixedWidth fontWidth autoScroll autoScrollBlock
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    20
		autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    21
		listMsg viewOrigin listChannel backgroundAlreadyClearedColor
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    22
		scrollWhenUpdating'
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    23
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    24
		UserDefaultTabPositions DefaultLeftMargin DefaultTopMargin'
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    25
	poolDictionaries:''
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    26
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    27
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    28
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
    29
!ListView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    30
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    31
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    32
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    33
 COPYRIGHT (c) 1989 by Claus Gittinger
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
    34
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    35
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    36
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    37
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    38
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    39
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    40
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    41
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    42
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    43
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    44
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    45
documentation
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    46
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    47
    a View for (string-)lists.
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
    This class can only passively display collections of strings-
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    50
    selections, editing, cursors etc. must be done in subclasses.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    51
    see SelectionInListView, TextView etc.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    52
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    53
    This code currently handles only fixed-height fonts correctly -
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    54
    should be rewritten in some places ...
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    55
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    56
    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
    57
    which should be changed to have this behavior optionally for smooth scroll.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    58
120
claus
parents: 118
diff changeset
    59
    The text is internally kept in the list instance variable, and is supposed to consist
claus
parents: 118
diff changeset
    60
    of a collection (Ordered- or StringCollection) of line entries.
claus
parents: 118
diff changeset
    61
    Typically, individual entries are either strings or nil (for empty lines).
claus
parents: 118
diff changeset
    62
    However, any object which supports the displayOn: and widthIn: protocol can be
claus
parents: 118
diff changeset
    63
    used - see MultipleColumnListEntry as an example.
claus
parents: 118
diff changeset
    64
    Therefore, ListView (and all subclasses) are prepared to handle non-string entries
claus
parents: 118
diff changeset
    65
    (especially: attributed Text).
claus
parents: 118
diff changeset
    66
claus
parents: 118
diff changeset
    67
    The internal version of the text has tabulators expanded to blanks - when text is exchanged
claus
parents: 118
diff changeset
    68
    with an external medium (i.e. reading/writing files), these are expanded/compressed assuming
claus
parents: 118
diff changeset
    69
    a tab-setting of 8. This is done independent of the users tab setting, which is used
claus
parents: 118
diff changeset
    70
    while the text is edited. Thus, even if the tab setting is multiple of 4's, tabs are
claus
parents: 118
diff changeset
    71
    written in multiples of 8 when the text is saved. Since this is the default on all ascii
claus
parents: 118
diff changeset
    72
    terminals and printers, this assures that the text looks correctly indented when finally printed.
claus
parents: 118
diff changeset
    73
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    74
    Notice:
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    75
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    76
    ListView is one of the oldest widget classes in the current system and
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    77
    definitely requires some rewrite:
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    78
120
claus
parents: 118
diff changeset
    79
    Due to historic reasons (ListView implemented scrolling before the general
claus
parents: 118
diff changeset
    80
    scrolling code in View was added), this one does scrolling different from all other
claus
parents: 118
diff changeset
    81
    views. The general scrolling code (in View) uses the transformation for transparent scrolling.
claus
parents: 118
diff changeset
    82
    Here, the transformation is not used, instead it is done again, by keeping the firstLineShown
claus
parents: 118
diff changeset
    83
    (i.e. vertical offset) and leftOffset (horizontal offset).
claus
parents: 118
diff changeset
    84
    The most annoying consequence of this is, that scrolling is done by lines here, 
claus
parents: 118
diff changeset
    85
    while its done in pixels in the View class. Thus, be careful, when changing things
claus
parents: 118
diff changeset
    86
    (better: dont touch it ;-)
claus
parents: 118
diff changeset
    87
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    88
    Also, all controller functionality is completely performed by the listView
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    89
    (and subclasses) itself. It is still possible, to define and set a specialized
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    90
    controller, though. I.e. if you like to change the input behavior, define
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    91
    a corresponding controller class and intersect the keyXXX/buttonXXX messages
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    92
    there.
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    93
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    94
    This will be totally rewritten ... so dont depend on the internals; especially the scrolling
120
claus
parents: 118
diff changeset
    95
    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
    96
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    97
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    98
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    99
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   100
      list                <aCollection>           the text strings, a collection of lines.
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   101
						  Nils may be used for empty lines.
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   102
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   103
      firstLineShown      <Number>                the index of the 1st visible line (1 ..)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   104
      leftOffset          <Number>                left offset for horizontal scroll
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   105
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   106
      nFullLinesShown     <Number>                the number of unclipped lines in visible area
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   107
						  (internal; updated on size changes)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   108
      nLinesShown         <Number>                the number of lines in visible area, incl. partial
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   109
						  (internal; updated on size changes)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   110
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   111
      fgColor             <Color>                 color to draw characters
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   112
      bgColor             <Color>                 the background
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   113
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   114
      partialLines        <Boolean>               allow last line to be partial displayed
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   115
      leftMargin          <Number>                margin at left in pixels
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   116
      topMargin           <Number>                margin at top in pixels
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   117
      textStartLeft       <Number>                margin + leftMargin (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   118
      textStartTop        <Number>                margin + topMargin (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   119
      innerWidth          <Number>                width - margins (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   120
      tabPositions        <aCollection>           tab stops (cols)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   121
      fontHeight          <Number>                font height in pixels (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   122
      fontAscent          <Number>                font ascent in pixels (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   123
      fontIsFixed         <Boolean>               true if its a fixed font (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   124
      fontWidth           <Number>                width of space (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   125
      lineSpacing         <Number>                pixels between lines
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   126
      lastSearchPattern   <String>                last pattern for searching 
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   127
						  (kept to provide a default for next search)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   128
      lastSearchIgnoredCase   <Boolean>           last search ignored case
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   129
						  (kept to provide a default for next search)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   130
      wordCheck           <Block>                 rule used for check for word boundaries in word select
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   131
						  The default rule is to return true for alphaNumeric characters.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   132
						  (can be changed to allow for underscore and other
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   133
						   characters to be treated as alphaCharacters)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   134
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   135
      autoScrollBlock     <Block>                 block installed as timeoutBlock when doing an
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   136
						  autoScroll (internal)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   137
      autoScrollDeltaT                            computed scroll time delta in seconds (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   138
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   139
      includesNonStrings                          cached flag if any non-strings are in list
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   140
      widthOfWidestLine                           cached width of widest line
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   141
      listMsg                                     if view has a model and listMsg is non-nil,
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   142
						  this is sent to the model to aquired a new contents
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   143
						  whenever a change of the aspect  (aspectMsg) occurs.
1325
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
      viewOrigin                                  the current origin 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   146
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   147
      backgroundAlreadyClearedColor               internal; speedup by avoiding
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   148
						  multiple fills when drawing
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   149
						  internal lines
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   150
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   151
      scrollWhenUpdating
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   152
				<Symbol>        defines how the view is scrolled if the
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   153
						model changes its value by some outside activity
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   154
						(i.e. not by user input).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   155
						Can be one of:
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   156
						    #keep / nil     -> stay unchanged
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   157
						    #endOfText      -> scroll to the end
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   158
						    #beginOfText    -> scroll to the top
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   159
						The default is #beginOfText (i.e. scroll to top).
120
claus
parents: 118
diff changeset
   160
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   161
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   162
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   163
      textForegroundColor                         defaults to Black
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   164
      textBackgroundColor                         defaults to White
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   165
      textFont                                    defaults to defaultFont
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   166
      textTabPositions                            defaults to #(1 9 17 25 ...)
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   167
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   168
    [author:]
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   169
	Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   170
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   171
    [see also:]
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   172
	TextView EditTextView
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   173
        
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   174
"
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   175
!
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   176
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   177
examples 
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   178
"
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   179
    ListViews alone are rarely used - its mostly an abstract superclass
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   180
    for TextView, EditTextView and SelectionInListView.
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   181
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   182
    anyway, here are a few examples:
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   183
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   184
     basic simple setup:
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   185
									[exBegin]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   186
	|top l|
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   187
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   188
	top := StandardSystemView new.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   189
	top extent:100@200.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   190
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   191
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   192
	l list:#('one' 'two' 'three').
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   193
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   194
	top open
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   195
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   196
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   197
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   198
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   199
      specifying textMargins (these have NOTHING to do with the viewInset):
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   200
									[exBegin]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   201
	|top l|
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   202
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   203
	top := StandardSystemView new.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   204
	top extent:100@200.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   205
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   206
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   207
	l list:#('one' 'two' 'three').
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   208
	l topMargin:10.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   209
	l leftMargin:20.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   210
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   211
	top open
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   212
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   213
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   214
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   215
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   216
      globally set the fg/bg colors:
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   217
									[exBegin]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   218
	|top l|
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   219
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   220
	top := StandardSystemView new.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   221
	top extent:100@200.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   222
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   223
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   224
	l list:#('one' 'two' 'three').
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   225
	l foregroundColor:(Color white).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   226
	l backgroundColor:(Color blue).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   227
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   228
	top open
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   229
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   230
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   231
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   232
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   233
      non-string (text) entries:
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   234
									[exBegin]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   235
	|top list l|
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   236
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   237
	top := StandardSystemView new.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   238
	top extent:100@200.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   239
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   240
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   241
	list := #('all' 'of' 'your' 'preferred' 'colors') 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   242
		with:#(red green blue 'orange' cyan)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   243
		collect:[:s :clr | 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   244
			    Text string:s 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   245
				 emphasis:(Array with:#bold
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   246
						 with:(#color->(Color name:clr))) ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   247
	l list:list.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   248
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   249
	top open
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   250
									[exEnd]
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   251
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   252
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   253
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   254
      generic non-string entries:
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   255
      (notice: ColoredListEntry is obsoleted by Text)
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   256
									[exBegin]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   257
	|top list l|
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   258
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   259
	top := StandardSystemView new.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   260
	top extent:100@200.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   261
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   262
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   263
	list := #('all' 'of' 'your' 'preferred' 'colors') 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   264
		with:#(red green blue 'orange' cyan)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   265
		collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   266
	l list:list.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   267
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   268
	top open
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   269
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   270
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   271
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   272
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   273
      using a model (default listMessage is aspectMessage):
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   274
									[exBegin]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   275
	|top model l theModelsText|
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   276
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   277
	model := Plug new.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   278
	model respondTo:#modelsAspect
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   279
		   with:[ theModelsText ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   280
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   281
	top := StandardSystemView new.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   282
	top extent:100@200.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   283
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   284
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   285
	l model:model.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   286
	l aspect:#modelsAspect.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   287
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   288
	top open.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   289
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   290
	Delay waitForSeconds:3.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   291
	theModelsText := #('foo' 'bar' 'baz').
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   292
	model changed:#modelsAspect.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   293
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   294
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   295
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   296
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   297
      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
   298
      for two listViews:
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   299
									[exBegin]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   300
	|top model l1 l2 plainText|
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   301
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   302
	plainText := #('').
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   303
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   304
	model := Plug new.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   305
	model respondTo:#modelsUppercaseText
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   306
		   with:[ plainText asStringCollection 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   307
			      collect:[:l | l asUppercase]].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   308
	model respondTo:#modelsLowercaseText
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   309
		   with:[ plainText asStringCollection 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   310
			      collect:[:l | l asLowercase]].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   311
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   312
	top := StandardSystemView extent:200@200.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   313
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   314
	l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   315
	l1 model:model.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   316
	l1 aspect:#modelsAspect.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   317
	l1 listMessage:#modelsUppercaseText.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   318
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   319
	l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   320
	l2 model:model.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   321
	l2 aspect:#modelsAspect.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   322
	l2 listMessage:#modelsLowercaseText.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   323
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   324
	top open.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   325
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   326
	Delay waitForSeconds:3.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   327
	plainText := #('foo' 'bar' 'baz').
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   328
	model changed:#modelsAspect.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   329
									[exEnd]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   330
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   331
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   332
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   333
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   334
!ListView class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   335
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   336
defaultTabPositions
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   337
    "return an array containing the styleSheets default tab positions"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   338
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   339
    ^ DefaultTabPositions ? self tab8Positions
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   340
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   341
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   342
defaultTabPositions:aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   343
    "set the array containing the styleSheets tab positions"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   344
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   345
    DefaultTabPositions := aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   346
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   347
    "
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   348
     self defaultTabPositions:(self tab4Positions)
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   349
    "
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   350
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   351
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   352
tab4Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   353
    "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
   354
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   355
    ^ #(1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   356
	85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145)
120
claus
parents: 118
diff changeset
   357
!
claus
parents: 118
diff changeset
   358
claus
parents: 118
diff changeset
   359
tab8Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   360
    "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
   361
120
claus
parents: 118
diff changeset
   362
    ^ #(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
   363
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   364
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   365
updateStyleCache
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   366
    "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
   367
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   368
    <resource: #style (#'text.foregroundColor' #'text.backgroundColor'
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   369
		       #'text.tabPositions'
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   370
		       #'text.font')>
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   371
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   372
    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   373
    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:White.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   374
    DefaultFont := StyleSheet fontAt:'text.font'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   375
    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
   376
    DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions].
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   377
    DefaultLeftMargin := 0.5.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   378
    DefaultTopMargin := 0.5.
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   379
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   380
    "Modified: 20.10.1997 / 15:05:30 / cg"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   381
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   382
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   383
userDefaultTabPositions
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   384
    "return an array containing the users default tab positions"
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
    ^ UserDefaultTabPositions
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   387
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   388
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   389
userDefaultTabPositions:aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   390
    "set the array containing the users tab positions"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   391
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   392
    UserDefaultTabPositions := aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   393
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   394
    "
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   395
     self userDefaultTabPositions:(self tab4Positions)
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   396
    "
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
   397
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   398
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   399
!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
   400
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   401
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
   402
    "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
   403
     - 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
   404
     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
   405
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   406
    ^ 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
   407
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   408
339
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   409
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
   410
    "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
   411
     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
   412
     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
   413
     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
   414
     (national) characters.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   415
     Applications may change it to include underlines, dollars or other characters. 
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   416
     (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
   417
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   418
    wordCheck := aBlock.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   419
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   420
    "Modified: 22.5.1996 / 12:26:55 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   421
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   422
2133
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
   423
!ListView methodsFor:'accessing-behavior'!
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   424
2325
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   425
scrollWhenUpdating
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   426
    "return the scroll behavior, when I get a new text 
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   427
     (via the model or the #contents/#list)
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   428
     Possible returnValues are:
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   429
	#keep / nil     -> no change
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   430
	#endOfText      -> scroll to the end
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   431
	#beginOfText    -> scroll to the top
2325
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   432
     The default is #beginOfText.
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   433
     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
   434
     the program (i.e. not from the user)"
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   435
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   436
    ^ scrollWhenUpdating
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   437
!
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   438
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   439
scrollWhenUpdating:aSymbolOrNil
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   440
    "define how to scroll, when I get a new text 
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   441
     (via the model or the #contents/#list)
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   442
     Allowed arguments are:
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   443
	#keep / nil     -> no change
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   444
	#endOfText      -> scroll to the end
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   445
	#beginOfText    -> scroll to the top
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   446
     The default is #beginOfText.
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   447
     This may be useful for fields which get new values assigned from
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   448
     the program (i.e. not from the user)"
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   449
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   450
    scrollWhenUpdating := aSymbolOrNil
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   451
! !
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   452
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   453
!ListView methodsFor:'accessing-contents'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   454
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
   455
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
   456
    "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
   457
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   458
    |fontHeightBefore|
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   459
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
   460
    list add:aString.
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   461
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
   462
    includesNonStrings ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   463
	includesNonStrings := (aString notNil and:[aString isString not]).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   464
	includesNonStrings ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   465
	    fontHeightBefore := fontHeight.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   466
	    self getFontParameters.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   467
	    fontHeightBefore ~~ fontHeight ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   468
		self invalidate
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   469
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   470
	].
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
   471
    ].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   472
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   473
    widthOfWidestLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   474
	self recomputeWidthOfWidestLineFor:aString
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   475
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   476
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
   477
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   478
	self redrawLine:(self size).
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   479
    ].
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   480
    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
   481
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   482
    "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
   483
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   484
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   485
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
   486
    "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
   487
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   488
    |lastShown|
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   489
1351
03d1b138f98f add:aString beforeIndex:
ca
parents: 1338
diff changeset
   490
    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
   491
    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
   492
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   493
    widthOfWidestLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   494
	self recomputeWidthOfWidestLineFor:aString
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   495
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   496
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
   497
    includesNonStrings ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   498
	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
   499
"/        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
   500
    ].
75b8fb924904 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
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   502
	lastShown := self lastLineShown.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   503
	index <= 2 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   504
	    self invalidate
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   505
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   506
	    index to:lastShown do:[:eachLine |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   507
		self invalidateLine:eachLine
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   508
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   509
	].
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   510
    ].
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   511
    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
   512
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   513
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   514
	"/ self selection isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   515
	    self scrollToBottom.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   516
	"/ ]
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   517
    ].
65
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   518
!
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   519
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   520
addAll:aCollectionOfLines beforeIndex:index
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   521
    "add a bunch of lines and redisplay"
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   522
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   523
    |lastShown|
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   524
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   525
    list isNil ifTrue:[list := OrderedCollection new].
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   526
    aCollectionOfLines do:[:eachLine |
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   527
	list addAll:aCollectionOfLines beforeIndex:index.
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   528
    ].
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   529
    includesNonStrings ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   530
	aCollectionOfLines do:[:eachLine |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   531
	    includesNonStrings := includesNonStrings or:[(eachLine notNil and:[eachLine isString not])].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   532
	]
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   533
    ].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   534
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   535
    widthOfWidestLine := nil. "/ i.e. unknown
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   536
    self textChanged.
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   537
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   538
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   539
	lastShown := self lastLineShown.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   540
	((index-1) <= lastShown) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   541
	    index <= 2 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   542
		self invalidate
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   543
	    ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   544
		index-1 to:lastShown do:[:eachLine |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   545
		    self invalidateLine:eachLine
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   546
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   547
		"/  self redrawFromLine:index-1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   548
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   549
	].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   550
    ].
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   551
    self contentsChanged.             "recompute scrollbars"
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   552
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   553
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   554
	"/ self selection isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   555
	    self scrollToBottom.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   556
	"/ ]
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   557
    ].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   558
!
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   559
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   560
at:lineNr
120
claus
parents: 118
diff changeset
   561
    "retrieve a line; return nil if beyond end-of-text.
claus
parents: 118
diff changeset
   562
     this allows textViews to be used like collections in some places."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   563
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   564
    list isNil ifTrue:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   565
    (lineNr between:1 and:self size) ifFalse:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   566
    ^ list at:lineNr
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   567
!
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   568
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   569
at:index put:aString
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   570
    "change a line and redisplay"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   571
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   572
    |fontHeightBefore widthBefore|
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   573
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   574
    fontHeightBefore := fontHeight.
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   575
    widthBefore := widthOfWidestLine.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   576
    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
   577
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   578
    shown ifTrue:[
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   579
        fontHeightBefore ~= fontHeight ifTrue:[
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   580
            "/ must redraw everything
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   581
            self invalidate.
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   582
            ^ self
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   583
        ].
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   584
        self redrawLine:index.
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   585
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   586
"/ 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
   587
"/ 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
   588
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   589
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   590
"/        "/ this could have changed the font height;
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   591
"/        "/ 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
   592
"/        fontHeightBefore > fontHeight ifTrue:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   593
"/            (self listLineIsVisible:(self size)) ifTrue:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   594
"/                self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1))
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   595
"/                                    corner:(width-margin) @ (height-margin).
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   596
"/            ].
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   597
"/            self redrawFromLine:index
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   598
"/        ] ifFalse:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   599
"/            self redrawLine:index
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   600
"/        ].
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   601
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   602
        "/ asynchronous:
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   603
"/        visibleLine := self listLineToVisibleLine:index.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   604
"/        visibleLine notNil ifTrue:[
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   605
"/            y := self yOfVisibleLine:visibleLine.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   606
"/            self invalidate:((margin @ y) extent:(width@fontHeight))
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   607
"/        ].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   608
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   609
        widthBefore ~~ widthOfWidestLine ifTrue:[
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   610
            self contentsChanged
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   611
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   612
    ]
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   613
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   614
    "Modified: / 26.7.1998 / 13:36:33 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   615
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   616
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   617
characterAtCharacterPosition:charPos
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   618
    "return the character at a 1-based character position. 
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   619
     Return a space character if nothing is there
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   620
     (i.e. behond the end of the line or below the last line)"
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   621
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   622
    |line col|
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   623
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   624
    line := self lineOfCharacterPosition:charPos.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   625
    col := charPos - (self characterPositionOfLine:line col:1) + 1.
2443
9a1258c6dcbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
   626
    col == 0 ifTrue:[^ Character cr].
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   627
    ^ self characterAtLine:line col:col
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   628
!
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   629
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   630
characterAtLine:lineNr col:colNr
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   631
    "return the character at physical line/col. 
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   632
     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
   633
     Return a space character if nothing is there
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   634
     (i.e. behond the end of the line or below the last line)"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   635
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   636
    |line|
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   637
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   638
    list notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   639
	line := self listAt:lineNr.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   640
	line notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   641
	    (line size >= colNr) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   642
		^ line at:colNr
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   643
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   644
	]
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   645
    ].
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   646
    ^ Character space
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   647
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   648
    "Created: 29.4.1996 / 12:11:00 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   649
    "Modified: 29.4.1996 / 12:12:41 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   650
!
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   651
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
   652
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
   653
    "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
   654
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   655
    list isNil 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
   656
    ^ list asStringCollection asString
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   657
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   658
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   659
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
   660
    "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
   661
     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
   662
     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
   663
     to a collection of line-strings here."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   664
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   665
    |l|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   666
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   667
    l := something.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   668
    l notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   669
	l isString ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   670
	    l := l asStringCollection
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   671
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   672
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   673
    self list:l
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   674
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   675
    "Modified: 5.6.1997 / 11:11:54 / cg"
51
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   676
!
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   677
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
   678
from:from to:to do:aBlock
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   679
    "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
   680
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   681
    ^ list from:from to:to do:aBlock.
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   682
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   683
    "Modified: 18.5.1996 / 14:02:14 / 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
   684
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   685
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   686
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
   687
    "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
   688
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   689
    ^ 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
   690
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   691
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   692
lineAtY:y
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   693
    "return the lineNr for a given y-(view-)coordinate"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   694
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   695
    |visibleLine|
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   696
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   697
    visibleLine := self visibleLineOfY:y.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   698
    visibleLine isNil ifTrue:[^ nil].
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   699
    ^ self visibleLineToListLine:visibleLine.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   700
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   701
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
   702
list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   703
    "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
   704
     This returns the views internal list - modifying it may confuse
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   705
     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
   706
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   707
    ^ list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   708
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   709
    "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
   710
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   711
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   712
list:aCollection
128
claus
parents: 127
diff changeset
   713
    "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
   714
     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
   715
     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
   716
     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
   717
     The passed list is scanned for nonStrings 
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   718
     (remembered to optimize later redraws)."
128
claus
parents: 127
diff changeset
   719
claus
parents: 127
diff changeset
   720
    self list:aCollection expandTabs:true
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   721
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   722
    "Modified: 5.6.1997 / 11:10:45 / cg"
128
claus
parents: 127
diff changeset
   723
!
claus
parents: 127
diff changeset
   724
claus
parents: 127
diff changeset
   725
list:aCollection expandTabs:expand
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   726
    "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
   727
     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
   728
     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
   729
     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
   730
     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
   731
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   732
    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
   733
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   734
    "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
   735
!
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   736
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   737
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
   738
    "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
   739
     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
   740
     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
   741
     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
   742
     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
   743
     (remembered to optimize later redraws)."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   744
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   745
    self
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   746
	list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   747
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   748
    "Modified: 5.6.1997 / 12:40:35 / cg"
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   749
!
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   750
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   751
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
   752
    "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
   753
     and scroll as specified in scrollWhenUpdating (default:top-left).
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   754
     If expand is true, tabs are expanded (to spaces).
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   755
     If scan is true, scan the passed list for nonStrings; 
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   756
     otherwise, take the information from the nonStrings arg.
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   757
     (the nonStrings information is remembered to optimize later redraws & height computations)."
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   758
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   759
    |oldFirst oldLeft nonStringsBefore fontHeightBefore
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   760
     scrollToEnd scrollToTop newLeftOffset wText|
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   761
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   762
    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
   763
    scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   764
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   765
    (aCollection isNil and:[list isNil]) ifTrue:[
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   766
        "no contents change"
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   767
        scrollToTop ifTrue:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   768
            self scrollToTop.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   769
        ] ifFalse:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   770
            scrollToEnd ifTrue:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   771
                self scrollToBottom.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   772
            ]
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   773
        ].
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   774
        self scrollToLeft.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   775
        ^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   776
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   777
    list := aCollection.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   778
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   779
    nonStringsBefore := includesNonStrings.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   780
    fontHeightBefore := fontHeight.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   781
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   782
152
claus
parents: 148
diff changeset
   783
    list notNil ifTrue:[
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   784
        expand ifTrue:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   785
            self expandTabs
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   786
        ] ifFalse:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   787
            scan ifTrue:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   788
                includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   789
            ] ifFalse:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   790
                includesNonStrings := nonStrings
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   791
            ]
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   792
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   793
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   794
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   795
        self getFontParameters.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   796
    ].
152
claus
parents: 148
diff changeset
   797
125
claus
parents: 121
diff changeset
   798
    widthOfWidestLine := nil.   "/ i.e. unknown
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   799
    oldFirst := firstLineShown.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   800
    oldLeft := viewOrigin x.
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   801
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   802
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   803
        self computeNumberOfLinesShown.
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   804
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   805
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   806
    newLeftOffset := viewOrigin x.
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   807
    scrollToTop ifTrue:[
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   808
        firstLineShown := 1.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   809
        newLeftOffset := 0.
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   810
    ] ifFalse:[
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   811
        scrollToEnd ifTrue:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   812
            firstLineShown := (list size - nFullLinesShown + 1) max:1.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   813
            newLeftOffset := 0.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   814
        ]
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   815
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   816
    newLeftOffset > 0 ifTrue:[
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   817
        wText := self widthOfContents.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   818
        (viewOrigin x + self innerWidth) > wText ifTrue:[
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
   819
            newLeftOffset := (wText - self innerWidth) max:0.
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   820
        ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   821
    ].
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   822
    newLeftOffset ~= oldLeft ifTrue:[ 
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   823
        viewOrigin := newLeftOffset @ viewOrigin y.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
   824
    ].
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   825
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   826
    realized ifTrue:[
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   827
        self contentsChanged.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   828
        "
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   829
         dont use scroll here to avoid double redraw
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   830
        "
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   831
        viewOrigin := viewOrigin ifNil:[0@0] ifNotNil:[(viewOrigin x) @ 0].
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   832
        transformation := nil.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   833
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   834
        oldFirst ~~ firstLineShown ifTrue:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   835
            self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   836
        ].
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   837
        shown ifTrue:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   838
            self redrawFromVisibleLine:1 to:nLinesShown.
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   839
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   840
            fontHeightBefore > fontHeight ifTrue:[
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   841
                (self listLineIsVisible:(self size)) ifTrue:[
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   842
"/                    self clearRectangle:((margin @ (self yOfVisibleLine:nLinesShown+1))
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   843
"/                                        corner:(width-margin) @ (height-margin)).
2431
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   844
                ].
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   845
            ]
be43e0e40cce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2430
diff changeset
   846
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   847
    ]
153
claus
parents: 152
diff changeset
   848
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   849
    "Modified: / 30.8.1995 / 19:07:13 / claus"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   850
    "Created: / 5.6.1997 / 12:40:06 / cg"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   851
    "Modified: / 26.7.1998 / 13:47:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   852
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   853
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   854
removeFromIndex:startLineNr toIndex:endLineNr
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   855
    "delete some lines"
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   856
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   857
    |nLines|
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   858
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   859
    list isNil ifTrue:[^ self].
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   860
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   861
    list removeFromIndex:startLineNr toIndex:(endLineNr min:list size).
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   862
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   863
    widthOfWidestLine := nil. "/ i.e. unknown
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   864
    self textChanged.
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   865
2237
43f0318a830e scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents: 2233
diff changeset
   866
    ((startLineNr <= self lastLineShown)
43f0318a830e scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents: 2233
diff changeset
   867
    and:[endLineNr >= firstLineShown]) ifTrue:[
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   868
        startLineNr to:self lastLineShown do:[:eachLine |
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   869
            self invalidateLine:eachLine
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   870
        ].
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   871
    ].
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   872
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   873
    nLines := list size.
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   874
    (firstLineShown >= nLines) ifTrue:[
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   875
        self makeLineVisible:nLines
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   876
    ].
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   877
    self contentsChanged.
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   878
!
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
   879
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
   880
removeIndex:lineNr
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   881
    "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
   882
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
   883
    |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
   884
     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
   885
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   886
    (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
   887
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
   888
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   889
     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
   890
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   891
    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
   892
    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
   893
    visLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   894
	w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
1433
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   895
"/        x := textStartLeft.
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   896
"/ CLAUS fixes leftOver selection pixels
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   897
	w := w + leftMargin.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   898
	x := margin.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   899
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   900
	srcY := topMargin + (visLine * fontHeight).
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
   901
"/        h := ((nLinesShown - visLine) * fontHeight).
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   902
	h := (height - margin - srcY).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   903
	h > 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   904
	    self catchExpose.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   905
	    self 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   906
		copyFrom:self 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   907
		x:x y:srcY
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   908
		toX:x y:(srcY - fontHeight)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   909
		width:w height:h
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   910
		async:true.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   911
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   912
	self redrawVisibleLine:nFullLinesShown.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   913
	"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   914
	 redraw last partial line - if any
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   915
	"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   916
	(nFullLinesShown ~~ nLinesShown) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   917
	    self redrawVisibleLine:nLinesShown
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   918
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   919
	h > 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   920
	    self waitForExpose
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   921
	].
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
   922
    ]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   923
1460
b9929a029249 dont bitBlt if height is <= 0
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   924
    "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
   925
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   926
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   927
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
   928
    "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
   929
     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
   930
     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
   931
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   932
    (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
   933
    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
   934
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   935
    lineNr < firstLineShown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   936
	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
   937
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   938
    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
   939
    ^ 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
   940
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   941
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   942
replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   943
    "replace some lines"
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   944
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   945
    list replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex.
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   946
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   947
    widthOfWidestLine := nil. "/ i.e. unknown
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   948
    self textChanged.
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   949
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   950
    ((startLineNr <= self lastLineShown)
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   951
    and:[endLineNr >= firstLineShown]) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   952
	self invalidate.
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   953
    ].
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   954
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   955
    self contentsChanged.
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   956
!
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
   957
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
   958
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
   959
    "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
   960
     dont change position (i.e. do not 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
   961
     This can be used to update a self-changing 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
   962
     (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
   963
     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
   964
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   965
    |l oldSize|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   966
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   967
    oldSize := 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
   968
    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
   969
    l notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   970
	l isString ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   971
	    l := l asStringCollection
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
   972
	]
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
   973
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   974
    self setList:l.
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   975
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   976
    "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
   977
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   978
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   979
setList:aCollection
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   980
    "set the contents (a collection of strings);
153
claus
parents: 152
diff changeset
   981
     do not change position (i.e. do not scroll).
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   982
     This can be used to update a self-changing list 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   983
     (for example: a file list being shown, without disturbing user too much)"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   984
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   985
    ^ self setList:aCollection expandTabs:true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   986
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   987
153
claus
parents: 152
diff changeset
   988
setList:aCollection expandTabs:expandTabs
claus
parents: 152
diff changeset
   989
    "set the contents (a collection of strings);
claus
parents: 152
diff changeset
   990
     do not change position (i.e. do not scroll).
claus
parents: 152
diff changeset
   991
     This can be used to update a self-changing list 
claus
parents: 152
diff changeset
   992
     (for example: a file list being shown, without disturbing the user too much)"
claus
parents: 152
diff changeset
   993
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   994
    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
   995
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   996
    "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
   997
!
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   998
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   999
setList:aCollection expandTabs:expandTabs redraw:doRedraw
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1000
    "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
  1001
     do not change position (i.e. do not scroll).
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1002
     This can be used to update a self-changing list 
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1003
     (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
  1004
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1005
    |oldFirst nonStringsBefore linesShownBefore|
153
claus
parents: 152
diff changeset
  1006
claus
parents: 152
diff changeset
  1007
    (aCollection isNil and:[list isNil]) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1008
	"no change"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1009
	^ self
153
claus
parents: 152
diff changeset
  1010
    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1011
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1012
"/    list isNil ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1013
"/        linesShownBefore := (1 to:nLinesShown) collect:[:i | ''].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1014
"/    ] ifFalse:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1015
"/        linesShownBefore := (firstLineShown to:(firstLineShown+nLinesShown-1))
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1016
"/                            collect:[:i | (self at:i) ? ''].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1017
"/    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1018
153
claus
parents: 152
diff changeset
  1019
    list := aCollection.
claus
parents: 152
diff changeset
  1020
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1021
    nonStringsBefore := includesNonStrings.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1022
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1023
153
claus
parents: 152
diff changeset
  1024
    list notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1025
	expandTabs ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1026
	    self expandTabs
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1027
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1028
	    includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1029
	].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1030
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1031
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1032
	self getFontParameters.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1033
	self computeNumberOfLinesShown.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1034
    ].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1035
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1036
"/ new - reposition horizontally if too big
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1037
    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
  1038
    innerWidth >= self widthOfContents ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1039
	viewOrigin := 0 @ viewOrigin y.
153
claus
parents: 152
diff changeset
  1040
    ].
claus
parents: 152
diff changeset
  1041
    self contentsChanged.
claus
parents: 152
diff changeset
  1042
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1043
"/ new - reposition vertically if too big
153
claus
parents: 152
diff changeset
  1044
    (firstLineShown + nFullLinesShown) > self size ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1045
	oldFirst := firstLineShown.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1046
	firstLineShown := self size - nFullLinesShown + 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1047
	firstLineShown < 1 ifTrue:[firstLineShown := 1].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1048
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1049
	viewOrigin y:(firstLineShown - 1 * fontHeight).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1050
	self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1051
	linesShownBefore := nil.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1052
	shown ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1053
	    self clear.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1054
	]
153
claus
parents: 152
diff changeset
  1055
    ].
claus
parents: 152
diff changeset
  1056
"/ end new
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1057
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1058
    (shown and:[doRedraw]) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1059
	  self redrawFromVisibleLine:1 to:nLinesShown
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1060
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1061
"/        linesShownBefore isNil ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1062
"/            self redrawFromVisibleLine:1 to:nLinesShown
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1063
"/        ] ifFalse:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1064
"/            1 to:nLinesShown do:[:l |
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1065
"/                |oldLine newLine|
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1066
"/
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1067
"/                newLine := self visibleAt:l.
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1068
"/                newLine size == 0 ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1069
"/                    newLine := ''
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1070
"/                ].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1071
"/                oldLine := linesShownBefore at:l ifAbsent:nil.
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1072
"/                oldLine size == 0 ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1073
"/                    oldLine := ''
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1074
"/                ].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1075
"/                oldLine ~= newLine ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1076
"/                    self redrawVisibleLine:l
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1077
"/                ]
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1078
"/            ]
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1079
"/        ]
153
claus
parents: 152
diff changeset
  1080
    ]
claus
parents: 152
diff changeset
  1081
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1082
    "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
  1083
    "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
  1084
    "Modified: / 26.7.1998 / 13:46:49 / cg"
153
claus
parents: 152
diff changeset
  1085
!
claus
parents: 152
diff changeset
  1086
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
  1087
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
  1088
    "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
  1089
     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
  1090
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1091
    ^ list size.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1092
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1093
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1094
stringAtLine:lineNr from:col1 to:col2
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1095
    "return the substring starting at physical line/col1, up-to and
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1096
     including col2. 
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1097
     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
  1098
     Fills the string with space characters at the right.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1099
     (i.e. behond the end of the line or below the last line)"
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1100
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1101
    |line len s|
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1102
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1103
    len := col2 - col1 + 1.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1104
    list notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1105
	line := self listAt:lineNr.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1106
	line notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1107
	    (line size >= col1) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1108
		s := line copyFrom:col1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1109
		s size < len ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1110
		    ^ s paddedTo:len
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1111
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1112
		^ s copyTo:len
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1113
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1114
	]
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1115
    ].
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1116
    ^ String new:len withAll:Character space
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1117
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1118
    "Created: 7.1.1997 / 19:58:43 / cg"
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1119
!
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1120
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1121
textFromCharacterPosition:charPos1 to:charPos2
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1122
    "return some text as a collection of (line-)strings."
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1123
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1124
    |line1 col1 line2 col2|
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1125
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1126
    line1 := self lineOfCharacterPosition:charPos1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1127
    col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1128
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1129
    line2 := self lineOfCharacterPosition:charPos2.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1130
    col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1131
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1132
    ^ self textFromLine:line1 col:col1 toLine:line2 col:col2.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1133
!
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1134
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1135
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
  1136
    "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
  1137
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1138
    |text sz index last|
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1139
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1140
    (startLine == endLine) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1141
	"part of a line"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1142
	^ StringCollection with:(self listAt:startLine
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1143
					from:startCol
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1144
					  to:endCol)
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1145
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1146
    sz := endLine - startLine + 1.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1147
    text := StringCollection new:sz.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1148
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1149
    "get 1st and last (possibly) partial lines"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1150
    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
  1151
    endCol == 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1152
	last := ''
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1153
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1154
	last := self listAt:endLine to:endCol.
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1155
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1156
    text at:sz put:last.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1157
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1158
    "get bulk of text"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1159
    index := 2.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1160
    (startLine + 1) to:(endLine - 1) do:[:lineNr |
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1161
	text at:index put:(self listAt:lineNr).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1162
	index := index + 1
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1163
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1164
    ^ text
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1165
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1166
    "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
  1167
!
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1168
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
  1169
withoutRedrawAt:index put:aString
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1170
    "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
  1171
     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
  1172
     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
  1173
     means at the end."
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1174
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1175
    |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
  1176
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1177
    self checkForExistingLine:index.
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1178
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1179
    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
  1180
    list at:index put:aString.
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1181
    oldLine ~= aString ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1182
	self textChanged
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1183
    ].
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1184
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1185
    didIncludeNonStrings := includesNonStrings.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1186
    includesNonStrings ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1187
	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
  1188
    ] ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1189
	(aString isNil or:[aString isString]) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1190
	    includesNonStrings := (list findFirst:[:l | l notNil and:[l isString not]]) ~~ 0.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1191
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1192
    ].
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1193
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1194
    includesNonStrings ~~ didIncludeNonStrings ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1195
	self getFontParameters.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1196
	self computeNumberOfLinesShown
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1197
    ].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1198
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
  1199
    widthOfWidestLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1200
	self recomputeWidthOfWidestLineFor:aString
1963
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1201
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1202
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1203
    "Modified: / 26.7.1998 / 13:00:14 / cg"
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1204
!
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1205
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1206
xxxaddAll:aCollectionOfLines beforeIndex:index
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1207
    "add a line and redisplay"
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1208
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1209
    list isNil ifTrue:[list := OrderedCollection new].
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1210
    aCollectionOfLines do:[:eachLine |
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1211
	list addAll:aCollectionOfLines beforeIndex:index.
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1212
    ].
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1213
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1214
    widthOfWidestLine := nil. "/ i.e. unknown
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1215
    self textChanged.
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1216
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1217
    ((index-1) <= self lastLineShown) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1218
	self redrawFromLine:index-1.
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1219
    ].
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1220
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  1221
    self contentsChanged.             "recompute scrollbars"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1222
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1223
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1224
!ListView methodsFor:'accessing-look'!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1225
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1226
backgroundColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1227
    "return the background color"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1228
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1229
    ^ bgColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1230
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1231
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1232
backgroundColor:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1233
    "set the background color of the contents"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1234
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1235
    bgColor ~~ aColor ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1236
	bgColor := aColor.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1237
	self viewBackground:bgColor.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1238
	shown ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1239
	    self invalidate "/ clear; redraw
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1240
	]
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1241
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1242
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1243
    "Modified: 3.5.1997 / 10:27:40 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1244
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1245
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1246
font:aFont
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1247
    "set the font for all shown text.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1248
     Redraws everything.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1249
     CAVEAT: with the addition of Text objects,
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1250
	     this method is going to be obsoleted by a textStyle
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1251
	     method, which allows specific control over
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1252
	     normalFont/boldFont/italicFont parameters."
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1253
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1254
    aFont isNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1255
	^ self error:'nil font' mayProceed:true
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1256
    ].
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1257
    font ~~ aFont ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1258
	super font:(aFont onDevice:device).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1259
	preferredExtent := nil.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1260
	widthOfWidestLine := nil. "/ i.e. unknown
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1261
	self getFontParameters.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1262
	realized ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1263
	    (font graphicsDevice == device) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1264
		self getFontParameters.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1265
		self computeNumberOfLinesShown.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1266
		shown ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1267
		    self redrawFromVisibleLine:1 to:nLinesShown
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1268
		]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1269
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1270
	    self contentsChanged
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1271
	]
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1272
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1273
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1274
    "Modified: 5.7.1996 / 17:55:34 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1275
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1276
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1277
fontHeight:pixels
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1278
    "set the lines height - thats the number of pixels,
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1279
     by which lines are vertically separated."
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1280
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1281
    fontHeight ~~ pixels ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1282
	fontHeight := pixels.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1283
    ]
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
    "Created: 17.4.1997 / 01:41:33 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1286
!
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
foregroundColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1289
    "return the foreground color"
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
    ^ fgColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1292
!
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
foregroundColor:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1295
    "set the foreground color"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1296
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1297
    fgColor ~~ aColor ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1298
	fgColor := aColor.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1299
	shown ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1300
	    self invalidate 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1301
	]
2455
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
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1304
    "Modified: 29.5.1996 / 16:19:02 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1305
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1306
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1307
foregroundColor:color1 backgroundColor:color2
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1308
    "set both foreground and background colors"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1309
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1310
    ((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1311
	fgColor := color1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1312
	bgColor := color2.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1313
	shown ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1314
	    self invalidate 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1315
	]
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1316
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1317
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1318
    "Modified: 29.5.1996 / 16:19:05 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1319
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1320
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1321
innerHorizontalMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1322
    "return the margin between the left border and the 1st col"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1323
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1324
    ^ leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1325
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1326
    "Created: 16.1.1996 / 19:28:23 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1327
!
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
innerVerticalMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1330
    "return the margin between the top border and the 1st line"
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
    ^ topMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1333
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1334
    "Created: 16.1.1996 / 19:28:00 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1335
!
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
leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1338
    "return the margin to left of 1st col"
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
    ^ leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1341
!
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
leftMargin:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1344
    "set the margin between the left border and the 1st col"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1345
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1346
    leftMargin := aNumber.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1347
    textStartLeft := aNumber + margin.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1348
    innerWidth := width - aNumber - margin
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
    "Modified: 28.2.1996 / 19:32:55 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1351
!
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
level:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1354
    "set the 3D level - caught here to update text-position variables
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1355
     (which avoids many computations later)"
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
    |newMargin|
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1358
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1359
    aNumber ~~ level ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1360
	newMargin := aNumber abs.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1361
	textStartLeft := leftMargin + newMargin.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1362
	textStartTop := topMargin + newMargin.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1363
	innerWidth := width - textStartLeft - newMargin.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1364
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1365
	super level:aNumber.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1366
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1367
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1368
    "Modified: 11.8.1997 / 02:59:15 / cg"
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
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1371
lineSpacing:pixels
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1372
    "set the lineSpacing - thats an additional number of pixels,
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1373
     by which lines are vertically separated."
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1374
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1375
    lineSpacing ~~ pixels ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1376
	lineSpacing := pixels.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1377
	self getFontParameters.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1378
    ]
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
    "Modified: 22.5.1996 / 12:22:29 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1381
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1382
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1383
partialLines:aBoolean
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1384
    "allow/disallow display of a last partial line"
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
    partialLines := aBoolean.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1387
    self computeNumberOfLinesShown
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
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1390
topMargin:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1391
    "set the margin between the top border and the 1st line"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1392
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1393
    topMargin := aNumber.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1394
    textStartTop := topMargin + margin.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1395
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1396
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1397
viewBackground:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1398
    super viewBackground:aColor.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1399
    self isTextView ifFalse:[
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1400
        self backgroundColor:aColor
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
! !
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1403
118
claus
parents: 116
diff changeset
  1404
!ListView methodsFor:'accessing-mvc'!
claus
parents: 116
diff changeset
  1405
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
  1406
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
  1407
    "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
  1408
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1409
    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
  1410
    aDictionary at:#listMessage put:listMsg
118
claus
parents: 116
diff changeset
  1411
!
claus
parents: 116
diff changeset
  1412
125
claus
parents: 121
diff changeset
  1413
listMessage 
claus
parents: 121
diff changeset
  1414
    "return the listMsg selector; 
claus
parents: 121
diff changeset
  1415
     if non-nil, this is the message sent to the model (if any) to aquire
claus
parents: 121
diff changeset
  1416
     a new text upon change of the aspect.
120
claus
parents: 118
diff changeset
  1417
     This defaults to the aspect-selector."
118
claus
parents: 116
diff changeset
  1418
125
claus
parents: 121
diff changeset
  1419
    ^ listMsg
claus
parents: 121
diff changeset
  1420
!
claus
parents: 121
diff changeset
  1421
claus
parents: 121
diff changeset
  1422
listMessage:aSymbol 
claus
parents: 121
diff changeset
  1423
    "ST-80 compatibility: set the listMsg selector; 
claus
parents: 121
diff changeset
  1424
     if non-nil, this will be sent to the model (if any) to aquire a 
claus
parents: 121
diff changeset
  1425
     new text upon change of the aspect.
claus
parents: 121
diff changeset
  1426
     This defaults to the aspect-selector."
claus
parents: 121
diff changeset
  1427
claus
parents: 121
diff changeset
  1428
    listMsg := aSymbol.
120
claus
parents: 118
diff changeset
  1429
!
claus
parents: 118
diff changeset
  1430
907
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1431
model:aModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1432
    "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
  1433
     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
  1434
     changes."
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1435
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1436
    super model:aModel.
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1437
    self getListFromModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1438
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1439
    "Created: 31.12.1996 / 14:56:43 / stefan"
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1440
!
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1441
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
  1442
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
  1443
    "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
  1444
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1445
    ^ self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:nil 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1446
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1447
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
  1448
on:aModel aspect:aspectSymbol change: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
  1449
    "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
  1450
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1451
    ^self on:aModel aspect:aspectSymbol change:changeSymbol list:aspectSymbol menu:nil 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1452
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1453
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
  1454
on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol 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
  1455
    "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
  1456
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1457
    aspectSymbol notNil ifTrue:[aspectMsg := aspectSymbol. 
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1458
			     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
  1459
    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
  1460
    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
  1461
    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
  1462
    self model:aModel.
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1463
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1464
    "Modified: 2.1.1997 / 16:11:16 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1465
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1466
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
  1467
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
  1468
    "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
  1469
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1470
    ^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1471
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1472
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
  1473
on:aModel aspect:aspectSymbol list:listSymbol 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
  1474
    "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
  1475
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1476
    ^ self on:aModel aspect:aspectSymbol change:nil list:listSymbol menu:menuSymbol 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1477
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1478
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
  1479
on:aModel aspect:aspectSymbol 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
  1480
    "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
  1481
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1482
    ^self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol 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
  1483
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1484
2227
58426f7611f2 category changes
Claus Gittinger <cg@exept.de>
parents: 2225
diff changeset
  1485
!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
  1486
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1487
update:something with:aParameter from:changedObject
2322
7d8f3c26a047 react to list-change messages
martin
parents: 2316
diff changeset
  1488
    |idx|
7d8f3c26a047 react to list-change messages
martin
parents: 2316
diff changeset
  1489
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
  1490
    changedObject == model ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1491
	model isList ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1492
	    list ~~ model ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1493
		something == #at: ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1494
		    idx := aParameter isCollection ifTrue:[aParameter at:1]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1495
						  ifFalse:[aParameter].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1496
		    ^ self at:aParameter put:(model at:idx).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1497
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1498
		something == #insert: ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1499
		    (list size + 1) >= aParameter ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1500
			^ self add:(model at:aParameter) beforeIndex:aParameter
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1501
		    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1502
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1503
		something == #remove: ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1504
		    list size >= aParameter ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1505
			^ self removeIndex:aParameter
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1506
		    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1507
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1508
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1509
	    ^ self getListFromModel.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1510
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1511
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1512
	(aspectMsg notNil
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1513
	and:[something == aspectMsg]) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1514
	    ^ self getListFromModel.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1515
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1516
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1517
	something == #size ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1518
	    ^ self getListFromModelScroll:false.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1519
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1520
    ].
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
  1521
    ^ 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
  1522
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1523
    "Modified: 5.3.1997 / 16:14:01 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1524
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1525
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1526
!ListView methodsFor:'drawing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1527
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1528
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1529
    "draw a visible line range in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1530
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1531
    |y         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1532
     x         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1533
     startLine "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1534
     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
  1535
     listSize e sH l|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1536
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1537
    y := self yOfVisibleLine:startVisLineNr.
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1538
    sH := lineSpacing // 2.
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1539
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1540
    backgroundAlreadyClearedColor == bg ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1541
	self paint:bg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1542
	self fillRectangleX:margin 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1543
			  y:y-sH
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1544
		      width:(width - (margin * 2))
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1545
		     height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1546
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1547
    list isNil ifTrue:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1548
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1549
    y := y + fontAscent.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1550
    listSize := self size.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1551
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1552
    startLine := startVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1553
    endLine := endVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1554
    (startLine == 0) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1555
	y := y + fontHeight.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1556
	startLine := startLine + 1
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1557
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1558
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1559
    (endLine > listSize) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1560
	e := listSize
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1561
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1562
	e := endLine
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1563
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1564
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1565
    (startLine <= e) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1566
	x := textStartLeft - viewOrigin x.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1567
	self paint:fg on:bg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1568
	self from:startLine to:e do:[:line |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1569
	    line notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1570
		"/ remove lines color emphasis, to enforce color.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1571
		"/ otherwise blue text is not visible if selection-bg is blue
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1572
		l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1573
		self displayOpaqueString:l x:x y:y
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1574
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1575
	    y := y + fontHeight
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1576
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1577
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1578
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1579
    "Modified: / 15.12.1999 / 23:19:39 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1580
!
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1581
131
claus
parents: 128
diff changeset
  1582
drawLine:line atX:x inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1583
    "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
  1584
     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
  1585
     Low level entry; not meant for public use."
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1586
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1587
    |y l|
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1588
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1589
    y := self yOfVisibleLine:visLineNr.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1590
    backgroundAlreadyClearedColor == bg ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1591
	self paint:bg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1592
	self fillRectangleX:margin y:y - (lineSpacing//2)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1593
		      width:(width - (2 * margin)) 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1594
		     height:fontHeight.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1595
    ].
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1596
    line notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1597
	self paint:fg on:bg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1598
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1599
	"/ remove lines color emphasis, to enforce color.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1600
	"/ otherwise blue text is not visible if selection-bg is blue.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1601
	"/ this is only done in EditTextViews and subClasses.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1602
	self suppressEmphasisInSelection ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1603
	    l := line
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1604
	] ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1605
	    l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1606
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1607
	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
  1608
    ]
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1609
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1610
    "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
  1611
!
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1612
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1613
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
  1614
    "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
  1615
     given x position in fg/bg. Clears partial line before drawing the string.
131
claus
parents: 128
diff changeset
  1616
     Low level entry; not meant for public use."
claus
parents: 128
diff changeset
  1617
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1618
    |y l|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1619
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1620
    y := self yOfVisibleLine:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1621
    line notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1622
	self paint:fg on:bg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1623
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1624
	"/ remove lines color emphasis, to enforce color.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1625
	"/ otherwise blue text is not visible if selection-bg is blue
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1626
	l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1627
	self displayOpaqueString:l x:x y:(y + fontAscent)
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1628
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1629
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1630
    "Modified: / 15.12.1999 / 23:19:55 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1631
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1632
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1633
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1634
    "draw single character at col index of visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1635
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1636
    |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
  1637
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1638
    lineString := lineStringArg.
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1639
    len := lineString size.
1927
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1640
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  1641
    x := (self xOfCol:col inVisibleLine:visLineNr) - viewOrigin x.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1642
    y := self yOfVisibleLine:visLineNr.
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1643
    yf := y - (lineSpacing // 2).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1644
2576
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1645
    self paint:bg.
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1646
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1647
    (lineString notNil and:[lineString isString not]) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1648
        w := lineString widthFrom:col to:(col min:len) on:self.
2576
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1649
        w <= 0 ifTrue:[ 
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1650
            w := font width. 
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1651
            self fillRectangleX:x y:yf width:w height:fontHeight.
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1652
            self paint:fg
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1653
        ].
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1654
        self clippedTo:(Rectangle origin:(x@yf) extent:(w@fontHeight)) do:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1655
            self drawVisibleLine:visLineNr with:fg and:bg
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1656
        ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1657
        ^ self
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1658
    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1659
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1660
    col > len ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1661
        self fillRectangleX:x y:yf width:(font width) height:fontHeight.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1662
        self paint:fg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1663
    ] ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1664
        characterString := lineString copyFrom:col to:col.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1665
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1666
        "/ remove lines color emphasis, to enforce color.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1667
        "/ otherwise blue text is not visible if selection-bg is blue
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1668
        characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1669
        w := characterString widthOn:self.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1670
2576
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1671
        self fillRectangleX:x y:yf width:w height:fontHeight.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1672
        self paint:fg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1673
        self displayString:characterString x:x y:(y + fontAscent)
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1674
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1675
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1676
    "Modified: / 15.12.1999 / 23:21:12 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1677
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1678
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1679
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1680
    "draw part of a visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1681
2576
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1682
    |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
  1683
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1684
    "/ hack - please rewrite
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1685
    endCol := endColOrNil ? lineStringArg size.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1686
    (endCol >= startCol) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1687
        sCol := startCol max:1.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1688
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1689
        lineString := lineStringArg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1690
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1691
        x := (self xOfCol:sCol inVisibleLine:visLineNr) - viewOrigin x.
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1692
        y := (self yOfVisibleLine:visLineNr).
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1693
        yf := y - (lineSpacing // 2).
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1694
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  1695
        len := lineString size.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1696
        (lineString notNil and:[lineString isString not])
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1697
        ifTrue:[
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  1698
            w := lineString widthFrom:sCol to:(endCol min:len) on:self.
2576
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1699
            endCol > len ifTrue:[
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1700
                sCol > len ifTrue:[
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1701
                    w2 := (endCol - sCol + 1) * fontWidth.
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1702
                ] ifFalse:[
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1703
                    w2 := (endCol - len + 1) * fontWidth.
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1704
                ].
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1705
                self paint:bg.
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1706
                self fillRectangleX:x+w y:yf width:w2 height:fontHeight.
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1707
            ].
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1708
            w > 0 ifTrue:[
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1709
                self clippedTo:(Rectangle origin:(x@yf) extent:(w@fontHeight)) do:[
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1710
                    self drawVisibleLine:visLineNr with:fg and:bg.
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  1711
                ]
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1712
            ]
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1713
        ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1714
            (sCol > len) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1715
                backgroundAlreadyClearedColor == bg ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1716
                    len := endCol - sCol + 1.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1717
                    self paint:bg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1718
                    self fillRectangleX:x y:yf 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1719
                                   width:(fontWidth * len) 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1720
                                  height:fontHeight
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1721
                ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1722
            ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1723
                eCol := endCol.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1724
                (endCol > len) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1725
                    backgroundAlreadyClearedColor == bg ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1726
                        characterString := lineString species new:endCol.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1727
                        characterString replaceFrom:1 to:len with:lineString startingAt:1.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1728
                        lineString := characterString.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1729
                    ] ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1730
                        eCol := len.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1731
                    ].
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1732
                ].
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1733
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1734
                "/ remove any color emphasis, to enforce drawing in fg/bg
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1735
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1736
                lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1737
                backgroundAlreadyClearedColor == bg ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1738
                    (lineString isMemberOf:String) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1739
                        fontIsFixedWidth ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1740
                            w := (eCol - sCol + 1) * fontWidth
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1741
                        ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1742
                            w := font widthOf:lineString from:sCol to:eCol
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1743
                        ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1744
                    ] ifFalse:[
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1745
                        w := lineString widthFrom:sCol to:endCol on:self
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1746
                    ].
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1747
                    self paint:bg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1748
                    self fillRectangleX:x y:yf 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1749
                                  width:w
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1750
                                  height:fontHeight.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1751
                ].
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1752
                self paint:fg on:bg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1753
                self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1754
            ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1755
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1756
    ]
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
  1757
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1758
    "Modified: / 15.12.1999 / 23:21:43 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1759
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1760
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1761
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
  1762
    "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
  1763
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1764
    |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
  1765
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1766
    (startCol < 1) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1767
        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
  1768
    ] ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1769
        index1 := startCol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1770
    ].
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
  1771
    y := self yOfVisibleLine:visLineNr.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  1772
    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
  1773
    backgroundAlreadyClearedColor == bg ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1774
        self paint:bg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1775
        self fillRectangleX:x y:y - (lineSpacing // 2)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1776
                      width:(width + viewOrigin x - x)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1777
                     height:fontHeight.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1778
    ].
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
  1779
    lineString notNil ifTrue:[
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1780
        lineString isString ifFalse:[     
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1781
            self drawLine:lineString inVisible:visLineNr from:startCol to:nil with:fg and:bg.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1782
        ] ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1783
            lineWithoutColor := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1784
            index2 := lineWithoutColor size.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1785
            (index2 < index1) ifTrue:[^ self].
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1786
            (index1 <= index2) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1787
                self paint:fg on:bg.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1788
                self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1789
            ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1790
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1791
    ]
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
  1792
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1793
    "Modified: / 15.12.1999 / 23:24:40 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1794
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1795
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1796
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
  1797
    "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
  1798
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1799
    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
  1800
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1801
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1802
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
  1803
    "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
  1804
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1805
    self
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1806
        drawLine:(self visibleAt:visLineNr)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1807
        inVisible:visLineNr 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1808
        col:col 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1809
        with:fg and:bg
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1810
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1811
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1812
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
  1813
    "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
  1814
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1815
    self
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1816
        drawLine:(self visibleAt:visLineNr) 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1817
        inVisible:visLineNr 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1818
        from:startCol to:endCol 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1819
        with:fg and:bg
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1820
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1821
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1822
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
  1823
    "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
  1824
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1825
    self
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1826
        drawLine:(self visibleAt:visLineNr) 
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1827
        inVisible:visLineNr 
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1828
        from:startCol 
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  1829
        with:fg and:bg
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1830
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
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
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
  1833
    "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
  1834
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1835
    self 
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1836
	drawLine:(self visibleAt:visLineNr) 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1837
	atX:(textStartLeft - viewOrigin x) 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1838
	inVisible:visLineNr 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1839
	with:fg 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1840
	and:bg
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1841
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1842
    "Modified: 28.2.1996 / 19:30:23 / cg"
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1843
!
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1844
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1845
fillRectangleX:x y:y width:w height:h
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1846
    "fill rectangle; checks whether the rectangle already is filled with
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1847
     the current paint (#redrawX:y:w:h).
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1848
    "
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1849
    backgroundAlreadyClearedColor ~~ paint ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1850
	super fillRectangleX:x y:y width:w height:h
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1851
    ]
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1852
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1853
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1854
!
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1855
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1856
invalidateLine:line
1466
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1857
    "invalidate the area of a single line.
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1858
     This arranges for that line to be redrawn asynchronously (later).
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1859
     If multiple such invalidations arrive, those areas may be lumped
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1860
     together for a block update.
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1861
     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
  1862
     process expose events."
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1863
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1864
    |yTop visLineNr|
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1865
 
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1866
    visLineNr := self listLineToVisibleLine:line.
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1867
    visLineNr notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1868
	yTop := self yOfVisibleLine:visLineNr.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1869
	yTop isNil ifTrue:[^ self]. "/ not visible
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1870
	(yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1871
	self 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1872
	    invalidateDeviceRectangle:(Rectangle 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1873
			    left:margin top:yTop 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1874
			    width:(width - (2 * margin)) height:fontHeight)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1875
	    repairNow:false.
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1876
    ]
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1877
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1878
    "Created: / 5.3.1998 / 01:24:19 / cg"
1466
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1879
    "Modified: / 5.3.1998 / 13:41:31 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1880
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1881
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1882
!ListView methodsFor:'event processing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1883
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1884
contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1885
    "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
  1886
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1887
    |listSize newOrigin|
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1888
890
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1889
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1890
	list notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1891
	    listSize := self numberOfLines.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1892
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1893
	    listSize == 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1894
		widthOfWidestLine := 0.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1895
	    ].
990
c466fa72c6e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1896
        
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1897
	    "
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1898
	     if we are beyond the end, scroll up a bit
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1899
	    "
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1900
	    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1901
		newOrigin := listSize - nFullLinesShown + 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1902
		newOrigin < 1 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1903
		    newOrigin := 1
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1904
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1905
		self scrollToLine: newOrigin.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1906
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1907
	].
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1908
    ].
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1909
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1910
    ^ super contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1911
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1912
    "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
  1913
    "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
  1914
!
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1915
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
  1916
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
  1917
    "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
  1918
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1919
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1920
			  #BeginOfText #EndOfText
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1921
			  #ScrollUp #ScrollDown )>
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
  1922
    |sensor 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
  1923
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1924
    (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
  1925
    (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
  1926
    (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
  1927
    (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
  1928
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1929
    (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
  1930
    (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
  1931
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1932
    sensor := self sensor.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1933
    (key == #ScrollUp) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1934
	sensor isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1935
	    n := 1
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1936
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1937
	    n := 1 + (sensor compressKeyPressEventsWithKey:#ScrollUp).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1938
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1939
	^ 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
  1940
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1941
    (key == #ScrollDown) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1942
	sensor isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1943
	    n := 1
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1944
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1945
	    n := 1 + (sensor compressKeyPressEventsWithKey:#ScrollDown).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1946
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1947
	^ 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
  1948
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1949
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1950
    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
  1951
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1952
2273
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  1953
mapped
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  1954
    self stopAutoScroll.
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  1955
    super mapped
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  1956
!
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  1957
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1958
redrawX:x y:y width:w height:h
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1959
    "a region must be redrawn"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1960
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1961
    |startCol endCol line saveClip
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1962
     startLine "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1963
     stopLine  "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1964
    |
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1965
127
claus
parents: 125
diff changeset
  1966
    shown ifFalse:[^ self].
claus
parents: 125
diff changeset
  1967
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1968
    startLine := self visibleLineOfY:y.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1969
    stopLine := self visibleLineOfY:(y + h).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1970
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1971
    saveClip := clipRect.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1972
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1973
    self paint:bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1974
    self fillRectangleX:x y:y width:w height:h.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1975
    backgroundAlreadyClearedColor := bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1976
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1977
    (includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1978
	"includes non strings or area is big enough redraw whole lines"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1979
	self redrawFromVisibleLine:startLine to:stopLine
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1980
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1981
	line := self visibleAt:startLine.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1982
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1983
	(fontIsFixedWidth and:[line isMemberOf:String]) ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1984
	    "start/end col has to be computed for each line"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1985
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1986
	    startLine to:stopLine do:[:i |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1987
		startCol := self colOfX:x inVisibleLine:i.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1988
		endCol := self colOfX:(x + w) inVisibleLine:i.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1989
		startCol > 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1990
		    endCol > 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1991
			self redrawVisibleLine:i from:startCol to:endCol
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1992
		    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1993
		]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1994
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1995
	] ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1996
	    "start/end col is the same for all lines"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1997
	    startCol := self colOfX:x inVisibleLine:startLine.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1998
	    endCol := self colOfX:(x + w) inVisibleLine:startLine.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  1999
	    startCol > 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2000
		endCol > 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2001
		    startLine to:stopLine do:[:i |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2002
			line := self visibleAt:i.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2003
			(line isMemberOf:String) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2004
			    self redrawVisibleLine:i from:startCol to:endCol
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2005
			] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2006
			    self redrawVisibleLine:i
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2007
			]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2008
		    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2009
		]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2010
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2011
	]
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2012
    ].
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2013
    backgroundAlreadyClearedColor := nil.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2014
    self clippingRectangle:saveClip.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2015
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2016
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2017
sizeChanged:how
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2018
    "size changed - move origin up if possible"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2019
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2020
    super sizeChanged:how.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
  2021
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2022
    self computeNumberOfLinesShown.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2023
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2024
    innerWidth := width - textStartLeft - margin.
1972
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2025
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
  2026
"/ Makes trouble when fighting with SelListViews sizeChanged-positioning ...
1972
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2027
"/
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2028
"/    shown ifFalse:[^ self].
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2029
"/    list isNil ifTrue:[^ self].
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2030
"/
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2031
"/    listSize := self numberOfLines.
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2032
"/    "
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2033
"/     if we are beyond the end, scroll up a bit
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2034
"/    "
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2035
"/    ((firstLineShown + nFullLinesShown) >= listSize) ifTrue:[
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2036
"/        self scrollToBottom.
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2037
"/        ^ self
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  2038
"/    ].
643
89c06c80ff2a redraw in sizeChange
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
  2039
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  2040
    "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
  2041
    "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
  2042
!
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2043
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2044
unmap
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2045
    self stopAutoScroll.
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2046
    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
  2047
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2048
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2049
!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
  2050
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2051
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
  2052
    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
  2053
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2054
    "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
  2055
    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
  2056
    self computeNumberOfLinesShown.
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2057
    fgColor := fgColor onDevice:device.
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2058
    bgColor := bgColor onDevice:device
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2059
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2060
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
  2061
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
  2062
    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
  2063
    ^ 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
  2064
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2065
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2066
fetchDeviceResources
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2067
    "fetch device colors, to avoid reallocation at redraw time"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2068
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2069
    super fetchDeviceResources.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2070
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2071
    fgColor notNil ifTrue:[fgColor := fgColor onDevice:device].
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2072
    bgColor notNil ifTrue:[bgColor := bgColor onDevice:device].
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2073
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2074
    "Created: 14.1.1997 / 00:12:12 / cg"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2075
!
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2076
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
  2077
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  2078
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  2079
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2080
    |n|
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2081
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
  2082
    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
  2083
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  2084
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device]
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  2085
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2086
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2087
    n isInteger ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2088
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2089
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2090
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2091
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2092
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2093
    n isInteger ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2094
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2095
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2096
    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
  2097
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2098
    lineSpacing := 0.
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2099
    fgColor := DefaultForegroundColor.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2100
    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
  2101
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2102
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2103
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
  2104
    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
  2105
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2106
    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
  2107
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2108
    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
  2109
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2110
    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
  2111
    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
  2112
    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
  2113
    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
  2114
    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
  2115
    partialLines := true.
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  2116
    tabPositions := UserDefaultTabPositions ? DefaultTabPositions.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  2117
    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
  2118
    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
  2119
    wordCheck := [:char | char isNationalAlphaNumeric].
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  2120
    scrollWhenUpdating := #beginOfText.
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
  2121
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2122
    autoScroll := true.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  2123
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  2124
    "Modified: 4.11.1996 / 23:28:17 / 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
  2125
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2126
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2127
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
  2128
    |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
  2129
2305
f2850e54b0ab only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  2130
    self extentChangedFlag ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2131
	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
  2132
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2133
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
  2134
    firstLineShown ~~ 1 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2135
	sz := self size.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2136
	firstLineShown + nLinesShown > sz ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2137
	    self scrollToLine:sz - nLinesShown.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2138
	]
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
  2139
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2140
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
  2141
    super realize.
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  2142
1081
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2143
"/ old: fetch models value on realize;
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2144
"/ 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
  2145
"/
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2146
"/    model notNil ifTrue:[
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2147
"/        self getListFromModel.
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2148
"/    ]
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2149
825
d115a0923b7d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 820
diff changeset
  2150
    "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
  2151
    "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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2154
recreate
2258
806d3b8a6e97 comment
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2155
    "recreate after a snapin or a migration"
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2156
    |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
  2157
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2158
    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
  2159
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2160
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2161
     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
  2162
     - 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
  2163
    "
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2164
"/    topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2165
"/    self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2166
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2167
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2168
    n isInteger ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2169
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2170
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2171
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2172
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2173
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2174
    n isInteger ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2175
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2176
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2177
    self leftMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2178
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
  2179
    self getFontParameters
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2180
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2181
    "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
  2182
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2183
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2184
!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
  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
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
  2187
    "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
  2188
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2189
    self obsoleteMethodWarning:'use #listLineToVisibleLine:'.
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2190
    ^ self listLineToVisibleLine:absLineNr
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2191
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2192
"/    absLineNr isNil ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2193
"/    (absLineNr < firstLineShown) ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2194
"/    (absLineNr >= (firstLineShown + nLinesShown)) ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2195
"/    ^ absLineNr - firstLineShown + 1
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2196
"/
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
  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
75b8fb924904 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
characterPositionOfLine: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
  2200
    "given a line/col position, return the character index within the contents-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
  2201
     - used with Compilers error-positioning"
75b8fb924904 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
75b8fb924904 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
    |lineString pos|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2204
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2205
    self 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
  2206
    pos := 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
  2207
    1 to:(lineNr - 1) do:[:lnr |
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2208
	lineString := self at:lnr.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2209
	lineString notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2210
	    pos := pos + lineString size
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2211
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2212
	pos := pos + 1   "the return-character"
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
  2213
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2214
    ^ pos + col - 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
  2215
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2216
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2217
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2218
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
  2219
    "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
  2220
75b8fb924904 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
    list isNil ifTrue: [
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2222
	list := StringCollection new:lineNr.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2223
	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
  2224
    ] ifFalse: [
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2225
	lineNr > (list size) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2226
	    self grow:lineNr.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2227
	    self contentsChanged
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2228
	]
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
  2229
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2230
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2231
1934
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2232
colOfCharacterPosition:charPos
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2233
    "given a character index within the contents-string,
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2234
     return the column number where the character is
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2235
     - used to find line to hilight from Compilers error-position"
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2236
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2237
    |line|
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2238
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2239
    line := self lineOfCharacterPosition:charPos.
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2240
    ^ charPos - (self characterPositionOfLine:line col:1) + 1.
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2241
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2242
!
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  2243
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
  2244
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
  2245
    "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
  2246
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2247
    |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
  2248
     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
  2249
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2250
    xRel := x - textStartLeft + viewOrigin x.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2251
    (xRel <= 0) ifTrue:[^ 1].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2252
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2253
    lineString := self visibleAt:visLineNr.
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2254
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
  2255
    "
75b8fb924904 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
     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
  2257
    "
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2258
    (fontIsFixedWidth 
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2259
    and:[lineString isNil
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2260
          or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2261
        ^ (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
  2262
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2263
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2264
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2265
     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
  2266
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2267
    lineString notNil ifTrue:[
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2268
        lineString := self visibleStringFrom:lineString.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2269
        (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2270
            linePixelWidth := lineString widthOn:self
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2271
        ] ifFalse:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2272
            lineString := lineString string.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2273
            linePixelWidth := font widthOf:lineString.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2274
        ]
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
  2275
    ] ifFalse:[
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2276
        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
  2277
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2278
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
  2279
    (linePixelWidth <= xRel) ifTrue:[
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2280
        fontWidth == 0 ifTrue:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2281
            "
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2282
             although this 'cannot happen',
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2283
             it seems that X reports this width for some strange fonts ...
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2284
            "
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2285
            ^ lineString size   
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2286
        ].
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2287
        ^ 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
  2288
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2289
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2290
    "/ cannot simply count individual characters,
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2291
    "/ 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
  2292
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
  2293
    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
  2294
    (runCol == 0) ifTrue:[runCol := 1].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2295
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2296
    hasEmphasis ifTrue:[
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2297
        posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2298
        posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2299
    ] ifFalse:[    
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2300
        posLeft := font widthOf:lineString from:1 to:(runCol - 1).
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2301
        posRight := font widthOf:lineString from:1 to:runCol.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2302
    ].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2303
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
  2304
    done := (posLeft <= xRel) and:[posRight > xRel].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2305
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
  2306
    [done] whileFalse:[
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2307
        oPosRight := posRight.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2308
        oPosLeft := posLeft.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2309
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2310
        (posRight <= xRel) ifTrue:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2311
            runCol := runCol + 1.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2312
            posLeft := posRight.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2313
            hasEmphasis ifTrue:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2314
                posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2315
            ] ifFalse:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2316
                posRight := font widthOf:lineString from:1 to:runCol
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2317
            ]
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2318
        ] ifFalse:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2319
            (posLeft > xRel) ifTrue:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2320
                runCol := runCol - 1.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2321
                (runCol == 0) ifTrue:[^ 0].
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2322
                posRight := posLeft.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2323
                hasEmphasis ifTrue:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2324
                    posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2325
                ] ifFalse:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2326
                    posLeft := font widthOf:lineString from:1 to:(runCol - 1)
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2327
                ]
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2328
            ]
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2329
        ].
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2330
        done := (posLeft <= xRel) and:[posRight > xRel].
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2331
"234567890123456789012345678901234567890"
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2332
        ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2333
            "/ paranoia: just in case there are unprintable characters
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2334
            "/ (avoid endless loop if the binary search does not make progress)
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2335
            done := true.
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2336
        ]
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
  2337
    ].
1777
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2338
"/self paint:Color red.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2339
"/self displayRectangleX:posLeft+textStartLeft-viewOrigin x y:(self yOfVisibleLine:visLineNr)
1777
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2340
"/                       width:(posRight-posLeft) height:fontHeight.
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2341
"/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
  2342
    ^ runCol
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2343
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2344
    "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
  2345
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2346
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2347
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
  2348
    "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
  2349
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2350
    |innerHeight|
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2351
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2352
    innerHeight := self innerHeight.
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2353
    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
  2354
    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
  2355
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2356
    partialLines ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2357
	((nLinesShown * fontHeight) < innerHeight) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2358
	    nLinesShown := nLinesShown + 1
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2359
	]
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
  2360
    ]
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2361
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2362
    "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
  2363
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2364
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2365
convertRTF:aList
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2366
    "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
  2367
     - 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
  2368
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2369
    |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
  2370
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2371
    self obsoleteMethodWarning.
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2372
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
  2373
    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
  2374
    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
  2375
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2376
    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
  2377
    aList do:[:line |
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2378
	((line size == 0) or:[line isBlank]) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2379
	    newList add:newLine.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2380
	    newLine := ''
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2381
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2382
	    special := ((line at:1) == ${) or:[(line includes:$\)].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2383
	    special := special or:[(line at:1) == $}].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2384
	    special ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2385
		newList add:(newLine , line)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2386
	    ] ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2387
		charIndex := 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2388
		[charIndex <= line size] whileTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2389
		    char := line at:charIndex.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2390
		    ((char == ${ ) or:[char == $} ]) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2391
			"left-brace: ignore rest of line"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2392
			charIndex := line size + 1
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2393
		    ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2394
			(char == $\) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2395
			    inEscape := true
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2396
			] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2397
			    inEscape ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2398
				(char == Character space) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2399
				    inEscape := false
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2400
				]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2401
			    ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2402
				newLine := newLine copyWith:char
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2403
			    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2404
			].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2405
			charIndex := charIndex + 1
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2406
		    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2407
		]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2408
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2409
	]
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
  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
    ^ newList
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2412
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2413
    "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
  2414
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2415
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2416
getFontParameters
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2417
    "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
  2418
     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
  2419
     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
  2420
     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
  2421
     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
  2422
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2423
    |hMax|
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2424
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2425
    font := font onDevice:device.
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2426
    hMax := font height.
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2427
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2428
    includesNonStrings == true ifTrue:[
2564
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2429
        "/
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2430
        "/ find maximum height of lines
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2431
        "/
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2432
        hMax := list inject:hMax into:[:maxSoFar :thisLine | 
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2433
                                        thisLine isNil ifTrue:[
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2434
                                            maxSoFar
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2435
                                        ] ifFalse:[
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2436
                                            (thisLine isMemberOf:String) ifTrue:[
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2437
                                                maxSoFar
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2438
                                            ] ifFalse:[   
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2439
                                                maxSoFar max:(thisLine heightOn:self)
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2440
                                            ]
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2441
                                        ]
192833369ad6 use maxAscent instead of ascent
Michael Beyl <mb@exept.de>
parents: 2562
diff changeset
  2442
                              ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2443
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2444
    ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2445
    fontHeight := hMax + lineSpacing.
2565
Michael Beyl <mb@exept.de>
parents: 2564
diff changeset
  2446
    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
  2447
    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
  2448
    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
  2449
1260
5a548d4c6724 handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
  2450
    "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
  2451
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2452
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2453
getListFromModel
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2454
    "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
  2455
     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
  2456
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2457
    |text msg|
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2458
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2459
    model notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2460
	msg := listMsg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2461
	msg isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2462
	    msg := aspectMsg
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2463
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2464
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2465
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2466
	msg notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2467
	    text := model perform:msg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2468
	    text notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2469
		text := text asStringCollection.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2470
	    ].
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2471
"/ SV: this does not work, if model uses (i.e. updates) the same stringCollection
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2472
"/ as the view!!
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2473
"/            text ~= list ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2474
		self list:text
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2475
"/            ].
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2476
	].
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
  2477
    ].
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2478
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2479
    "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
  2480
    "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
  2481
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2482
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2483
getListFromModelScroll:aBoolean
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2484
    "ask my model (if any) for the text via the listMsg.
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2485
     If there is no listMessage, try aspect for backward compatibility."
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2486
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2487
    |text msg|
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2488
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2489
    model notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2490
	msg := listMsg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2491
	msg isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2492
	    msg := aspectMsg
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2493
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2494
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2495
	msg notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2496
	    text := model perform:msg.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2497
	    text notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2498
		text := text asStringCollection.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2499
	    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2500
"/ SV: this does not work, if model uses (i.e. updates) the same stringCollection
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2501
"/ as the view!!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2502
"/            text ~= list ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2503
		aBoolean ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2504
		    self list:text
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2505
		] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2506
		    self setList:text
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2507
		]
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2508
"/            ].
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2509
	].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2510
    ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2511
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2512
    "Modified: 19.2.1997 / 12:08:50 / stefan"
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2513
    "Created: 5.3.1997 / 16:10:22 / cg"
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2514
    "Modified: 5.3.1997 / 16:14:44 / cg"
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2515
!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2516
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2517
line:line withoutEmphasis:emphasisToRemove 
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2518
    (line notNil 
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2519
    and:[line isString]) ifTrue:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2520
        ^ line withoutEmphasis:emphasisToRemove.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2521
    ].
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2522
    ^ line
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2523
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2524
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
  2525
lineOfCharacterPosition:charPos
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2526
    "given a character index within the contents-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
  2527
     return the lineNumber where the character is
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2528
     - used to find line to hilight from Compilers error-position"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2529
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2530
    |lineNr sum 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
  2531
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2532
    lineNr := 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
  2533
    sum := 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
  2534
    lastLine := self size.
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2535
    [(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2536
	sum := sum + (self at:lineNr) size + 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2537
	lineNr := lineNr + 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
  2538
    ].
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2539
    sum == charPos ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2540
	^ lineNr
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2541
    ].
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2542
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
  2543
    ^ lineNr - 1
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2544
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2545
    "Modified: / 5.4.1998 / 17:19:28 / 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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2548
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
  2549
    "given a lineNumber, return the corresponding 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
  2550
     This is used for accessing; 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
  2551
     returns the corresponding 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
  2552
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2553
    |l|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2554
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2555
    list 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
  2556
    (lineNr between:1 and:self size) 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
  2557
    l := self at: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
  2558
    l isNil ifTrue:[^ l].
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2559
    ^ self visibleStringFrom:l "/ l asString
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
  2560
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2561
    "Modified: 7.9.1995 / 15:54:59 / claus"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2562
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2563
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2564
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
  2565
    "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
  2566
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2567
    |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
  2568
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2569
    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
  2570
    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
  2571
    (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
  2572
    ^ 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
  2573
!
75b8fb924904 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
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
  2576
    "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
  2577
75b8fb924904 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 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
  2579
75b8fb924904 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 := 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
  2581
    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
  2582
    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
  2583
    (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
  2584
    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
  2585
    (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
  2586
    ^ 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
  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
75b8fb924904 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
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
  2590
    "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
  2591
75b8fb924904 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
    |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
  2593
75b8fb924904 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
    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
  2595
    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
  2596
    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
  2597
    (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
  2598
    ^ 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
  2599
!
75b8fb924904 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
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2601
listLineIsVisible:listLineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2602
    "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
  2603
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2604
    |visibleLineNr "{ Class: SmallInteger }"|
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2605
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2606
    shown ifFalse:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2607
    listLineNr isNil ifTrue:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2608
    visibleLineNr := listLineNr + 1 - firstLineShown.
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2609
    ^ (visibleLineNr between:1 and:nLinesShown)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2610
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2611
    "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
  2612
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2613
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
  2614
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
  2615
    "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
  2616
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2617
    |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
  2618
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2619
    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
  2620
    listLineNr isNil ifTrue:[^ nil].
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2621
    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
  2622
    (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
  2623
    ^ 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
  2624
!
75b8fb924904 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
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2626
recomputeWidthOfWidestLineFor:aString
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2627
    |w|
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2628
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2629
    widthOfWidestLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2630
	aString isString ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2631
	    w := font widthOf:aString
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2632
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2633
	    w := aString widthOn:self
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2634
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2635
	w > widthOfWidestLine ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2636
	    widthOfWidestLine := w.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2637
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2638
	    widthOfWidestLine := nil "/ means: unknown
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2639
	].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2640
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2641
    ^ widthOfWidestLine
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2642
!
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  2643
2225
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2644
suppressEmphasisInSelection
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2645
    "selection is shown with original emphasis"
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2646
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2647
    ^ false
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2648
!
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  2649
2181
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2650
textChanged
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2651
    "ignored here"
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2652
!
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2653
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
  2654
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
  2655
    "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
  2656
     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
  2657
     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
  2658
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2659
    |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
  2660
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2661
    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
  2662
    (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
  2663
    (list notNil) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2664
	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
  2665
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2666
	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
  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) 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
  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
!
75b8fb924904 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
75b8fb924904 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
visibleLineOfY: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
  2673
    "given a y-coordinate, return 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
  2674
     - 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
  2675
1448
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2676
    ^ (((y - textStartTop) // fontHeight) + 1) max:1
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2677
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2678
    "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
  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
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
  2682
    "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
  2683
75b8fb924904 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
    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
  2685
    ^ 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
  2686
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2687
75b8fb924904 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
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
  2689
    "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
  2690
     (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
  2691
     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
  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
    |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
  2694
     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
  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
    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
  2697
    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
  2698
    (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
  2699
    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
  2700
    (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
  2701
    ^ 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
  2702
!
75b8fb924904 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
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2704
visibleStringFrom:aString
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2705
    ^ aString asString
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2706
!
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  2707
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
  2708
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
  2709
    "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
  2710
     - 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
  2711
     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
  2712
     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
  2713
957
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2714
    ^ innerWidth
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2715
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2716
"/    "for small width, its not worth searching for
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2717
"/     longest line ...
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2718
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2719
"/    (width < 300) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2720
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2721
"/    "for large lists, search may take longer than scrolling full
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2722
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2723
"/    self size > 2000 ifTrue:[^ 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
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2726
"/     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
  2727
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2728
"/    (viewBackground isColor not
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2729
"/     or:[viewBackground isDithered]) ifTrue:[
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2730
"/        ^ width
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
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2733
"/    w := self widthOfWidestLineBetween:firstLine and:lastLine.
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2734
"/    (w > innerWidth) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2735
"/    ^ w
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
    "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
  2738
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2739
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2740
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
  2741
    "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
  2742
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2743
    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
  2744
    entry isString ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2745
	^ 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
  2746
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2747
    ^ entry widthOn:self
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2748
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2749
    "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
  2750
!
75b8fb924904 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
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
  2753
    "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
  2754
     - 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
  2755
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2756
    |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
  2757
     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
  2758
     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
  2759
     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
  2760
     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
  2761
75b8fb924904 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
    includesNonStrings ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2763
	^ 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
  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
75b8fb924904 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
    fontIsFixedWidth ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2767
	^ (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
  2768
    ].
75b8fb924904 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 := 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
  2770
    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
  2771
    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
  2772
    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
  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
    (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
  2775
    (last > listSize) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2776
	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
  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
75b8fb924904 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
    self from:first to:last do:[:line |
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2780
	line notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2781
	    thisLen := font widthOf:line.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2782
	    (thisLen > max) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2783
		max := thisLen
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2784
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2785
	]
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
    ^ 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
  2788
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2789
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2790
withoutAnyColorEmphasis:line
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2791
    ^ self withoutBackgroundColorEmphasis:(self withoutColorEmphasis:line)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2792
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2793
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2794
withoutBackgroundColorEmphasis:line
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2795
    ^ self line:line withoutEmphasis:#backgroundColor
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2796
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2797
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2798
withoutColorEmphasis:line
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2799
    ^ self line:line withoutEmphasis:#color
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2800
!
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2801
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2802
withoutColorEmphasis:line ifFg:fg andBg:bg
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2803
    "/ remove lines color emphasis, to enforce color.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2804
    "/ otherwise blue text is not visible if selection-bg is blue
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2805
    (line notNil 
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2806
    and:[line isString
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2807
    and:[line hasChangeOfEmphasis
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2808
    and:[fg ~= fgColor or:[bg ~= bgColor]]]]) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2809
        ^ self line:line withoutEmphasis:#color
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2810
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2811
    ^ line
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2812
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2813
    "Modified: / 15.12.1999 / 23:17:30 / cg"
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2814
    "Created: / 15.12.1999 / 23:19:30 / cg"
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2815
!
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2816
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
  2817
xOfCol:col inVisibleLine:visLineNr
2209
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2818
    "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
  2819
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2820
    |line lineSize tcol lText|
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2821
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2822
    col == 1 ifTrue:[
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2823
        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
  2824
    ] ifFalse:[
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2825
        tcol := col - 1.
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2826
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2827
        line := self visibleAt:visLineNr.
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2828
        (fontIsFixedWidth 
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2829
        and:[line isNil or:[line isMemberOf:String]]) 
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2830
        ifTrue:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2831
            lText := (tcol * fontWidth)
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2832
        ] ifFalse:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2833
            line notNil ifTrue:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2834
                lineSize := line size
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2835
            ] ifFalse:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2836
                lineSize := 0
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2837
            ].
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2838
            (lineSize == 0) ifTrue:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2839
                lText := (tcol * fontWidth)
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2840
            ] ifFalse:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2841
                (lineSize < col) ifTrue:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2842
                    lText := (line widthOn:self) + (fontWidth * (tcol - lineSize)) 
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2843
                ] ifFalse:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2844
                    (line isMemberOf:String) ifTrue:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2845
                        lText := (font widthOf:line from:1 to:tcol)
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2846
                    ] ifFalse:[
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2847
                        lText := line widthFrom:1 to:tcol on:self.
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2848
                    ]
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2849
                ]
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2850
            ]
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2851
        ]
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
  2852
    ].
2209
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  2853
    ^ lText + textStartLeft
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2854
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2855
    "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
  2856
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2857
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2858
yOfLine:lineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2859
    "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
  2860
     - 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
  2861
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2862
    ^ self yOfVisibleLine:(self listLineToVisibleLine:lineNr)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2863
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2864
    "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
  2865
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2866
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
  2867
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
  2868
    "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
  2869
     - 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
  2870
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2871
    ^ ((visLineNr - 1) * fontHeight) + textStartTop
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2872
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2873
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2874
!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
  2875
1525
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2876
currentLine
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2877
    "the current line (for relative gotos); 
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2878
     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
  2879
     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
  2880
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2881
    ^ firstLineShown
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2882
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2883
    "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
  2884
!
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2885
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
  2886
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
  2887
    "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
  2888
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2889
    ^ 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
  2890
!
75b8fb924904 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
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2892
heightForLines:numberOfLines
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2893
    "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
  2894
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2895
    "need a device font for query"
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2896
    font := font onDevice:device.
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2897
    ^ 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
  2898
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2899
    "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
  2900
!
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2901
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
  2902
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
  2903
    "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
  2904
     - 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
  2905
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2906
    | 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
  2907
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2908
    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
  2909
    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
  2910
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2911
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2912
    "/ 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
  2913
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2914
"/    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
  2915
"/        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
  2916
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2917
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2918
     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
  2919
    "
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2920
    font := font onDevice:device.
2649
Claus Gittinger <cg@exept.de>
parents: 2648
diff changeset
  2921
    ^ 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
  2922
"/                            + textStartTop
2648
190351d07ce1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2607
diff changeset
  2923
                            - (lineSpacing // 2)
190351d07ce1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2607
diff changeset
  2924
                            + (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
  2925
"/                            + (font descent)       
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2926
"/                            + (font descent * 2) "makes it look better"
2648
190351d07ce1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2607
diff changeset
  2927
                                .
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
  2928
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2929
"/    "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
  2930
"/    (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
  2931
"/        ^ 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
  2932
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2933
"/    "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
  2934
"/     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
  2935
"/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2936
"/    ^ (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
  2937
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2938
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2939
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
  2940
    "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
  2941
75b8fb924904 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
    ^ 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
  2943
!
75b8fb924904 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
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
  2946
    "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
  2947
     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
  2948
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2949
    |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
  2950
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2951
    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
  2952
    lineString notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2953
	indent := lineString leftIndent.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2954
	indent == lineString size ifTrue:[^ 0].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2955
	^ 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
  2956
    ].
75b8fb924904 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
    ^ 0
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2958
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2959
    "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
  2960
!
75b8fb924904 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
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
  2963
    "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
  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
    ^ 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
  2966
!
75b8fb924904 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
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
  2969
    "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
  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
    |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
  2972
     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
  2973
     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
  2974
     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
  2975
     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
  2976
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2977
    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
  2978
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2979
    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
  2980
    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
  2981
    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
  2982
    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
  2983
75b8fb924904 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
    (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
  2985
    (last > listSize) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2986
	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
  2987
    ].
75b8fb924904 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
    self from:first to:last do:[:lineString |
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2989
	lineString notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2990
	    thisLen := lineString size.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2991
	    (thisLen > max) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2992
		max := thisLen
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2993
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2994
	]
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
  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
    ^ 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
  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
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3000
lineIsFullyVisible:line
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3001
    "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
  3002
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3003
    (line >= firstLineShown
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3004
     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
  3005
    ^ false.
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3006
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3007
    "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
  3008
!
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3009
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
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
  3011
    "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
  3012
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3013
    (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
  3014
    ^ 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
  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
75b8fb924904 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
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
  3018
    "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
  3019
75b8fb924904 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
    ^ 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
  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
678
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3023
preferredExtentForLines:numLines cols:numCols
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3024
    ^ (((font widthOf:'x') * numCols + margin + margin) 
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3025
      @ 
688
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  3026
      (fontHeight * numLines + margin + margin + font descent + lineSpacing + topMargin)).
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  3027
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  3028
    "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
  3029
!
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3030
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
  3031
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
  3032
    "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
  3033
     - 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
  3034
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  3035
    |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
  3036
75b8fb924904 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
    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
  3038
    widthOfWidestLine notNil ifTrue:[^ widthOfWidestLine + (leftMargin * 2)].
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  3039
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3040
    (d := device) isNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3041
	"/ mhmh - really dont know yet
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3042
	d := Screen current
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  3043
    ].
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3044
    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
  3045
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3046
    includesNonStrings ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3047
	max := list 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3048
		   inject:0 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3049
		   into:[:maxSoFar :entry |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3050
			     (
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3051
				 entry isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3052
				     0
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3053
				 ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3054
				    entry isString ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3055
					f widthOf:entry
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3056
				    ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3057
					entry widthOn:self
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3058
				    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3059
				 ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3060
			     ) max:maxSoFar.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3061
			]
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
  3062
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3063
	fontIsFixedWidth ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3064
	    max := lengthOfLongestString := 0.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3065
	    list notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3066
		list do:[:line |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3067
		    line notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3068
			(line isString and:[line hasChangeOfEmphasis not]) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3069
			    line size > lengthOfLongestString ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3070
				lengthOfLongestString := line size
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3071
			    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3072
			] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3073
			    max := max max:(line widthOn:self)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3074
			]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3075
		    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3076
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3077
		max := max max:(lengthOfLongestString * fontWidth)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3078
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3079
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3080
	    false "fontIsFixedWidth" ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3081
		max := self lengthOfLongestLine * fontWidth
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3082
	    ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3083
		max := 0.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3084
		list notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3085
		    list do:[:line |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3086
			line notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3087
			    max := max max:(line widthOn:self)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3088
			]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3089
		    ].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
  3090
    "/                max := max max:(f widthOf:list)
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3091
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3092
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3093
	].
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
  3094
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3095
    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
  3096
    ^ max + (leftMargin * 2)
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  3097
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  3098
    "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
  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
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3101
widthOfLine:lineNr
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3102
    "return the width of a line in pixels"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3103
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3104
    |line f d|
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3105
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3106
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3107
    lineNr > list size ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3108
    line := list at:lineNr.
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3109
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3110
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3111
    (d := device) isNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3112
	"/ mhmh - really dont know yet
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3113
	d := Screen current
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3114
    ].
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  3115
    f := font := font onDevice:d.
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3116
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3117
    line isString ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3118
	^ f widthOf:line
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3119
    ].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3120
    ^ line widthOn:self
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3121
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3122
    "Created: / 10.11.1998 / 23:59:20 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3123
    "Modified: / 11.11.1998 / 15:25:07 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3124
!
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3125
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
  3126
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
  3127
    "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
  3128
     - 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
  3129
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3130
    ^ 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
  3131
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3132
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3133
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
  3134
    "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
  3135
     - 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
  3136
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3137
    ^ (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
  3138
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3139
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3140
!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
  3141
75b8fb924904 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
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
  3143
    "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
  3144
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3145
    self redrawInverted.
292
f46dea5bdd51 use new Delay wait
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
  3146
    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
  3147
    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
  3148
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3149
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3150
     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
  3151
     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
  3152
     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
  3153
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3154
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3155
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3156
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
  3157
    "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
  3158
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3159
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3160
	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
  3161
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3162
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3163
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3164
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
  3165
    "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
  3166
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3167
    |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
  3168
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3169
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3170
	"if first line to redraw is above 1st visible line,
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3171
	 start redraw at 1st visible line"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3172
	(lineNr < firstLineShown) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3173
	    first := firstLineShown
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3174
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3175
	    first := lineNr
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3176
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3177
	visibleLine := self listLineToVisibleLine:first.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3178
	visibleLine notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3179
	    self redrawFromVisibleLine:visibleLine to:nLinesShown
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3180
	]
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
  3181
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3182
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3183
2605
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3184
redrawFromLine:startLine col:startCol toLine:endLine col:endCol
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3185
    shown ifTrue:[
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3186
        self redrawLine:startLine from:startCol.
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3187
        endLine > (startLine+1) ifTrue:[
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3188
            self redrawFromLine:startLine+1 to:endLine-1
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3189
        ].
2607
Claus Gittinger <cg@exept.de>
parents: 2605
diff changeset
  3190
        self redrawLine:endLine from:1 to:endCol.
2605
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3191
    ]
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3192
!
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3193
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
  3194
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
  3195
    "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
  3196
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3197
    |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
  3198
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3199
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3200
	lastLineShown := firstLineShown + nLinesShown - 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3201
	(start <= lastLineShown) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3202
	    (end >= firstLineShown) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3203
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3204
		"if first line to redraw is above 1st visible line,
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3205
		 start redraw at 1st visible line"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3206
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3207
		(start < firstLineShown) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3208
		    first := firstLineShown
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3209
		] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3210
		    first := start
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3211
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3212
		(end > lastLineShown) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3213
		    last := lastLineShown
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3214
		] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3215
		    last := end
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3216
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3217
		visibleFirst := self listLineToVisibleLine:first.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3218
		visibleLast := self listLineToVisibleLine:last.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3219
		self redrawFromVisibleLine:visibleFirst to:visibleLast
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3220
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3221
	]
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
  3222
    ]
75b8fb924904 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
!
75b8fb924904 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
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
  3226
    "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
  3227
75b8fb924904 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
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3229
	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
  3230
    ]
75b8fb924904 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
!
75b8fb924904 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
75b8fb924904 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
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
  3234
    "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
  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
    |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
  3237
75b8fb924904 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
    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
  3239
    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
  3240
    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
  3241
    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
  3242
    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
  3243
    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
  3244
    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
  3245
!
75b8fb924904 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
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
  3248
    "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
  3249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3250
    |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
  3251
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3252
    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
  3253
    visibleLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3254
	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
  3255
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3256
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3257
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3258
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
  3259
    "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
  3260
75b8fb924904 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
    |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
  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
    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
  3264
    visibleLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3265
	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
  3266
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3267
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3268
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3269
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
  3270
    "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
  3271
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3272
    |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
  3273
75b8fb924904 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
    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
  3275
    visibleLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3276
	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
  3277
    ]
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3280
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
  3281
    "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
  3282
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3283
    |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
  3284
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3285
    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
  3286
    visibleLine notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3287
	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
  3288
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3289
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3290
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3291
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
  3292
    "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
  3293
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3294
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3295
	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
  3296
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3297
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3298
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3299
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
  3300
    "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
  3301
75b8fb924904 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
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3303
	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
  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
!
75b8fb924904 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
75b8fb924904 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
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
  3308
    "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
  3309
75b8fb924904 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
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3311
	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
  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
!
75b8fb924904 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
75b8fb924904 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
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
  3316
    "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
  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
    shown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3319
        startCol == endCol ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3320
            self redrawVisibleLine:visLineNr col:startCol
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3321
        ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3322
            self drawVisibleLine:visLineNr from:startCol to:endCol with:fgColor and:bgColor
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3323
        ]
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
  3324
    ]
75b8fb924904 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
!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
  3328
75b8fb924904 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
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
  3330
    "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
  3331
     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
  3332
75b8fb924904 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
    ^ 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
  3334
!
75b8fb924904 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
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
  3337
    "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
  3338
75b8fb924904 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
    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
  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
75b8fb924904 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
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
  3343
    "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
  3344
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3345
    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
  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
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3348
horizontalScrollStep
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3349
    "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
  3350
     Here, the scrolling unit is characters."
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3351
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3352
    ^ font width
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3353
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3354
    "Created: / 21.5.1999 / 15:55:06 / cg"
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3355
!
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3356
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
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
  3358
    "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
  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
    |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
  3361
75b8fb924904 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
    (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
  3363
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3364
    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
  3365
    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
  3366
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3367
    xWant := self xOfCol:aCol inVisibleLine:visLnr.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3368
    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
  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
     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
  3372
     (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
  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
"/    ((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
  3375
"/        ^ 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
  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
     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
  3380
     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
  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
    (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
  3383
75b8fb924904 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
    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
  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
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
  3388
    "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
  3389
     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
  3390
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3391
    |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
  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
    (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
  3394
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3395
"/  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
  3396
"/      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
  3397
"/      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
  3398
"/
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3399
"/    shown ifFalse:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3400
"/        firstLineShown := (aListLineNr - 1) max:1.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3401
"/        firstLineShown > (list size - nFullLinesShown) ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3402
"/            firstLineShown := list size - nFullLinesShown
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3403
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3404
"/        list size <= nFullLinesShown ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3405
"/            firstLineShown := 1
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3406
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3407
"/        ^ self
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3408
"/    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  3409
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3410
    (self needScrollToMakeLineVisible:aListLineNr) ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3411
	^ self
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3412
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3413
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3414
    (aListLineNr < nFullLinesShown) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3415
	"/ at the very top of the list - show from top
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3416
	newTopLine := 1
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3417
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3418
	(nFullLinesShown < 3) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3419
	    "/ a small view - show from that line
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3420
	    newTopLine := aListLineNr
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3421
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3422
	    bott := self numberOfLines - (nFullLinesShown - 1).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3423
	    (aListLineNr > bott) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3424
		"/ at the end of the list - show the bottom of the list
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3425
		newTopLine := bott
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3426
	    ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3427
		"/ somewhere else - place selected line into the middle of
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3428
		"/ the view
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3429
		newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3430
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3431
	]
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
  3432
    ].
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3433
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3434
    self scrollToLine:newTopLine.
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3435
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3436
    "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
  3437
    "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
  3438
!
75b8fb924904 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
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
  3441
    "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
  3442
     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
  3443
1808
097b86f1473e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3444
    |index list|
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3445
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3446
    (list := self list) notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3447
	index := list indexOf:someString.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3448
	index ~~ 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3449
	    self makeLineVisible:index
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3450
	]
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
  3451
    ]
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3452
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3453
    "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
  3454
!
75b8fb924904 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
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3456
needScrollToMakeLine:aListLineNr
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3457
    "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
  3458
     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
  3459
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3460
    (aListLineNr >= firstLineShown) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3461
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3462
	    ^ false
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3463
	]
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3464
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3465
    ^ true
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3466
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3467
    "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
  3468
    "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
  3469
!
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3470
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3471
needScrollToMakeLineVisible:aListLineNr
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3472
    "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
  3473
     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
  3474
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3475
    (aListLineNr >= firstLineShown) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3476
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3477
	    ^ false
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3478
	]
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3479
    ].
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3480
    ^ true
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3481
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3482
    "Created: / 7.8.1998 / 15:13:51 / cg"
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3483
    "Modified: / 7.8.1998 / 15:14:44 / cg"
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3484
!
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  3485
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
  3486
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
  3487
    "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
  3488
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3489
    self scrollTo:(viewOrigin + (0 @ height))
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3490
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3491
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
  3492
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3493
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3494
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
  3495
    "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
  3496
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3497
    self scrollTo:(viewOrigin - (0 @ height))
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3498
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3499
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3500
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
  3501
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3502
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3503
scrollDown:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3504
    "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
  3505
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3506
    nLines ~~ 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3507
	self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3508
	       redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3509
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3510
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3511
    "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
  3512
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3513
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3514
scrollDownPixels:pix
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3515
    "change origin to scroll down some pixels 
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3516
     (towards the bottom of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3517
     THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3518
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3519
    pix > 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3520
	self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3521
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3522
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3523
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3524
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3525
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
  3526
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
  3527
    "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
  3528
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3529
    |nPixel|
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3530
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3531
    nPixel := aPixelOffset - viewOrigin x.
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3532
    nPixel ~~ 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3533
	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
  3534
    ]
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3535
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3536
    "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
  3537
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3538
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3539
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
  3540
    "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
  3541
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3542
    nPixel ~~ 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3543
	self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3544
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3545
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3546
    "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
  3547
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3548
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3549
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
  3550
    "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
  3551
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3552
    nPixel ~~ 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3553
	self scrollTo:(self viewOrigin + (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3554
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3555
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3556
    "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
  3557
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3558
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3559
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
  3560
    "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
  3561
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3562
    ^ 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
  3563
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3564
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3565
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
  3566
    "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
  3567
75b8fb924904 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
    ^ 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
  3569
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3570
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3571
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
  3572
    "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
  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
    "scrolling to the end is not really correct (i.e. should scroll to list size - 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
  3575
     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
  3576
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3577
    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
  3578
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3579
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3580
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
  3581
    "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
  3582
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3583
    |pxlOffset leftOffset|
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3584
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3585
    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
  3586
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3587
    aColNr == 1 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3588
	leftOffset ~~ 0 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3589
	    self scrollLeft:leftOffset.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3590
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3591
	^ 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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3594
    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
  3595
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3596
    pxlOffset < leftOffset ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3597
	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
  3598
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3599
	pxlOffset > leftOffset ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3600
	    self scrollRight:(pxlOffset - leftOffset)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3601
	]
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
  3602
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3603
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3604
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3605
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
  3606
    "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
  3607
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3608
    viewOrigin x ~~ 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3609
	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
  3610
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3611
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3612
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3613
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
  3614
    "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
  3615
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3616
    aLineNr < firstLineShown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3617
	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
  3618
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3619
	aLineNr > firstLineShown ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3620
	    self scrollDown:(aLineNr - firstLineShown)
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3621
	]
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
  3622
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3623
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3624
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3625
scrollToPercent:percentOrigin
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3626
    "scroll to a position given in percent of total"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3627
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3628
    "kludge - ListView thinks in lines"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3629
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3630
    self scrollHorizontalToPercent:percentOrigin x.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3631
    self scrollVerticalToPercent:percentOrigin y.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3632
!
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3633
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
  3634
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
  3635
    "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
  3636
75b8fb924904 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
    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
  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
75b8fb924904 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
scrollUp:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3641
    "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
  3642
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3643
    nLines ~~ 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3644
	self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3645
	       redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3646
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3647
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3648
    "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
  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
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3651
scrollUpPixels:pix
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3652
    "change origin to scroll up some pixels 
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3653
     (towards the top of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3654
    THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3655
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3656
    pix > 0 ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3657
	self scrollTo:(viewOrigin - (0 @ pix)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3658
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3659
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3660
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3661
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3662
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
  3663
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
  3664
    "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
  3665
75b8fb924904 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
    |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
  3667
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3668
    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
  3669
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3670
    "/ 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
  3671
    "/
75b8fb924904 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
    nFullLinesShown ~~ nLinesShown ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3673
	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
  3674
    ].
75b8fb924904 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
    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
  3676
    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
  3677
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3679
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
  3680
    "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
  3681
     - 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
  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
    |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
  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
    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
  3686
75b8fb924904 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
    mm := yDistance // self verticalIntegerPixelPerMillimeter + 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
  3688
    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
  3689
75b8fb924904 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
    (deltaT = autoScrollDeltaT) ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3691
	autoScrollDeltaT := deltaT.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3692
	autoScrollBlock isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3693
	    autoScrollBlock := [self realized ifTrue:[self scrollSelectDown]].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3694
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3695
	]
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
  3696
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3697
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3699
startAutoScrollLeft:xDistance
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3700
    "setup for auto-scroll up (when button-press-moving to the left of the 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
  3701
     - 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
  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
    |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
  3704
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3705
    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
  3706
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3707
    mm := xDistance negated // 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
  3708
    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
  3709
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3710
    (deltaT = autoScrollDeltaT) ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3711
	autoScrollDeltaT := deltaT.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3712
	autoScrollBlock isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3713
	    autoScrollBlock := [ self realized ifTrue:[self scrollSelectLeft]].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3714
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3715
	]
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
  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
!
75b8fb924904 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
startAutoScrollRight:xDistance
75b8fb924904 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
    "setup for auto-scroll down (when button-press-moving to the right of the 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
  3721
     - 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
  3722
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3723
    |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
  3724
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3725
    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
  3726
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3727
    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
  3728
    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
  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
    (deltaT = autoScrollDeltaT) ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3731
	autoScrollDeltaT := deltaT.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3732
	autoScrollBlock isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3733
	    autoScrollBlock := [self realized ifTrue:[self scrollSelectRight]].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3734
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3735
	]
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
  3736
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3737
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3738
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3739
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
  3740
    "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
  3741
     - 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
  3742
75b8fb924904 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
    |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
  3744
75b8fb924904 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
    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
  3746
75b8fb924904 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
    mm := yDistance negated // self verticalIntegerPixelPerMillimeter + 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
  3748
    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
  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
    (deltaT = autoScrollDeltaT) ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3751
	autoScrollDeltaT := deltaT.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3752
	autoScrollBlock isNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3753
	    autoScrollBlock := [self realized ifTrue:[self scrollSelectUp]].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3754
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3755
	]
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
  3756
    ]
75b8fb924904 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
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
  3760
    "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
  3761
75b8fb924904 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
    autoScrollBlock notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3763
	self compressMotionEvents:true.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3764
	Processor removeTimedBlock:autoScrollBlock.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3765
	autoScrollBlock := nil.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3766
	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
  3767
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3768
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3769
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3770
verticalScrollStep
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3771
    "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
  3772
     Here, the scrolling unit is lines."
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3773
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3774
    ^ 1
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3775
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3776
    "Created: / 21.5.1999 / 14:00:12 / cg"
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3777
!
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3778
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
  3779
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
  3780
    "return the viewOrigin; thats the coordinate 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
  3781
     which is shown topLeft in the 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
  3782
     (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
  3783
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3784
    ^ 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
  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
2316
c259fe3a937b category change
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  3787
!ListView methodsFor:'scrolling-basic'!
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3788
2331
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3789
additionalMarginForHorizontalScroll
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3790
    "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
  3791
     width of the document would allow.
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3792
     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
  3793
     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
  3794
     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
  3795
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3796
    ^ font width
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3797
!
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  3798
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3799
scrollTo:anOrigin redraw:doRedraw
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3800
    "change origin to have newOrigin be visible at the top-left.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3801
     The argument defines the integer device coordinates of the new top-left 
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3802
     point.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3803
    "
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3804
    |dltOrg
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3805
     noLn "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3806
     max  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3807
     tmp  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3808
     h    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3809
     w    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3810
     y0   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3811
     y1   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3812
     y    "{ Class:SmallInteger }"
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3813
     x    "{ Class:SmallInteger }"
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  3814
     delta newFirstLine newViewOrigin 
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3815
     hBefore wBefore inv wg|
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3816
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3817
    hBefore := height.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3818
    wBefore := width.
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3819
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3820
    dltOrg := anOrigin - viewOrigin.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3821
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3822
"/  compute valid horizontal offset x
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3823
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3824
    (x := dltOrg x) ~~ 0 ifTrue:[
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3825
        tmp := viewOrigin x + x.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3826
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3827
        x < 0 ifTrue:[                                          "/ scrolling left
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3828
            tmp < 0 ifTrue:[x := 0 - viewOrigin x]
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3829
        ] ifFalse:[                                             "/ scrolling right
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3830
         "/ allows scrolling to the right of widest line
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3831
            max := self widthOfContents + (self additionalMarginForHorizontalScroll).
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3832
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3833
            tmp + width > max ifTrue:[
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3834
                x := (max - viewOrigin x - width) max:0
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3835
            ]
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3836
        ]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3837
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3838
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3839
"/  compute valid vertical offset measured in lines
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3840
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3841
    (y := dltOrg y // fontHeight) ~~ 0 ifTrue:[
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3842
        tmp := firstLineShown + y.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3843
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3844
        y < 0 ifTrue:[                                          "/ scrolling up
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3845
            tmp < 1 ifTrue:[y := 1 - firstLineShown]
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3846
        ] ifFalse:[                                             "/ scrolling down
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3847
            max := self size.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3848
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3849
            tmp + nFullLinesShown > max ifTrue:[
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3850
                y := (max - firstLineShown - nFullLinesShown + 1) max:0
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3851
            ]
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3852
        ]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3853
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3854
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3855
    (x == 0 and:[y == 0]) ifTrue:[                              "/ has viewOrigin changed ?
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3856
        ^ self
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3857
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3858
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3859
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3860
    (noLn := y) ~~ 0 ifTrue:[
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3861
        y := y * fontHeight
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3862
    ].
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3863
    delta := (x @ y).
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3864
1582
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3865
    newFirstLine := firstLineShown + noLn.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3866
    newViewOrigin := viewOrigin + delta.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3867
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3868
    (shown and:[doRedraw]) ifFalse:[
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3869
        self originWillChange.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3870
        firstLineShown := newFirstLine.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3871
        viewOrigin := newViewOrigin.
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
  3872
viewOrigin x < 0 ifTrue:[self error:'bad view origin'].
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3873
        ^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3874
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3875
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3876
"/    (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[               "/ outstanding expose events
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3877
"/        self invalidate.                                        "/ redraw all
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3878
"/        self originWillChange.
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3879
"/        ^ self originChanged:(x @ y )
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3880
"/    ].
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3881
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3882
    (     (y ~~ 0 and:[x ~~ 0])         "/ both x and y changed
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3883
      or:[(noLn abs) >= nLinesShown     "/ at least one area is
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3884
      or:[(x abs) > (width // 4 * 3)]]  "/ big enough to redraw all
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3885
    ) ifTrue:[
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3886
        self originWillChange.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3887
        firstLineShown := newFirstLine.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3888
        viewOrigin := newViewOrigin.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3889
        self invalidate.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3890
        ^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3891
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3892
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3893
    "/ OLD:
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3894
    "/ self repairDamage.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  3895
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3896
    (wg := self windowGroup) notNil ifTrue:[
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3897
        wg processRealExposeEventsFor:self.
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3898
    ].
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3899
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3900
    self originWillChange.
1970
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3901
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3902
    "/ make certain, that all drawing is complete
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3903
    "/ device sync.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3904
1975
0eda51a6d48e uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents: 1972
diff changeset
  3905
    self catchExpose.
1970
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3906
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3907
    x == 0 ifTrue:[                                             
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3908
        "/ scrolling vertical
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3909
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3910
        y0 := textStartTop + (y abs).
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3911
        h  := hBefore - margin - y0.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3912
        w  := wBefore - margin.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3913
        y > 0 ifTrue:[                                          "/ copy down
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3914
            "/ kludge: if the selection highlighting draws into the textStartTop area,
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3915
            "/ the copy below leaves some selection depris in the top area.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3916
            "/ Therefore, clear the top area.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3917
            "/ (should avoid this, in case we know there cannot be anything
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3918
            "/  there - selection is nil or >= firstLineShown).
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3919
            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
  3920
"/            self invalidateDeviceRectangle:((margin@margin) corner:(width-margin@textStartTop)) repairNow:false.
1977
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  3921
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3922
            self copyFrom:self
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3923
                        x:0 y:y0 toX:0 y:textStartTop
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3924
                    width:w height:h async:true.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3925
            y1 := h - 1.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3926
            y0 := y0 + 1.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3927
        ] ifFalse:[                                             "/ copy up
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3928
            self copyFrom:self
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3929
                        x:margin y:textStartTop toX:margin y:y0
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3930
                    width:w height:h async:true.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3931
            y1 := 0.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3932
        ].
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3933
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3934
        inv := (margin@y1) extent:(w@y0).      
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3935
    ] ifFalse:[                                                 
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3936
        "/ scrolling horizontal
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3937
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3938
        x > 0 ifTrue:[                                          "/ scrolling right
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3939
            y0 := margin + x.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3940
            y1 := wBefore - y0.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3941
        ] ifFalse:[                                             "/ scrolling left
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3942
            y0 := margin - x.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3943
            y1 := 0.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3944
        ].
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3945
        h := hBefore - margin - margin.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3946
        w := wBefore - margin - y0.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3947
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3948
        x > 0 ifTrue:[                                          "/ copy right
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3949
            self copyFrom:self x:y0 y:margin toX:margin y:margin
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3950
                    width:w height:h async:true.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3951
        ] ifFalse:[                                             "/ copy left
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3952
            "/self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3953
            self copyFrom:self x:margin y:margin toX:y0 y:margin
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3954
                    width:w height:h async:true.
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3955
        ].
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3956
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3957
        inv := (y1@margin) extent:(y0@h).      
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3958
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3959
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3960
    firstLineShown := newFirstLine.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3961
    viewOrigin := newViewOrigin.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  3962
1885
Claus Gittinger <cg@exept.de>
parents: 1884
diff changeset
  3963
    self invalidateDeviceRectangle:inv repairNow:false.
1712
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  3964
1975
0eda51a6d48e uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents: 1972
diff changeset
  3965
    self originChanged:delta.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  3966
    self waitForExpose.
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3967
2202
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  3968
    (wg := self windowGroup) notNil ifTrue:[
2513
c480b6ee5cc7 bug fix when text is replaced by shorter text while beeing
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3969
        wg processRealExposeEventsFor:self.
2202
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  3970
    ].
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  3971
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3972
"/    (hBefore ~= height or:[wBefore ~= width]) ifTrue:[
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3973
"/        self halt.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3974
"/    ].
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3975
1983
3261af8573c6 scrolling redraw bug on w32
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
  3976
    "Modified: / 11.8.1999 / 19:40:47 / cg"
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3977
! !
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3978
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
  3979
!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
  3980
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3981
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
  3982
    "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
  3983
     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
  3984
     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
  3985
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3986
    |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
  3987
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3988
    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
  3989
    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
  3990
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3991
    "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
  3992
    (wordCheck value:thisCharacter) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3993
	[wordCheck value:thisCharacter] whileTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3994
	    beginCol := beginCol - 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3995
	    beginCol < 1 ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3996
		thisCharacter := Character space
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3997
	    ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3998
		thisCharacter := self characterAtLine:selectLine col:beginCol
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  3999
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4000
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4001
	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
  4002
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4003
	"nope - maybe its a space"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4004
	thisCharacter == Character space ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4005
	    [beginCol > 1 and:[thisCharacter == Character space]] whileTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4006
		beginCol := beginCol - 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4007
		thisCharacter := self characterAtLine:selectLine col:beginCol
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4008
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4009
	    thisCharacter ~~ Character space ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4010
		beginCol := beginCol + 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4011
	    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4012
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4013
	    "select single character"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4014
	]
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
  4015
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4016
    ^ 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
  4017
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4018
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4019
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
  4020
    "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
  4021
     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
  4022
     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
  4023
     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
  4024
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4025
    |endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4026
     len    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4027
     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
  4028
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4029
    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
  4030
    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
  4031
    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
  4032
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4033
    "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
  4034
    (wordCheck value:thisCharacter) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4035
	thisCharacter := self characterAtLine:selectLine col:endCol.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4036
	[wordCheck value:thisCharacter] whileTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4037
	    endCol := endCol + 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4038
	    thisCharacter := self characterAtLine:selectLine col:endCol
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4039
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4040
	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
  4041
    ] ifFalse:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4042
	"nope - maybe its a space"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4043
	thisCharacter == Character space ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4044
	    len := (self listAt:selectLine) size.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4045
	    endCol > len ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4046
		"select rest to end"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4047
		endCol := 0
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4048
	    ] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4049
		thisCharacter := self characterAtLine:selectLine col:endCol.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4050
		[endCol <= len and:[thisCharacter == Character space]] whileTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4051
		    endCol := endCol + 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4052
		    thisCharacter := self characterAtLine:selectLine col:endCol
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4053
		].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4054
		endCol := endCol - 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4055
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4056
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4057
	    "select single character"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4058
	]
125
claus
parents: 121
diff changeset
  4059
    ].
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
  4060
    ^ 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
  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
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4063
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
  4064
    "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
  4065
     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
  4066
     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
  4067
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4068
    |lineString 
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4069
     found firstChar1 firstChar2 c pc
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4070
     col         "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4071
     cc          "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4072
     patternSize "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4073
     line1       "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4074
     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
  4075
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4076
    patternSize := pattern size.
2508
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4077
    (list notNil 
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4078
    and:[startLine > 0 
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4079
    and:[patternSize ~~ 0]]) 
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4080
    ifTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4081
        self withCursor:Cursor questionMark do:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4082
            col := startCol - 1.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4083
            firstChar1 := pattern at:1.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4084
            ignCase ifTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4085
                firstChar1 := firstChar1 asLowercase.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4086
                firstChar2 := firstChar1 asUppercase.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4087
            ] ifFalse:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4088
                firstChar2 := firstChar1
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4089
            ].
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4090
            col > (list at:startLine) size ifTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4091
                col := -999
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4092
            ].
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4093
            line1 := startLine.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4094
            line1 to:1 by:-1 do:[:lnr |
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4095
                lineString := list at:lnr.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4096
                lineString notNil ifTrue:[
2562
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4097
                    lineString := lineString asString
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4098
                ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4099
                lineString notNil ifTrue:[
2508
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4100
                    lineSize := lineString size.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4101
                    col == -999 ifTrue:[col := lineSize - patternSize + 1].
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4102
                    [(col > 0) 
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4103
                     and:[(c := lineString at:col) ~= firstChar1
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4104
                     and:[c ~= firstChar2]]] whileTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4105
                        col := col - 1
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4106
                    ].
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4107
                    [col > 0] whileTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4108
                        cc := col.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4109
                        found := true.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4110
                        1 to:patternSize do:[:cnr |
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4111
                            cc > lineSize ifTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4112
                                found := false
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4113
                            ] ifFalse:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4114
                                pc := pattern at:cnr.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4115
                                c := lineString at:cc.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4116
                                pc ~= c ifTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4117
                                    (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4118
                                        found := false
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4119
                                    ]
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4120
                                ]
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4121
                            ].
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4122
                            cc := cc + 1
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4123
                        ].
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4124
                        found ifTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4125
                            ^ block1 value:lnr value:col.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4126
                        ].
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4127
                        col := col - 1.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4128
                        [(col > 0) 
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4129
                        and:[(c := lineString at:col) ~= firstChar1
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4130
                        and:[c ~= firstChar2]]] whileTrue:[
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4131
                            col := col - 1
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4132
                        ]
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4133
                    ]
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4134
                ].
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4135
                col := -999.
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4136
            ]
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4137
        ]
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
  4138
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4139
    "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
  4140
75b8fb924904 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
    ^ block2 value
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4142
2508
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4143
    "Created: / 13.9.1997 / 01:06:19 / cg"
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4144
    "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
  4145
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4146
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4147
searchBackwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4148
    "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
  4149
     found evaluate block2.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4150
     Sorry, but pattern is no regular expression pattern (yet)"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4151
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4152
    ^ self
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4153
	searchBackwardFor:pattern 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4154
	ignoreCase:false 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4155
	startingAtLine:startLine col:startCol 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4156
	ifFound:block1 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4157
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4158
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4159
    "Modified: 13.9.1997 / 01:07:36 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4160
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4161
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4162
searchForwardFor: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
  4163
    "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
  4164
     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
  4165
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  4166
    |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
  4167
     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
  4168
     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
  4169
     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
  4170
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4171
    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
  4172
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
2562
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4173
        self withCursor:Cursor questionMark do:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4174
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4175
            col := startCol + 1.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4176
            line1 := startLine.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4177
            line2 := list size.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4178
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4179
            pattern includesUnescapedMatchCharacters ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4180
                p := pattern species new:0.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4181
                (pattern startsWith:$*) ifFalse:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4182
                    p := p , '*'
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4183
                ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4184
                p := p , pattern.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4185
                (pattern endsWith:$*) ifFalse:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4186
                    p := p , '*'
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4187
                ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4188
                realPattern := pattern.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4189
                (realPattern startsWith:$*) ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4190
                    realPattern := realPattern copyFrom:2
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4191
                ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4192
                line1 to:line2 do:[:lnr |
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4193
                    lineString := list at:lnr.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4194
                    lineString notNil ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4195
                        "/ first a crude check ...
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4196
                        (p match:lineString ignoreCase:ignCase) ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4197
                            "/ ok, there it is; look at which position
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4198
                            col := lineString 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4199
                                        findMatchString:realPattern 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4200
                                        startingAt:col 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4201
                                        ignoreCase:ignCase 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4202
                                        ifAbsent:0.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4203
                            col ~~ 0 ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4204
                                ^ block1 value:lnr value:col.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4205
                            ]
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4206
                        ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4207
                    ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4208
                    col := 1
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4209
                ]
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4210
            ] ifFalse:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4211
                p := pattern withoutMatchEscapes.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4212
                line1 to:line2 do:[:lnr |
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4213
                    lineString := list at:lnr.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4214
                    lineString notNil ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4215
                        lineString := lineString asString
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4216
                    ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4217
                    lineString isString ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4218
                        ignCase ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4219
                            col := lineString 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4220
                                        findMatchString:p 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4221
                                        startingAt:col 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4222
                                        ignoreCase:ignCase 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4223
                                        ifAbsent:0.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4224
                        ] ifFalse:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4225
                            col := lineString 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4226
                                        findString:p 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4227
                                        startingAt:col 
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4228
                                        ifAbsent:0.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4229
                        ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4230
                        col ~~ 0 ifTrue:[
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4231
                            ^ block1 value:lnr value:col.
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4232
                        ]
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4233
                    ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4234
                    col := 1
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4235
                ]
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4236
            ].
bf1ac08c9de5 searching with non-string items
Michael Beyl <mb@exept.de>
parents: 2561
diff changeset
  4237
        ]
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
  4238
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4239
    "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
  4240
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4241
    ^ block2 value
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  4242
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4243
    "Created: 13.9.1997 / 01:06:31 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4244
    "Modified: 13.9.1997 / 01:11:28 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4245
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4246
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4247
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4248
    "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
  4249
     found evaluate block2."
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4250
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4251
    ^ self
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4252
	searchForwardFor:pattern 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4253
	ignoreCase:false 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4254
	startingAtLine:startLine col:startCol 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4255
	ifFound:block1 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4256
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4257
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4258
    "Modified: 13.9.1997 / 01:07:11 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  4259
! !
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
  4260
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4261
!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
  4262
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4263
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
  4264
    "go through whole text expanding tabs into 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
  4265
     This is meant to be called for text being imported 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
  4266
     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
  4267
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4268
    |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
  4269
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4270
    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
  4271
    list notNil ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4272
	nLines := self size.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4273
	1 to:nLines do:[:index |
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4274
	    line := self at:index.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4275
	    line notNil ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4276
		line isString ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4277
		    newLine := line withTabsExpanded.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4278
		    newLine ~~ line ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4279
			list at:index put:newLine
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4280
		    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4281
		] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4282
		    includesNonStrings := true.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4283
		]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4284
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4285
	]
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
  4286
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4287
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4288
    "Modified: 30.8.1995 / 19:06:37 / claus"
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  4289
    "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
  4290
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4291
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4292
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
  4293
    "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
  4294
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4295
    ^ self 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
  4296
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4297
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4298
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
  4299
    "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
  4300
     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
  4301
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4302
    |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
  4303
     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
  4304
     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
  4305
     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
  4306
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4307
    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
  4308
    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
  4309
    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
  4310
    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
  4311
    [thisTab <= col] whileTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4312
	(tabIndex == nTabs) ifTrue:[^ thisTab].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4313
	tabIndex := tabIndex + 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4314
	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
  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
    ^ 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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4319
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
  4320
    "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
  4321
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4322
    |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
  4323
     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
  4324
     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
  4325
     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
  4326
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4327
    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
  4328
    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
  4329
    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
  4330
    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
  4331
    [thisTab < col] whileTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4332
	(tabIndex == nTabs) ifTrue:[^ thisTab].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4333
	tabIndex := tabIndex + 1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4334
	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
  4335
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4336
    (tabIndex == 1) ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4337
	^ 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
  4338
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4339
    ^ 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
  4340
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4341
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4342
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
  4343
    "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
  4344
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4345
    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
  4346
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4347
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4348
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
  4349
    "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
  4350
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4351
    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
  4352
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4353
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4354
setTabPositions:aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4355
    "set tab stops"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4356
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4357
    tabPositions := aVector.
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4358
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  4359
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
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
  4361
    "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
  4362
     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
  4363
     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
  4364
     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
  4365
     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
  4366
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4367
    |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
  4368
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4369
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4370
     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
  4371
     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
  4372
     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
  4373
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4374
    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
  4375
    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
  4376
    (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
  4377
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4378
    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
  4379
    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
  4380
    [newLine startsWith:eightSpaces] whileTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4381
	newLine := newLine copyFrom:9.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4382
	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
  4383
    ].
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4384
    ^ (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
  4385
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4386
    "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
  4387
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4389
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
  4390
    "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
  4391
     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
  4392
     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
  4393
     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
  4394
75b8fb924904 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
    |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
  4396
     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
  4397
     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
  4398
     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
  4399
75b8fb924904 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
     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
  4402
     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
  4403
     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
  4404
     (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
  4405
      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
  4406
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4407
    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
  4408
    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
  4409
    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
  4410
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4411
    currentMax := line size + (nTabs * 7).
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4412
    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
  4413
    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
  4414
    line do:[:character |
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4415
	(character == (Character tab)) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4416
	    nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4417
	    [dstIndex < nextTab] whileTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4418
		tmpString at:dstIndex put:(Character space).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4419
		dstIndex := dstIndex + 1
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4420
	    ]
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4421
	] ifFalse:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4422
	    tmpString at:dstIndex put:character.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4423
	    dstIndex := dstIndex + 1
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4424
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4425
	(dstIndex > currentMax) ifTrue:[
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4426
	    "
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4427
	     this cannot happen with <= 8 tabs
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4428
	    "
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4429
	    currentMax := currentMax + currentMax.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4430
	    nString := line species new:currentMax.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4431
	    nString replaceFrom:1 to:(dstIndex - 1) 
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4432
			   with:tmpString startingAt:1.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4433
	    tmpString := nString.
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4434
	    nString := nil
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4435
	].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4436
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4437
	"make stc-optimizer happy
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4438
	 - no need to return value of ifTrue:/ifFalse above"
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4439
	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
  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
    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
  4442
    dstIndex == currentMax ifTrue:[
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  4443
	^ 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
  4444
    ].
75b8fb924904 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
    ^ tmpString copyTo:dstIndex
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4446
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4447
    "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
  4448
!
75b8fb924904 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
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
  4451
    "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
  4452
     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
  4453
     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
  4454
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4455
    ^ 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
  4456
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4457
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  4458
!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
  4459
75b8fb924904 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
version
2649
Claus Gittinger <cg@exept.de>
parents: 2648
diff changeset
  4461
    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.276 2002-10-29 10:18:16 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
  4462
! !