ListView.st
author Claus Gittinger <cg@exept.de>
Thu, 10 Aug 2000 00:18:02 +0200
changeset 2208 a37459b4dffa
parent 2202 edf8821d56a1
child 2209 70076d488bf7
permissions -rw-r--r--
*** empty log message ***
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
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
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
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    16
	instanceVariableNames:'list firstLineShown leftOffset nFullLinesShown 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
    17
		fgColor bgColor partialLines leftMargin topMargin textStartLeft
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    18
		textStartTop innerWidth tabPositions lineSpacing 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
    19
		fontAscent fontIsFixedWidth fontWidth autoScroll autoScrollBlock
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
    20
		autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
    21
		listMsg viewOrigin listChannel backgroundAlreadyClearedColor
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
    22
		scrollWhenUpdating'
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
    23
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions
1699
b10682bac6f9 async redraw when scrolling horizontally
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    24
		DefaultLeftMargin DefaultTopMargin'
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    25
	poolDictionaries:''
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
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
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
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.
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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 
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   131
                                                  The default rule is to return true for alphaNumeric characters.
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   132
                                                  (can be changed to allow for underscore and other
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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,
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   142
                                                  this is sent to the model to aquired a new contents
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   148
                                                  multiple fills when drawing
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   149
                                                  internal lines
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
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   152
                                <Symbol>        defines how the view is scrolled if the
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   153
                                                model changes its value by some outside activity
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   154
                                                (i.e. not by user input).
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   155
                                                Can be one of:
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   156
                                                    #keep / nil     -> stay unchanged
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   157
                                                    #endOfText      -> scroll to the end
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   158
                                                    #beginOfText    -> scroll to the top
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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:]
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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:]
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
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:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   185
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   186
	|top l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   187
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   188
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   189
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   190
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   191
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   192
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   193
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   194
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
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):
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   200
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   201
	|top l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   202
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   203
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   204
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   205
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   206
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   207
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   208
	l topMargin:10.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   209
	l leftMargin:20.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   210
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   211
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
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:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   217
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   218
	|top l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   219
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   220
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   221
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   222
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   223
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   224
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   225
	l foregroundColor:(Color white).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   226
	l backgroundColor:(Color blue).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   227
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   228
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
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:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   234
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   235
	|top list l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   236
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   237
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   238
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   239
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   240
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   241
	list := #('all' 'of' 'your' 'preferred' 'colors') 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   242
		with:#(red green blue 'orange' cyan)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   243
		collect:[:s :clr | 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   244
			    Text string:s 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   245
				 emphasis:(Array with:#bold
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   246
						 with:(#color->(Color name:clr))) ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   247
	l list:list.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   248
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   249
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
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)
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   256
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   257
	|top list l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   258
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   259
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   260
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   261
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   262
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   263
	list := #('all' 'of' 'your' 'preferred' 'colors') 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   264
		with:#(red green blue 'orange' cyan)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   265
		collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   266
	l list:list.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   267
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   268
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
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):
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   274
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   275
	|top model l theModelsText|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   276
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   277
	model := Plug new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   278
	model respondTo:#modelsAspect
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   279
		   with:[ theModelsText ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   280
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   281
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   282
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   283
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   284
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   285
	l model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   286
	l aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   287
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   288
	top open.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   289
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   290
	Delay waitForSeconds:3.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   291
	theModelsText := #('foo' 'bar' 'baz').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   292
	model changed:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
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:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   299
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   300
	|top model l1 l2 plainText|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   301
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   302
	plainText := #('').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   303
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   304
	model := Plug new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   305
	model respondTo:#modelsUppercaseText
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   306
		   with:[ plainText asStringCollection 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   307
			      collect:[:l | l asUppercase]].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   308
	model respondTo:#modelsLowercaseText
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   309
		   with:[ plainText asStringCollection 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   310
			      collect:[:l | l asLowercase]].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   311
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   312
	top := StandardSystemView extent:200@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   313
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   314
	l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   315
	l1 model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   316
	l1 aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   317
	l1 listMessage:#modelsUppercaseText.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   318
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   319
	l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   320
	l2 model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   321
	l2 aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   322
	l2 listMessage:#modelsLowercaseText.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   323
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   324
	top open.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   325
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   326
	Delay waitForSeconds:3.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   327
	plainText := #('foo' 'bar' 'baz').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   328
	model changed:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
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
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   337
    "return an array containing the default tab positions"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   338
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   339
    ^ self tab8Positions
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   340
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   341
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   342
tab4Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   343
    "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
   344
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   345
    ^ #(1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   346
	85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145)
120
claus
parents: 118
diff changeset
   347
!
claus
parents: 118
diff changeset
   348
claus
parents: 118
diff changeset
   349
tab8Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   350
    "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
   351
120
claus
parents: 118
diff changeset
   352
    ^ #(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
   353
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   354
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   355
updateStyleCache
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   356
    "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
   357
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   358
    <resource: #style (#'text.foregroundColor' #'text.backgroundColor'
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   359
		       #'text.tabPositions'
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   360
		       #'text.font')>
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   361
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   362
    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   363
    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:White.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   364
    DefaultFont := StyleSheet fontAt:'text.font'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   365
    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
   366
    DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions].
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   367
    DefaultLeftMargin := 0.5.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   368
    DefaultTopMargin := 0.5.
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   369
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   370
    "Modified: 20.10.1997 / 15:05:30 / 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
   371
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   372
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   373
!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
   374
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   375
backgroundColor
75b8fb924904 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
    "return the background color"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   377
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   378
    ^ 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
   379
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   380
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   381
backgroundColor:aColor
1222
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   382
    "set the background color of the contents"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   383
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   384
    bgColor ~~ aColor ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   385
	bgColor := aColor.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   386
	self viewBackground:bgColor.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   387
	shown ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   388
	    self invalidate "/ clear; redraw
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   389
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   390
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   391
1222
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   392
    "Modified: 3.5.1997 / 10:27:40 / 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
   393
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   394
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   395
font:aFont
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   396
    "set the font for all shown text.
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   397
     Redraws everything.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   398
     CAVEAT: with the addition of Text objects,
1979
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   399
             this method is going to be obsoleted by a textStyle
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   400
             method, which allows specific control over
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   401
             normalFont/boldFont/italicFont parameters."
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   402
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   403
    aFont isNil ifTrue:[
1979
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   404
        ^ self error:'nil font' mayProceed: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
   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
    font ~~ aFont ifTrue:[
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   407
        super font:(aFont onDevice:device).
1979
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   408
        preferredExtent := nil.
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   409
        widthOfWidestLine := nil. "/ i.e. unknown
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   410
        self getFontParameters.
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   411
        realized ifTrue:[
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   412
            (font graphicsDevice == device) ifTrue:[
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   413
                self getFontParameters.
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   414
                self computeNumberOfLinesShown.
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   415
                shown ifTrue:[
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   416
                    self redrawFromVisibleLine:1 to:nLinesShown
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   417
                ]
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   418
            ].
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   419
            self contentsChanged
a9d9a0dca46f error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
   420
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   421
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   422
780
48f97576806f use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 776
diff changeset
   423
    "Modified: 5.7.1996 / 17:55:34 / 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
   424
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   425
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   426
fontHeight:pixels
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   427
    "set the lines height - thats the number of pixels,
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   428
     by which lines are vertically separated."
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   429
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   430
    fontHeight ~~ pixels ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   431
	fontHeight := pixels.
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   432
    ]
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   433
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   434
    "Created: 17.4.1997 / 01:41:33 / cg"
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   435
!
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   436
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   437
foregroundColor
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   438
    "return the foreground color"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   439
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   440
    ^ 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
   441
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   442
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   443
foregroundColor:aColor
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   444
    "set the foreground color"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   445
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   446
    fgColor ~~ aColor ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   447
	fgColor := aColor.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   448
	shown ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   449
	    self invalidate 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   450
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   451
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   452
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   453
    "Modified: 29.5.1996 / 16:19:02 / 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
   454
!
75b8fb924904 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
75b8fb924904 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
foregroundColor:color1 backgroundColor:color2
75b8fb924904 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
    "set both foreground and background 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
   458
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   459
    ((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   460
	fgColor := color1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   461
	bgColor := color2.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   462
	shown ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   463
	    self invalidate 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   464
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   465
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   466
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   467
    "Modified: 29.5.1996 / 16:19:05 / 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
   468
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   469
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   470
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
   471
    "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
   472
     - 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
   473
     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
   474
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   475
    ^ 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
   476
!
75b8fb924904 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
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   478
innerHorizontalMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   479
    "return the margin between the left border and the 1st col"
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   480
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   481
    ^ leftMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   482
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   483
    "Created: 16.1.1996 / 19:28:23 / cg"
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   484
!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   485
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   486
innerVerticalMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   487
    "return the margin between the top border and the 1st line"
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   488
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   489
    ^ topMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   490
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   491
    "Created: 16.1.1996 / 19:28:00 / cg"
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   492
!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   493
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   494
leftMargin
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   495
    "return the margin to left of 1st 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
   496
75b8fb924904 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
    ^ leftMargin
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   498
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   499
75b8fb924904 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
leftMargin:aNumber
75b8fb924904 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
    "set the margin between the left border and the 1st 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
   502
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   503
    leftMargin := aNumber.
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   504
    textStartLeft := aNumber + margin.
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   505
    innerWidth := width - aNumber - margin
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   506
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   507
    "Modified: 28.2.1996 / 19:32:55 / 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
   508
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   509
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   510
level:aNumber
1249
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   511
    "set the 3D level - caught here to update text-position variables
249
75b8fb924904 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
     (which avoids many computations later)"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   513
376
fb823917008e correctly handle level changes if abs(lvl) changes
ca
parents: 352
diff changeset
   514
    |newMargin|
fb823917008e correctly handle level changes if abs(lvl) changes
ca
parents: 352
diff changeset
   515
1298
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   516
    aNumber ~~ level ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   517
	newMargin := aNumber abs.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   518
	textStartLeft := leftMargin + newMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   519
	textStartTop := topMargin + newMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   520
	innerWidth := width - textStartLeft - newMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   521
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   522
	super level:aNumber.
1298
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   523
    ]
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   524
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   525
    "Modified: 11.8.1997 / 02:59:15 / 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
   526
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   527
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   528
lineSpacing:pixels
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   529
    "set the lineSpacing - thats an additional number of 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
   530
     by which lines are vertically separated."
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   531
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   532
    lineSpacing ~~ pixels ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   533
	lineSpacing := pixels.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   534
	self getFontParameters.
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   535
    ]
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   536
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   537
    "Modified: 22.5.1996 / 12:22:29 / 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
   538
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   539
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   540
partialLines:aBoolean
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   541
    "allow/disallow display of a 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
   542
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   543
    partialLines := aBoolean.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   544
    self 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
   545
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   546
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   547
topMargin:aNumber
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   548
    "set the margin between the top border and the 1st 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
   549
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   550
    topMargin := aNumber.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   551
    textStartTop := topMargin + margin.
339
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   552
!
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   553
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   554
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
   555
    "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
   556
     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
   557
     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
   558
     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
   559
     (national) characters.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   560
     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
   561
     (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
   562
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   563
    wordCheck := aBlock.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   564
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   565
    "Modified: 22.5.1996 / 12:26:55 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   566
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   567
2133
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
   568
!ListView methodsFor:'accessing-behavior'!
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   569
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   570
scrollWhenUpdating:aSymbolOrNil
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   571
    "define how to scroll, when I get a new text 
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   572
     (via the model or the #contents/#list)
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   573
     Allowed arguments are:
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   574
        #keep / nil     -> no change
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   575
        #endOfText      -> scroll to the end
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   576
        #beginOfText    -> scroll to the top
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   577
     The default is #beginOfText.
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   578
     This may be useful for fields which get new values assigned from
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   579
     the program (i.e. not from the user)"
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   580
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   581
    scrollWhenUpdating := aSymbolOrNil
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   582
! !
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   583
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   584
!ListView methodsFor:'accessing-contents'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   585
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   586
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
   587
    "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
   588
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   589
    list 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
   590
    includesNonStrings ifFalse:[
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   591
        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
   592
"/        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
   593
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   594
    shown ifTrue:[
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   595
        self redrawLine:(self size).
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   596
    ].
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   597
    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
   598
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   599
    "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
   600
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   601
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   602
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
   603
    "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
   604
1351
03d1b138f98f add:aString beforeIndex:
ca
parents: 1338
diff changeset
   605
    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
   606
    list 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
   607
    includesNonStrings ifFalse:[
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   608
        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
   609
"/        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
   610
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   611
    shown ifTrue:[
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   612
        self redrawFromLine:index.
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   613
    ].
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   614
    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
   615
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   616
    "Modified: 22.10.1996 / 23:18:53 / cg"
65
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   617
!
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   618
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   619
at:lineNr
120
claus
parents: 118
diff changeset
   620
    "retrieve a line; return nil if beyond end-of-text.
claus
parents: 118
diff changeset
   621
     this allows textViews to be used like collections in some places."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   622
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   623
    list isNil ifTrue:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   624
    (lineNr between:1 and:self size) ifFalse:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   625
    ^ list at:lineNr
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   626
!
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   627
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   628
at:index put:aString
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   629
    "change a line and redisplay"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   630
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   631
    |visibleLine y fontHeightBefore|
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   632
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   633
    fontHeightBefore := fontHeight.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   634
    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
   635
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   636
    shown ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   637
	"/ synchronous drawing:
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   638
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   639
	"/ this could have changed the font height;
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   640
	"/ must clear all below last line, if it became smaller
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   641
	fontHeightBefore > fontHeight ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   642
	    (self listLineIsVisible:(self size)) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   643
		self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1))
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   644
				    corner:(width-margin) @ (height-margin).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   645
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   646
	    self redrawFromLine:index
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   647
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   648
	    self redrawLine:index
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   649
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   650
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   651
	"/ asynchronous:
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   652
"/        visibleLine := self listLineToVisibleLine:index.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   653
"/        visibleLine notNil ifTrue:[
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   654
"/            y := self yOfVisibleLine:visibleLine.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   655
"/            self invalidate:((margin @ y) extent:(width@fontHeight))
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   656
"/        ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   657
    ]
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   658
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   659
    "Modified: / 26.7.1998 / 13:36:33 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   660
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   661
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   662
characterAtLine:lineNr col:colNr
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   663
    "return the character at physical line/col. 
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   664
     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
   665
     Return a space character if nothing is there
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   666
     (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
   667
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   668
    |line|
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   669
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   670
    list notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   671
	line := self listAt:lineNr.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   672
	line notNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   673
	    (line size >= colNr) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   674
		^ line at:colNr
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   675
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   676
	]
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   677
    ].
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   678
    ^ Character space
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   679
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   680
    "Created: 29.4.1996 / 12:11:00 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   681
    "Modified: 29.4.1996 / 12:12:41 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   682
!
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   683
249
75b8fb924904 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
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
   685
    "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
   686
75b8fb924904 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
    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
   688
    ^ list asStringCollection asString
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   689
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   690
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   691
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
   692
    "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
   693
     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
   694
     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
   695
     to a collection of line-strings here."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   696
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   697
    |l|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   698
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   699
    l := something.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   700
    l notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   701
	l isString ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   702
	    l := l asStringCollection
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   703
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   704
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   705
    self list:l
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   706
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   707
    "Modified: 5.6.1997 / 11:11:54 / cg"
51
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   708
!
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   709
249
75b8fb924904 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
from:from to:to do:aBlock
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   711
    "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
   712
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   713
    ^ list from:from to:to do:aBlock.
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   714
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   715
    "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
   716
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   717
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   718
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
   719
    "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
   720
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   721
    ^ 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
   722
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   723
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   724
list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   725
    "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
   726
     This returns the views internal list - modifying it may confuse
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   727
     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
   728
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   729
    ^ list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   730
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   731
    "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
   732
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   733
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   734
list:aCollection
128
claus
parents: 127
diff changeset
   735
    "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
   736
     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
   737
     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
   738
     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
   739
     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
   740
     (remembered to optimize later redraws)."
128
claus
parents: 127
diff changeset
   741
claus
parents: 127
diff changeset
   742
    self list:aCollection expandTabs:true
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   743
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   744
    "Modified: 5.6.1997 / 11:10:45 / cg"
128
claus
parents: 127
diff changeset
   745
!
claus
parents: 127
diff changeset
   746
claus
parents: 127
diff changeset
   747
list:aCollection expandTabs:expand
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   748
    "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
   749
     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
   750
     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
   751
     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
   752
     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
   753
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   754
    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
   755
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   756
    "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
   757
!
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   758
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   759
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
   760
    "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
   761
     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
   762
     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
   763
     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
   764
     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
   765
     (remembered to optimize later redraws)."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   766
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   767
    self
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   768
        list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   769
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   770
    "Modified: 5.6.1997 / 12:40:35 / cg"
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   771
!
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   772
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   773
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
   774
    "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
   775
     and scroll as specified in scrollWhenUpdating (default:top-left).
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   776
     If expand is true, tabs are expanded (to spaces).
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   777
     If scan is true, scan the passed list for nonStrings; 
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   778
     otherwise, take the information from the nonStrings arg.
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   779
     (the nonStrings information is remembered to optimize later redraws & height computations)."
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   780
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   781
    |oldFirst oldLeft nonStringsBefore fontHeightBefore
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   782
     scrollToEnd scrollToTop|
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   783
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   784
    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
   785
    scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   786
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   787
    (aCollection isNil and:[list isNil]) ifTrue:[
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   788
        "no contents change"
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   789
        scrollToTop ifTrue:[
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   790
            self scrollToTop.
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   791
            self scrollToLeft.
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   792
        ] ifFalse:[
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   793
            scrollToEnd ifTrue:[
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   794
                self scrollToBottom.
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   795
            ]
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   796
        ].
1985
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   797
        ^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   798
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   799
    list := aCollection.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   800
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   801
    nonStringsBefore := includesNonStrings.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   802
    fontHeightBefore := fontHeight.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   803
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   804
152
claus
parents: 148
diff changeset
   805
    list notNil ifTrue:[
1985
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   806
        expand ifTrue:[
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   807
            self expandTabs
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   808
        ] ifFalse:[
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   809
            scan ifTrue:[
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   810
                includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   811
            ] ifFalse:[
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   812
                includesNonStrings := nonStrings
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   813
            ]
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   814
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   815
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   816
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
1985
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   817
        self getFontParameters.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   818
    ].
152
claus
parents: 148
diff changeset
   819
125
claus
parents: 121
diff changeset
   820
    widthOfWidestLine := nil.   "/ i.e. unknown
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   821
    oldFirst := firstLineShown.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   822
    oldLeft := leftOffset.
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   823
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   824
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   825
        self computeNumberOfLinesShown.
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   826
    ].
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   827
    scrollToTop ifTrue:[
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   828
        firstLineShown := 1.
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   829
        leftOffset := 0.
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   830
    ] ifFalse:[
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   831
        scrollToEnd ifTrue:[
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
   832
            firstLineShown := (list size - nFullLinesShown + 1) max:1.
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   833
            leftOffset := 0.
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   834
        ]
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   835
    ].
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   836
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   837
    realized ifTrue:[
1985
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   838
        self contentsChanged.
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   839
        "
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   840
         dont use scroll here to avoid double redraw
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   841
        "
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   842
        viewOrigin := 0 @ 0.
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   843
        transformation := nil.
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   844
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   845
        oldFirst ~~ firstLineShown ifTrue:[
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   846
            self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   847
        ].
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   848
        shown ifTrue:[
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   849
            self redrawFromVisibleLine:1 to:nLinesShown.
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   850
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   851
            fontHeightBefore > fontHeight ifTrue:[
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   852
                (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
   853
"/                    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
   854
"/                                        corner:(width-margin) @ (height-margin)).
1985
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   855
                ].
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   856
            ]
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
   857
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   858
    ]
153
claus
parents: 152
diff changeset
   859
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   860
    "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
   861
    "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
   862
    "Modified: / 26.7.1998 / 13:47:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   863
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   864
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   865
removeIndex:lineNr
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   866
    "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
   867
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
   868
    |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
   869
     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
   870
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   871
    (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
   872
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   873
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   874
     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
   875
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   876
    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
   877
    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
   878
    visLine notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   879
	w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
1433
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   880
"/        x := textStartLeft.
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   881
"/ CLAUS fixes leftOver selection pixels
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   882
	w := w + leftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   883
	x := margin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   884
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   885
	srcY := topMargin + (visLine * fontHeight).
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
   886
"/        h := ((nLinesShown - visLine) * fontHeight).
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   887
	h := (height - margin - srcY).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   888
	h > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   889
	    self catchExpose.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   890
	    self 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   891
		copyFrom:self 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   892
		x:x y:srcY
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   893
		toX:x y:(srcY - fontHeight)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   894
		width:w height:h
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   895
		async:true.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   896
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   897
	self redrawVisibleLine:nFullLinesShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   898
	"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   899
	 redraw last partial line - if any
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   900
	"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   901
	(nFullLinesShown ~~ nLinesShown) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   902
	    self redrawVisibleLine:nLinesShown
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   903
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   904
	h > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   905
	    self waitForExpose
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   906
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   907
    ]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   908
1460
b9929a029249 dont bitBlt if height is <= 0
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   909
    "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
   910
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   911
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   912
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
   913
    "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
   914
     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
   915
     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
   916
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   917
    (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
   918
    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
   919
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   920
    lineNr < firstLineShown 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
   921
	firstLineShown := 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
   922
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   923
    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
   924
    ^ 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
   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
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
   928
    "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
   929
     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
   930
     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
   931
     (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
   932
     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
   933
75b8fb924904 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
    |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
   935
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   936
    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
   937
    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
   938
    l notNil ifTrue:[
288
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   939
	l isString ifTrue:[
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   940
	    l := l asStringCollection
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   941
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   942
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   943
    self setList:l.
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   944
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   945
    "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
   946
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   947
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   948
setList:aCollection
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   949
    "set the contents (a collection of strings);
153
claus
parents: 152
diff changeset
   950
     do not change position (i.e. do not scroll).
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   951
     This can be used to update a self-changing list 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   952
     (for example: a file list being shown, without disturbing user too much)"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   953
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   954
    ^ self setList:aCollection expandTabs:true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   955
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   956
153
claus
parents: 152
diff changeset
   957
setList:aCollection expandTabs:expandTabs
claus
parents: 152
diff changeset
   958
    "set the contents (a collection of strings);
claus
parents: 152
diff changeset
   959
     do not change position (i.e. do not scroll).
claus
parents: 152
diff changeset
   960
     This can be used to update a self-changing list 
claus
parents: 152
diff changeset
   961
     (for example: a file list being shown, without disturbing the user too much)"
claus
parents: 152
diff changeset
   962
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   963
    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
   964
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   965
    "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
   966
!
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   967
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   968
setList:aCollection expandTabs:expandTabs redraw:doRedraw
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   969
    "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
   970
     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
   971
     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
   972
     (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
   973
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   974
    |oldFirst nonStringsBefore linesShownBefore|
153
claus
parents: 152
diff changeset
   975
claus
parents: 152
diff changeset
   976
    (aCollection isNil and:[list isNil]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   977
	"no change"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   978
	^ self
153
claus
parents: 152
diff changeset
   979
    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   980
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   981
"/    list isNil ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   982
"/        linesShownBefore := (1 to:nLinesShown) collect:[:i | ''].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   983
"/    ] ifFalse:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   984
"/        linesShownBefore := (firstLineShown to:(firstLineShown+nLinesShown-1))
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   985
"/                            collect:[:i | (self at:i) ? ''].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   986
"/    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   987
153
claus
parents: 152
diff changeset
   988
    list := aCollection.
claus
parents: 152
diff changeset
   989
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   990
    nonStringsBefore := includesNonStrings.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   991
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   992
153
claus
parents: 152
diff changeset
   993
    list notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   994
	expandTabs ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   995
	    self expandTabs
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   996
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   997
	    includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   998
	].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   999
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1000
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1001
	self getFontParameters.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1002
	self computeNumberOfLinesShown.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1003
    ].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1004
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1005
"/ 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
  1006
    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
  1007
    innerWidth >= self widthOfContents ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1008
	viewOrigin x:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1009
	leftOffset := 0.
153
claus
parents: 152
diff changeset
  1010
    ].
claus
parents: 152
diff changeset
  1011
    self contentsChanged.
claus
parents: 152
diff changeset
  1012
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1013
"/ new - reposition vertically if too big
153
claus
parents: 152
diff changeset
  1014
    (firstLineShown + nFullLinesShown) > self size ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1015
	oldFirst := firstLineShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1016
	firstLineShown := self size - nFullLinesShown + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1017
	firstLineShown < 1 ifTrue:[firstLineShown := 1].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1018
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1019
	viewOrigin y:(firstLineShown - 1 * fontHeight).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1020
	self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1021
	linesShownBefore := nil.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1022
	shown ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1023
	    self clear.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1024
	]
153
claus
parents: 152
diff changeset
  1025
    ].
claus
parents: 152
diff changeset
  1026
"/ end new
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1027
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1028
    (shown and:[doRedraw]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1029
	  self redrawFromVisibleLine:1 to:nLinesShown
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1030
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1031
"/        linesShownBefore isNil ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1032
"/            self redrawFromVisibleLine:1 to:nLinesShown
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1033
"/        ] ifFalse:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1034
"/            1 to:nLinesShown do:[:l |
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1035
"/                |oldLine newLine|
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1036
"/
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1037
"/                newLine := self visibleAt:l.
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1038
"/                newLine size == 0 ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1039
"/                    newLine := ''
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1040
"/                ].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1041
"/                oldLine := linesShownBefore at:l ifAbsent:nil.
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1042
"/                oldLine size == 0 ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1043
"/                    oldLine := ''
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1044
"/                ].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1045
"/                oldLine ~= newLine ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1046
"/                    self redrawVisibleLine:l
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1047
"/                ]
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1048
"/            ]
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
  1049
"/        ]
153
claus
parents: 152
diff changeset
  1050
    ]
claus
parents: 152
diff changeset
  1051
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1052
    "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
  1053
    "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
  1054
    "Modified: / 26.7.1998 / 13:46:49 / cg"
153
claus
parents: 152
diff changeset
  1055
!
claus
parents: 152
diff changeset
  1056
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1057
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
  1058
    "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
  1059
     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
  1060
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1061
    ^ list size.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1062
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1063
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1064
stringAtLine:lineNr from:col1 to:col2
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1065
    "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
  1066
     including col2. 
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1067
     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
  1068
     Fills the string with space characters at the right.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1069
     (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
  1070
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1071
    |line len s|
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1072
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1073
    len := col2 - col1 + 1.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1074
    list notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1075
	line := self listAt:lineNr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1076
	line notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1077
	    (line size >= col1) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1078
		s := line copyFrom:col1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1079
		s size < len ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1080
		    ^ s paddedTo:len
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1081
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1082
		^ s copyTo:len
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1083
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1084
	]
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1085
    ].
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1086
    ^ String new:len withAll:Character space
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1087
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1088
    "Created: 7.1.1997 / 19:58:43 / cg"
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1089
!
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1090
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1091
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
  1092
    "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
  1093
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1094
    |text sz index last|
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1095
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1096
    (startLine == endLine) ifTrue:[
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1097
        "part of a line"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1098
        ^ StringCollection with:(self listAt:startLine
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1099
                                        from:startCol
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1100
                                          to:endCol)
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1101
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1102
    sz := endLine - startLine + 1.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1103
    text := StringCollection new:sz.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1104
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1105
    "get 1st and last (possibly) partial lines"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1106
    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
  1107
    endCol == 0 ifTrue:[
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1108
        last := ''
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1109
    ] ifFalse:[
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1110
        last := self listAt:endLine to:endCol.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1111
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1112
    text at:sz put:last.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1113
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1114
    "get bulk of text"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1115
    index := 2.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1116
    (startLine + 1) to:(endLine - 1) do:[:lineNr |
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1117
        text at:index put:(self listAt:lineNr).
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1118
        index := index + 1
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1119
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1120
    ^ text
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1121
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1122
    "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
  1123
!
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1124
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1125
withoutRedrawAt:index put:aString
1964
b07048d003ff oops - last change was no good
Claus Gittinger <cg@exept.de>
parents: 1963
diff changeset
  1126
    "change a line without redisplay and WITHOUT any sizeChange notifications"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1127
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1128
    |w 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
  1129
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1130
    self checkForExistingLine:index.
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1131
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1132
    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
  1133
    list at:index put:aString.
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1134
    oldLine ~= aString ifTrue:[
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1135
        self textChanged
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1136
    ].
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1137
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1138
    didIncludeNonStrings := includesNonStrings.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1139
    includesNonStrings ifFalse:[
1963
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1140
        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
  1141
    ] ifTrue:[
1963
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1142
        (aString isNil or:[aString isString]) ifTrue:[
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1143
            includesNonStrings := (list findFirst:[:l | l notNil and:[l isString not]]) ~~ 0.
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1144
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1145
    ].
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1146
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1147
    includesNonStrings ~~ didIncludeNonStrings ifTrue:[
1963
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1148
        self getFontParameters.
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1149
        self computeNumberOfLinesShown
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1150
    ].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1151
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1152
    widthOfWidestLine notNil ifTrue:[
1963
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1153
        aString isString ifTrue:[
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1154
            w := font widthOf:aString
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1155
        ] ifFalse:[
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1156
            w := aString widthOn:self
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1157
        ].
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1158
        w > widthOfWidestLine ifTrue:[
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1159
            widthOfWidestLine := w.
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1160
        ] ifFalse:[
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1161
            widthOfWidestLine := nil "/ means: unknown
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1162
        ].
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1163
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1164
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1165
    "Modified: / 26.7.1998 / 13:00:14 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1166
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1167
118
claus
parents: 116
diff changeset
  1168
!ListView methodsFor:'accessing-mvc'!
claus
parents: 116
diff changeset
  1169
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1170
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
  1171
    "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
  1172
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1173
    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
  1174
    aDictionary at:#listMessage put:listMsg
118
claus
parents: 116
diff changeset
  1175
!
claus
parents: 116
diff changeset
  1176
125
claus
parents: 121
diff changeset
  1177
listMessage 
claus
parents: 121
diff changeset
  1178
    "return the listMsg selector; 
claus
parents: 121
diff changeset
  1179
     if non-nil, this is the message sent to the model (if any) to aquire
claus
parents: 121
diff changeset
  1180
     a new text upon change of the aspect.
120
claus
parents: 118
diff changeset
  1181
     This defaults to the aspect-selector."
118
claus
parents: 116
diff changeset
  1182
125
claus
parents: 121
diff changeset
  1183
    ^ listMsg
claus
parents: 121
diff changeset
  1184
!
claus
parents: 121
diff changeset
  1185
claus
parents: 121
diff changeset
  1186
listMessage:aSymbol 
claus
parents: 121
diff changeset
  1187
    "ST-80 compatibility: set the listMsg selector; 
claus
parents: 121
diff changeset
  1188
     if non-nil, this will be sent to the model (if any) to aquire a 
claus
parents: 121
diff changeset
  1189
     new text upon change of the aspect.
claus
parents: 121
diff changeset
  1190
     This defaults to the aspect-selector."
claus
parents: 121
diff changeset
  1191
claus
parents: 121
diff changeset
  1192
    listMsg := aSymbol.
120
claus
parents: 118
diff changeset
  1193
!
claus
parents: 118
diff changeset
  1194
907
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1195
model:aModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1196
    "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
  1197
     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
  1198
     changes."
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1199
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1200
    super model:aModel.
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1201
    self getListFromModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1202
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1203
    "Created: 31.12.1996 / 14:56:43 / stefan"
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1204
!
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1205
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1206
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
  1207
    "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
  1208
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1209
    ^ self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:nil 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1210
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1211
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1212
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
  1213
    "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
  1214
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1215
    ^self on:aModel aspect:aspectSymbol change:changeSymbol list:aspectSymbol menu:nil 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1216
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1217
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1218
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
  1219
    "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
  1220
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1221
    aspectSymbol notNil ifTrue:[aspectMsg := aspectSymbol. 
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1222
			     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
  1223
    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
  1224
    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
  1225
    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
  1226
    self model:aModel.
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1227
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1228
    "Modified: 2.1.1997 / 16:11:16 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1229
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1230
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1231
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
  1232
    "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
  1233
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1234
    ^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1235
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1236
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1237
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
  1238
    "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
  1239
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1240
    ^ self on:aModel aspect:aspectSymbol change:nil list:listSymbol menu:menuSymbol 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1241
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1242
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1243
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
  1244
    "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
  1245
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1246
    ^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
  1247
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1248
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1249
!ListView methodsFor:'change and update '!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1250
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1251
update:something with:aParameter from:changedObject
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1252
    changedObject == model ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1253
	(aspectMsg notNil
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1254
	and:[something == aspectMsg]) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1255
	    ^ self getListFromModel.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1256
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1257
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1258
	something == #size ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1259
	    ^ self getListFromModelScroll:false.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1260
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1261
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1262
    ^ 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
  1263
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1264
    "Modified: 5.3.1997 / 16:14:01 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1265
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1266
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1267
!ListView methodsFor:'drawing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1268
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1269
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1270
    "draw a visible line range in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1271
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1272
    |y         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1273
     x         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1274
     startLine "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1275
     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
  1276
     listSize e sH l|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1277
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1278
    y := self yOfVisibleLine:startVisLineNr.
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1279
    sH := lineSpacing // 2.
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1280
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1281
    backgroundAlreadyClearedColor == bg ifFalse:[
2089
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1282
        self paint:bg.
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1283
        self fillRectangleX:margin 
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1284
                          y:y-sH
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1285
                      width:(width - (margin * 2))
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1286
                     height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1287
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1288
    list isNil ifTrue:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1289
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1290
    y := y + fontAscent.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1291
    listSize := self size.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1292
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1293
    startLine := startVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1294
    endLine := endVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1295
    (startLine == 0) ifTrue:[
2089
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1296
        y := y + fontHeight.
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1297
        startLine := startLine + 1
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1298
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1299
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1300
    (endLine > listSize) ifTrue:[
2089
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1301
        e := listSize
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1302
    ] ifFalse:[
2089
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1303
        e := endLine
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1304
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1305
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1306
    (startLine <= e) ifTrue:[
2089
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1307
        x := textStartLeft - leftOffset.
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1308
        self paint:fg on:bg.
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1309
        self from:startLine to:e do:[:line |
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1310
            line notNil ifTrue:[
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1311
                "/ remove lines color emphasis, to enforce color.
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1312
                "/ otherwise blue text is not visible if selection-bg is blue
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1313
                l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
2089
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1314
                self displayOpaqueString:l x:x y:y
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1315
            ].
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1316
            y := y + fontHeight
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  1317
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1318
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1319
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1320
    "Modified: / 15.12.1999 / 23:19:39 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1321
!
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1322
131
claus
parents: 128
diff changeset
  1323
drawLine:line atX:x inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1324
    "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
  1325
     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
  1326
     Low level entry; not meant for public use."
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1327
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1328
    |y l|
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1329
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1330
    y := self yOfVisibleLine:visLineNr.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1331
    backgroundAlreadyClearedColor == bg ifFalse:[
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1332
        self paint:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1333
        self fillRectangleX:margin y:y - (lineSpacing//2)
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1334
                      width:(width - (2 * margin)) 
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1335
                     height:fontHeight.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1336
    ].
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1337
    line notNil ifTrue:[
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1338
        self paint:fg on:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1339
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1340
        "/ remove lines color emphasis, to enforce color.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1341
        "/ 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
  1342
        l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1343
        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
  1344
    ]
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1345
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1346
    "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
  1347
!
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1348
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1349
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
  1350
    "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
  1351
     given x position in fg/bg. Clears partial line before drawing the string.
131
claus
parents: 128
diff changeset
  1352
     Low level entry; not meant for public use."
claus
parents: 128
diff changeset
  1353
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1354
    |y l|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1355
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1356
    y := self yOfVisibleLine:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1357
    line notNil ifTrue:[
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1358
        self paint:fg on:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1359
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1360
        "/ remove lines color emphasis, to enforce color.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1361
        "/ 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
  1362
        l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1363
        self displayOpaqueString:l x:x y:(y + fontAscent)
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1364
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1365
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1366
    "Modified: / 15.12.1999 / 23:19:55 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1367
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1368
131
claus
parents: 128
diff changeset
  1369
drawLine:line inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1370
    "draw a given string at visible lines position in fg/bg"
claus
parents: 128
diff changeset
  1371
claus
parents: 128
diff changeset
  1372
    self drawLine:line atX:(textStartLeft - leftOffset) inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1373
!
claus
parents: 128
diff changeset
  1374
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1375
drawVisibleLine:visLineNr col:col with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1376
    "draw single character at col index of visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1377
1927
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1378
    |y yf x lineString characterString em w clr|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1379
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1380
    lineString := self visibleAt:visLineNr.
1927
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1381
    (lineString notNil and:[lineString isString not]) ifTrue:[
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1382
        ^ self drawVisibleLine:visLineNr with:fg and:bg
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1383
    ].
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1384
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1385
    x := (self xOfCol:col inVisibleLine:visLineNr) - leftOffset.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1386
    y := self yOfVisibleLine:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1387
    self paint:bg.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1388
1927
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1389
    yf := y - (lineSpacing // 2).
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1390
    col > lineString size ifTrue:[
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1391
        self fillRectangleX:x y:yf width:(font width) height:fontHeight.
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1392
        self paint:fg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1393
    ] ifFalse:[
1927
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1394
        characterString := lineString copyFrom:col to:col.
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1395
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1396
        "/ remove lines color emphasis, to enforce color.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1397
        "/ 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
  1398
        characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1399
        w := characterString widthOn:self.
1927
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1400
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1401
        self fillRectangleX:x y:yf 
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1402
                      width:w
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1403
                     height:fontHeight.
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1404
        self paint:fg.
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  1405
        self displayString:characterString x:x y:(y + fontAscent)
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1406
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1407
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1408
    "Modified: / 15.12.1999 / 23:21:12 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1409
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1410
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1411
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1412
    "draw part of a visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1413
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1414
    |y yf x lineString len characterString w sCol eCol|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1415
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1416
    (endCol >= startCol) ifTrue:[
1938
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1417
        sCol := startCol max:1.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1418
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1419
        lineString := self visibleAt:visLineNr.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1420
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1421
        (lineString notNil and:[lineString isString not])
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1422
        ifTrue:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1423
            self drawVisibleLine:visLineNr with:fg and:bg.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1424
        ] ifFalse:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1425
            x := (self xOfCol:sCol inVisibleLine:visLineNr) - leftOffset.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1426
            y := (self yOfVisibleLine:visLineNr).
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1427
            yf := y - (lineSpacing // 2).
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1428
            len := lineString size.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1429
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1430
            (sCol > len) ifTrue:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1431
                backgroundAlreadyClearedColor == bg ifFalse:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1432
                    len := endCol - sCol + 1.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1433
                    self paint:bg.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1434
                    self fillRectangleX:x y:yf 
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1435
                                   width:(fontWidth * len) 
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1436
                                  height:fontHeight
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1437
                ]
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1438
            ] ifFalse:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1439
                eCol := endCol.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1440
                (endCol > len) ifTrue:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1441
                    backgroundAlreadyClearedColor == bg ifFalse:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1442
                        characterString := lineString species new:endCol.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1443
                        characterString replaceFrom:1 to:len with:lineString startingAt:1.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1444
                        lineString := characterString.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1445
                    ] ifTrue:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1446
                        eCol := len.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1447
                    ].
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1448
                ].
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1449
2082
d3ccb78e8c03 selection highlighting with coloured text in the selection
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1450
                "/ remove any color emphasis, to enforce drawing in fg/bg
d3ccb78e8c03 selection highlighting with coloured text in the selection
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1451
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1452
                lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
1938
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1453
                backgroundAlreadyClearedColor == bg ifFalse:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1454
                    (lineString isMemberOf:String) ifTrue:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1455
                        fontIsFixedWidth ifTrue:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1456
                            w := (eCol - sCol + 1) * fontWidth
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1457
                        ] ifFalse:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1458
                            w := font widthOf:lineString from:sCol to:eCol
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1459
                        ]
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1460
                    ] ifFalse:[
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1461
                        w := (lineString copyFrom:sCol to:eCol) widthOn:self
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1462
                    ].
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1463
                    self paint:bg.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1464
                    self fillRectangleX:x y:yf 
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1465
                                  width:w
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1466
                                  height:fontHeight.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1467
                ].
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1468
                self paint:fg on:bg.
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1469
                self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1470
            ]
b4d7482c6c4b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
  1471
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
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
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1474
    "Modified: / 15.12.1999 / 23:21:43 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1475
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1476
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1477
drawVisibleLine:visLineNr from:startCol 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
  1478
    "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
  1479
75b8fb924904 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
    |y x lineString index1 index2|
75b8fb924904 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
    (startCol < 1) ifTrue:[
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1483
        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
  1484
    ] ifFalse:[
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1485
        index1 := startCol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1486
    ].
249
75b8fb924904 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
    y := self 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
  1488
    x := (self xOfCol:index1 inVisibleLine:visLineNr) - leftOffset.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1489
    backgroundAlreadyClearedColor == bg ifFalse:[
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1490
        self paint:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1491
        self fillRectangleX:x y:y - (lineSpacing // 2)
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1492
                      width:(width + leftOffset - x)
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1493
                     height:fontHeight.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1494
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1495
    lineString := self visibleAt: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
  1496
    lineString notNil ifTrue:[
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1497
        lineString isString ifFalse:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1498
            self drawVisibleLine:visLineNr with:fg and:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1499
        ] ifTrue:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1500
            lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1501
            index2 := lineString size.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1502
            (index2 < index1) ifTrue:[^ self].
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1503
            (index1 <= index2) ifTrue:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1504
                self paint:fg on:bg.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1505
                self displayOpaqueString:lineString from:index1 to:index2 x:x y:(y + fontAscent)
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1506
            ]
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1507
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1508
    ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1509
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  1510
    "Modified: / 15.12.1999 / 23:24:40 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1511
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1512
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1513
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
  1514
    "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
  1515
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1516
    self 
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1517
	drawLine:(self visibleAt:visLineNr) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1518
	atX:(textStartLeft - leftOffset) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1519
	inVisible:visLineNr 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1520
	with:fg 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1521
	and:bg
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1522
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1523
    "Modified: 28.2.1996 / 19:30:23 / cg"
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1524
!
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1525
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1526
fillRectangleX:x y:y width:w height:h
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1527
    "fill rectangle; checks whether the rectangle already is filled with
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1528
     the current paint (#redrawX:y:w:h).
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1529
    "
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1530
    backgroundAlreadyClearedColor ~~ paint ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1531
	super fillRectangleX:x y:y width:w height:h
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1532
    ]
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1533
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1534
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1535
!
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1536
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1537
invalidateLine:line
1466
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1538
    "invalidate the area of a single line.
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1539
     This arranges for that line to be redrawn asynchronously (later).
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1540
     If multiple such invalidations arrive, those areas may be lumped
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1541
     together for a block update.
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1542
     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
  1543
     process expose events."
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1544
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1545
    |yTop visLineNr|
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1546
 
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1547
    visLineNr := self listLineToVisibleLine:line.
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1548
    visLineNr notNil ifTrue:[
1985
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  1549
        yTop := self yOfVisibleLine:visLineNr.
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  1550
        yTop isNil ifTrue:[^ self]. "/ not visible
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  1551
        (yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  1552
        self 
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  1553
            invalidateDeviceRectangle:(Rectangle 
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  1554
                            left:margin top:yTop 
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  1555
                            width:(width - (2 * margin)) height:fontHeight)
3abfcfd15cbf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1984
diff changeset
  1556
            repairNow:false.
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1557
    ]
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1558
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1559
    "Created: / 5.3.1998 / 01:24:19 / cg"
1466
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1560
    "Modified: / 5.3.1998 / 13:41:31 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1561
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1562
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1563
!ListView methodsFor:'event processing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1564
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1565
contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1566
    "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
  1567
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1568
    |listSize newOrigin|
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1569
890
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1570
    shown ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1571
	list notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1572
	    listSize := self numberOfLines.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1573
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1574
	    listSize == 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1575
		widthOfWidestLine := 0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1576
	    ].
990
c466fa72c6e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1577
        
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1578
	    "
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1579
	     if we are beyond the end, scroll up a bit
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1580
	    "
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1581
	    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1582
		newOrigin := listSize - nFullLinesShown + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1583
		newOrigin < 1 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1584
		    newOrigin := 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1585
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1586
		self scrollToLine: newOrigin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1587
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1588
	].
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1589
    ].
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1590
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1591
    ^ super contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1592
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1593
    "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
  1594
    "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
  1595
!
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1596
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1597
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
  1598
    "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
  1599
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1600
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #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
  1601
			  #BeginOfText #EndOfText
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1602
			  #ScrollUp #ScrollDown )>
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1603
    |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
  1604
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1605
    (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
  1606
    (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
  1607
    (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
  1608
    (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
  1609
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1610
    (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
  1611
    (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
  1612
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1613
    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
  1614
    (key == #ScrollUp) 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
  1615
	sensor 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
  1616
	    n := 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
  1617
	] ifFalse:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1618
	    n := 1 + (sensor compressKeyPressEventsWithKey:#ScrollUp).
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1619
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1620
	^ self scrollUp: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
  1621
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1622
    (key == #ScrollDown) 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
  1623
	sensor 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
  1624
	    n := 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
  1625
	] ifFalse:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1626
	    n := 1 + (sensor compressKeyPressEventsWithKey:#ScrollDown).
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1627
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1628
	^ self scrollDown: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
  1629
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1630
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1631
    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
  1632
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1633
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1634
redrawX:x y:y width:w height:h
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1635
    "a region must be redrawn"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1636
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1637
    |startCol endCol line saveClip
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1638
     startLine "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1639
     stopLine  "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1640
    |
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1641
127
claus
parents: 125
diff changeset
  1642
    shown ifFalse:[^ self].
claus
parents: 125
diff changeset
  1643
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1644
    startLine := self visibleLineOfY:y.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1645
    stopLine := self visibleLineOfY:(y + h).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1646
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1647
    saveClip := clipRect.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1648
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1649
    self paint:bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1650
    self fillRectangleX:x y:y width:w height:h.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1651
    backgroundAlreadyClearedColor := bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1652
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1653
    (includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1654
	"includes non strings or area is big enough redraw whole lines"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1655
	self redrawFromVisibleLine:startLine to:stopLine
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1656
    ] ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1657
	line := self visibleAt:startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1658
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1659
	(fontIsFixedWidth and:[line isMemberOf:String]) ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1660
	    "start/end col has to be computed for each line"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1661
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1662
	    startLine to:stopLine do:[:i |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1663
		startCol := self colOfX:x inVisibleLine:i.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1664
		endCol := self colOfX:(x + w) inVisibleLine:i.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1665
		startCol > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1666
		    endCol > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1667
			self redrawVisibleLine:i from:startCol to:endCol
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1668
		    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1669
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1670
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1671
	] ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1672
	    "start/end col is the same for all lines"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1673
	    startCol := self colOfX:x inVisibleLine:startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1674
	    endCol := self colOfX:(x + w) inVisibleLine:startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1675
	    startCol > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1676
		endCol > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1677
		    startLine to:stopLine do:[:i |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1678
			line := self visibleAt:i.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1679
			(line isMemberOf:String) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1680
			    self redrawVisibleLine:i from:startCol to:endCol
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1681
			] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1682
			    self redrawVisibleLine:i
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1683
			]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1684
		    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1685
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1686
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1687
	]
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1688
    ].
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1689
    backgroundAlreadyClearedColor := nil.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1690
    self clippingRectangle:saveClip.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1691
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1692
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1693
sizeChanged:how
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1694
    "size changed - move origin up if possible"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1695
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1696
    |listSize newOrigin|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1697
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1698
    super sizeChanged:how.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
  1699
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1700
    self computeNumberOfLinesShown.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1701
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1702
    innerWidth := width - textStartLeft - margin.
1972
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1703
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1704
"/ Makes trouble when fighting with SelListViews sizeCHanged-positioning ...
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1705
"/
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1706
"/    shown ifFalse:[^ self].
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1707
"/    list isNil ifTrue:[^ self].
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1708
"/
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1709
"/    listSize := self numberOfLines.
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1710
"/    "
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1711
"/     if we are beyond the end, scroll up a bit
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1712
"/    "
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1713
"/    ((firstLineShown + nFullLinesShown) >= listSize) ifTrue:[
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1714
"/        self scrollToBottom.
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  1715
"/        ^ self
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1716
"/    ].
643
89c06c80ff2a redraw in sizeChange
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
  1717
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1718
    "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
  1719
    "Modified: / 27.1.1998 / 14:10:04 / 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
  1720
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1721
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1722
!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
  1723
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1724
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
  1725
    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
  1726
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1727
    "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
  1728
    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
  1729
    self computeNumberOfLinesShown.
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  1730
    fgColor := fgColor onDevice:device.
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  1731
    bgColor := bgColor onDevice:device
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1732
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1733
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1734
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
  1735
    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
  1736
    ^ 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
  1737
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1738
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1739
fetchDeviceResources
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1740
    "fetch device colors, to avoid reallocation at redraw time"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1741
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1742
    super fetchDeviceResources.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1743
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  1744
    fgColor notNil ifTrue:[fgColor := fgColor onDevice:device].
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  1745
    bgColor notNil ifTrue:[bgColor := bgColor onDevice:device].
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1746
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1747
    "Created: 14.1.1997 / 00:12:12 / cg"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1748
!
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1749
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1750
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1751
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1752
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1753
    |n|
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1754
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1755
    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
  1756
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1757
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device]
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1758
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1759
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1760
    n isInteger ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1761
	n := (self verticalPixelPerMillimeter:n) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1762
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1763
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1764
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1765
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1766
    n isInteger ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1767
	n := (self verticalPixelPerMillimeter:n) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1768
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1769
    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
  1770
75b8fb924904 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
    lineSpacing := 0.
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1772
    fgColor := DefaultForegroundColor.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1773
    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
  1774
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1775
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1776
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
  1777
    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
  1778
75b8fb924904 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
    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
  1780
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1781
    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
  1782
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1783
    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
  1784
    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
  1785
    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
  1786
    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
  1787
    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
  1788
    leftOffset := 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
  1789
    partialLines := 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
  1790
    tabPositions := DefaultTabPositions.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1791
    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
  1792
    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
  1793
    wordCheck := [:char | char isNationalAlphaNumeric].
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1794
    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
  1795
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1796
    autoScroll := true.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1797
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1798
    "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
  1799
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1800
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1801
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
  1802
    |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
  1803
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1804
    extentChanged ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1805
	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
  1806
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1807
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1808
    firstLineShown ~~ 1 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1809
	sz := self size.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1810
	firstLineShown + nLinesShown > sz ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1811
	    self scrollToLine:sz - nLinesShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1812
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1813
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1814
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1815
    super realize.
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1816
1081
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1817
"/ old: fetch models value on realize;
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1818
"/ 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
  1819
"/
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1820
"/    model notNil ifTrue:[
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1821
"/        self getListFromModel.
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1822
"/    ]
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1823
825
d115a0923b7d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 820
diff changeset
  1824
    "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
  1825
    "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
  1826
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1827
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1828
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
  1829
    "recreate after a snapin"
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1830
    |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
  1831
75b8fb924904 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
    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
  1833
75b8fb924904 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
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1835
     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
  1836
     - 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
  1837
    "
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1838
"/    topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1839
"/    self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1840
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1841
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1842
    n isInteger ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1843
	n := (self verticalPixelPerMillimeter:n) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1844
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1845
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1846
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1847
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1848
    n isInteger ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1849
	n := (self verticalPixelPerMillimeter:n) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1850
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1851
    self leftMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1852
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1853
    self getFontParameters
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1854
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1855
    "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
  1856
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1857
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1858
!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
  1859
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1860
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
  1861
    "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
  1862
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1863
    absLineNr 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
  1864
    (absLineNr < firstLineShown) 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
  1865
    (absLineNr >= (firstLineShown + nLinesShown)) 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
  1866
    ^ absLineNr - 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
  1867
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1868
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1869
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
  1870
    "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
  1871
     - 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
  1872
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1873
    |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
  1874
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1875
    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
  1876
    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
  1877
    1 to:(lineNr - 1) do:[:lnr |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1878
	lineString := self at:lnr.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1879
	lineString notNil 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
  1880
	    pos := pos + lineString 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
  1881
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1882
	pos := pos + 1   "the return-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
  1883
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1884
    ^ 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
  1885
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1886
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1887
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1888
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
  1889
    "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
  1890
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1891
    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
  1892
	list := StringCollection new: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
  1893
	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
  1894
    ] ifFalse: [
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1895
	lineNr > (list size) 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
  1896
	    self grow: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
  1897
	    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
  1898
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1899
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1900
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1901
1934
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1902
colOfCharacterPosition:charPos
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1903
    "given a character index within the contents-string,
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1904
     return the column number where the character is
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1905
     - used to find line to hilight from Compilers error-position"
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1906
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1907
    |line|
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1908
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1909
    line := self lineOfCharacterPosition:charPos.
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1910
    ^ charPos - (self characterPositionOfLine:line col:1) + 1.
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1911
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1912
!
c1e997c794ee added #colOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 1927
diff changeset
  1913
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1914
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
  1915
    "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
  1916
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1917
    |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
  1918
     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
  1919
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1920
    xRel := x - textStartLeft + leftOffset.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1921
    (xRel <= 0) ifTrue:[^ 1].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1922
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1923
    lineString := self visibleAt:visLineNr.
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1924
249
75b8fb924904 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
    "
75b8fb924904 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
     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
  1927
    "
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1928
    (fontIsFixedWidth 
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1929
    and:[lineString isNil
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1930
          or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1931
        ^ (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
  1932
    ].
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1934
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1935
     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
  1936
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1937
    lineString notNil ifTrue:[
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1938
        lineString := lineString asString.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1939
        (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1940
            linePixelWidth := lineString widthOn:self
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1941
        ] ifFalse:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1942
            lineString := lineString string.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1943
            linePixelWidth := font widthOf:lineString.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1944
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1945
    ] ifFalse:[
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1946
        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
  1947
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1948
249
75b8fb924904 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
    (linePixelWidth <= xRel) ifTrue:[
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1950
        fontWidth == 0 ifTrue:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1951
            "
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1952
             although this 'cannot happen',
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1953
             it seems that X reports this width for some strange fonts ...
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1954
            "
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1955
            ^ lineString size   
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1956
        ].
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1957
        ^ 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
  1958
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1959
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1960
    "/ cannot simply count individual characters,
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1961
    "/ 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
  1962
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1963
    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
  1964
    (runCol == 0) ifTrue:[runCol := 1].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1965
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1966
    hasEmphasis ifTrue:[
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1967
        posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1968
        posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1969
    ] ifFalse:[    
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1970
        posLeft := font widthOf:lineString from:1 to:(runCol - 1).
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1971
        posRight := font widthOf:lineString from:1 to:runCol.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1972
    ].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1973
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1974
    done := (posLeft <= xRel) and:[posRight > xRel].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1975
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1976
    [done] whileFalse:[
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1977
        oPosRight := posRight.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1978
        oPosLeft := posLeft.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1979
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1980
        (posRight <= xRel) ifTrue:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1981
            runCol := runCol + 1.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1982
            posLeft := posRight.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1983
            hasEmphasis ifTrue:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1984
                posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1985
            ] ifFalse:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1986
                posRight := font widthOf:lineString from:1 to:runCol
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1987
            ]
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1988
        ] ifFalse:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1989
            (posLeft > xRel) ifTrue:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1990
                runCol := runCol - 1.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1991
                (runCol == 0) ifTrue:[^ 0].
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1992
                posRight := posLeft.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1993
                hasEmphasis ifTrue:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1994
                    posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1995
                ] ifFalse:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1996
                    posLeft := font widthOf:lineString from:1 to:(runCol - 1)
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1997
                ]
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1998
            ]
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  1999
        ].
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2000
        done := (posLeft <= xRel) and:[posRight > xRel].
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2001
"234567890123456789012345678901234567890"
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2002
        ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2003
            "/ paranoia: just in case there are unprintable characters
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2004
            "/ (avoid endless loop if the binary search does not make progress)
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2005
            done := true.
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2006
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2007
    ].
1777
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2008
"/self paint:Color red.
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2009
"/self displayRectangleX:posLeft+textStartLeft-leftOffset y:(self yOfVisibleLine:visLineNr)
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2010
"/                       width:(posRight-posLeft) height:fontHeight.
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2011
"/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
  2012
    ^ runCol
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2013
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2014
    "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
  2015
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2016
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2017
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
  2018
    "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
  2019
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2020
    |innerHeight|
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2021
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2022
    innerHeight := self innerHeight.
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2023
    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
  2024
    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
  2025
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2026
    partialLines ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2027
	((nLinesShown * fontHeight) < innerHeight) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2028
	    nLinesShown := nLinesShown + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2029
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2030
    ]
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2031
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2032
    "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
  2033
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2034
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2035
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
  2036
    "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
  2037
     - 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
  2038
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2039
    |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
  2040
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2041
    self obsoleteMethodWarning.
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2042
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2043
    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
  2044
    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
  2045
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2046
    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
  2047
    aList do:[:line |
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2048
	((line size == 0) or:[line isBlank]) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2049
	    newList add:newLine.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2050
	    newLine := ''
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2051
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2052
	    special := ((line at:1) == ${) or:[(line includes:$\)].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2053
	    special := special or:[(line at:1) == $}].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2054
	    special ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2055
		newList add:(newLine , line)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2056
	    ] ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2057
		charIndex := 1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2058
		[charIndex <= line size] whileTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2059
		    char := line at:charIndex.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2060
		    ((char == ${ ) or:[char == $} ]) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2061
			"left-brace: ignore rest of line"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2062
			charIndex := line size + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2063
		    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2064
			(char == $\) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2065
			    inEscape := true
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2066
			] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2067
			    inEscape ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2068
				(char == Character space) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2069
				    inEscape := false
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2070
				]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2071
			    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2072
				newLine := newLine copyWith:char
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2073
			    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2074
			].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2075
			charIndex := charIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2076
		    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2077
		]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2078
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2079
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2080
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2081
    ^ newList
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2082
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2083
    "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
  2084
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2085
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2086
getFontParameters
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2087
    "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
  2088
     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
  2089
     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
  2090
     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
  2091
     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
  2092
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2093
    |hMax|
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2094
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2095
    font := font onDevice:device.
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2096
    hMax := font height.
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2097
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2098
    includesNonStrings == true ifTrue:[
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2099
        "/
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2100
        "/ find maximum height of lines
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2101
        "/
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2102
        hMax := list inject:hMax into:[:maxSoFar :thisLine | 
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2103
                                        thisLine isNil ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2104
                                            maxSoFar
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2105
                                        ] ifFalse:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2106
                                            (thisLine isMemberOf:String) ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2107
                                                maxSoFar
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2108
                                            ] ifFalse:[   
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2109
                                                maxSoFar max:(thisLine heightOn:self)
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2110
                                            ]
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2111
                                        ]
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2112
                              ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2113
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2114
    ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2115
    fontHeight := hMax + lineSpacing.
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2116
    fontAscent := font ascent. "/ maxAscent.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2117
    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
  2118
    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
  2119
1260
5a548d4c6724 handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
  2120
    "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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2123
getListFromModel
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2124
    "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
  2125
     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
  2126
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2127
    |text msg|
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2128
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2129
    model notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2130
	msg := listMsg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2131
	msg isNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2132
	    msg := aspectMsg
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2133
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2134
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2135
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2136
	msg notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2137
	    text := model perform:msg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2138
	    text notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2139
		text := text asStringCollection.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2140
	    ].
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2141
"/ 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
  2142
"/ as the view!!
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2143
"/            text ~= list ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2144
		self list:text
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2145
"/            ].
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2146
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2147
    ].
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2148
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2149
    "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
  2150
    "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
  2151
!
75b8fb924904 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
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2153
getListFromModelScroll:aBoolean
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2154
    "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
  2155
     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
  2156
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2157
    |text msg|
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2158
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2159
    model notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2160
	msg := listMsg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2161
	msg isNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2162
	    msg := aspectMsg
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2163
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2164
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2165
	msg notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2166
	    text := model perform:msg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2167
	    text notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2168
		text := text asStringCollection.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2169
	    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2170
"/ 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
  2171
"/ as the view!!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2172
"/            text ~= list ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2173
		aBoolean ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2174
		    self list:text
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2175
		] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2176
		    self setList:text
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2177
		]
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2178
"/            ].
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2179
	].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2180
    ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2181
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2182
    "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
  2183
    "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
  2184
    "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
  2185
!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2186
249
75b8fb924904 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
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
  2188
    "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
  2189
     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
  2190
     - 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
  2191
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2192
    |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
  2193
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2194
    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
  2195
    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
  2196
    lastLine := self size.
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2197
    [(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2198
	sum := sum + (self at:lineNr) size + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2199
	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
  2200
    ].
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2201
    sum == charPos ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2202
	^ lineNr
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2203
    ].
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2204
249
75b8fb924904 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
    ^ lineNr - 1
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2206
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2207
    "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
  2208
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2209
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2210
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
  2211
    "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
  2212
     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
  2213
     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
  2214
75b8fb924904 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
    |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
  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
    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
  2218
    (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
  2219
    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
  2220
    l isNil ifTrue:[^ 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
  2221
    ^ l asString
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2222
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2223
    "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
  2224
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2225
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2226
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
  2227
    "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
  2228
75b8fb924904 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
    |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
  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
    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
  2232
    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
  2233
    (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
  2234
    ^ 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
  2235
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2236
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2237
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
  2238
    "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
  2239
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2240
    |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
  2241
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2242
    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
  2243
    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
  2244
    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
  2245
    (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
  2246
    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
  2247
    (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
  2248
    ^ 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
  2249
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2250
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2251
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
  2252
    "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
  2253
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2254
    |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
  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
    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
  2257
    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
  2258
    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
  2259
    (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
  2260
    ^ 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
  2261
!
75b8fb924904 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
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2263
listLineIsVisible:listLineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2264
    "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
  2265
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2266
    |visibleLineNr "{ Class: SmallInteger }"|
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2267
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2268
    shown ifFalse:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2269
    listLineNr isNil ifTrue:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2270
    visibleLineNr := listLineNr + 1 - firstLineShown.
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2271
    ^ (visibleLineNr between:1 and:nLinesShown)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2272
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2273
    "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
  2274
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2275
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2276
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
  2277
    "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
  2278
75b8fb924904 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
    |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
  2280
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2281
    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
  2282
    listLineNr 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
  2283
    visibleLineNr := listLineNr + 1 - 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
  2284
    (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
  2285
    ^ 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
  2286
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2287
2181
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2288
textChanged
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2289
    "ignored here"
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2290
!
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2291
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2292
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
  2293
    "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
  2294
     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
  2295
     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
  2296
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2297
    |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
  2298
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2299
    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
  2300
    (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
  2301
    (list notNil) 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
  2302
	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
  2303
    ] ifFalse:[
75b8fb924904 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
	listsize := 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
  2305
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2306
    (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
  2307
    ^ ''
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2308
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2309
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2310
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
  2311
    "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
  2312
     - 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
  2313
1448
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2314
    ^ (((y - textStartTop) // fontHeight) + 1) max:1
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2315
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2316
    "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
  2317
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2318
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2319
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
  2320
    "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
  2321
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2322
    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
  2323
    ^ 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
  2324
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2325
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2326
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
  2327
    "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
  2328
     (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
  2329
     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
  2330
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2331
    |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
  2332
     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
  2333
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2334
    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
  2335
    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
  2336
    (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
  2337
    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
  2338
    (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
  2339
    ^ 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
  2340
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2341
75b8fb924904 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
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
  2343
    "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
  2344
     - 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
  2345
     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
  2346
     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
  2347
75b8fb924904 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
    |w|
75b8fb924904 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
957
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2350
    ^ innerWidth
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2351
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2352
"/    "for small width, its not worth searching for
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2353
"/     longest line ...
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2354
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2355
"/    (width < 300) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2356
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2357
"/    "for large lists, search may take longer than scrolling full
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2358
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2359
"/    self size > 2000 ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2360
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2361
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2362
"/     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
  2363
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2364
"/    (viewBackground isColor not
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2365
"/     or:[viewBackground isDithered]) ifTrue:[
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2366
"/        ^ width
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2367
"/    ].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2368
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2369
"/    w := self widthOfWidestLineBetween:firstLine and:lastLine.
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2370
"/    (w > innerWidth) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2371
"/    ^ w
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2372
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2373
    "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
  2374
!
75b8fb924904 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
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
  2377
    "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
  2378
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2379
    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
  2380
    entry isString ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2381
	^ 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
  2382
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2383
    ^ entry widthOn:self
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2384
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2385
    "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
  2386
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2387
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2388
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
  2389
    "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
  2390
     - 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
  2391
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2392
    |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
  2393
     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
  2394
     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
  2395
     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
  2396
     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
  2397
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2398
    includesNonStrings 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
  2399
	^ 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
  2400
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2401
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2402
    fontIsFixedWidth 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
  2403
	^ (self lengthOfLongestLineBetween:firstLine and:lastLine) * fontWidth
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2404
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2405
    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
  2406
    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
  2407
    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
  2408
    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
  2409
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2410
    (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
  2411
    (last > listSize) 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
  2412
	last := 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
  2413
    ].
75b8fb924904 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
    self from:first to:last do:[: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
  2416
	line notNil 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
  2417
	    thisLen := font widthOf: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
  2418
	    (thisLen > max) 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
  2419
		max := thisLen
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2420
	    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2421
	]
75b8fb924904 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
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2423
    ^ 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
  2424
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2425
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2426
withoutColorEmphasis:line
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2427
    |l|
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2428
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2429
    l := line.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2430
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2431
    "/ remove lines color emphasis, to enforce color.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2432
    "/ 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
  2433
    (line notNil 
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2434
    and:[line isString
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2435
    and:[line hasChangeOfEmphasis]]) ifTrue:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2436
        l := line copyFrom:1 to:line size.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2437
        1 to:line size do:[:col |
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2438
            |em clr|
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2439
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2440
            em := (l emphasis) at:col.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2441
            em notNil ifTrue:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2442
                clr := Text extractEmphasis:#color from:em.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2443
                clr notNil ifTrue:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2444
                    em := Text removeEmphasis:(#color->clr) from:em.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2445
                    l emphasisAt:col put:em
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2446
                ]
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2447
            ].
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2448
        ].
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2449
    ].
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2450
    ^ l
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2451
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2452
    "Modified: / 15.12.1999 / 23:17:30 / cg"
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2453
!
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2454
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2455
withoutColorEmphasis:line ifFg:fg andBg:bg
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2456
    |l|
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2457
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2458
    l := line.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2459
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2460
    "/ remove lines color emphasis, to enforce color.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2461
    "/ 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
  2462
    (line notNil 
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2463
    and:[line isString
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2464
    and:[line hasChangeOfEmphasis
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2465
    and:[fg ~= fgColor or:[bg ~= bgColor]]]]) ifTrue:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2466
        l := line copyFrom:1 to:line size.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2467
        1 to:line size do:[:col |
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2468
            |em clr|
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2469
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2470
            em := (l emphasis) at:col.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2471
            em notNil ifTrue:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2472
                clr := Text extractEmphasis:#color from:em.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2473
                clr notNil ifTrue:[
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2474
                    em := Text removeEmphasis:(#color->clr) from:em.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2475
                    l emphasisAt:col put:em
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2476
                ]
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2477
            ].
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2478
        ].
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2479
    ].
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2480
    ^ l
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2481
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2482
    "Modified: / 15.12.1999 / 23:17:30 / cg"
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2483
    "Created: / 15.12.1999 / 23:19:30 / cg"
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2484
!
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2485
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2486
xOfCol:col 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
  2487
    "given a visible line- and colNr, return x-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
  2488
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2489
    |line lineSize tcol|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2490
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2491
    col == 1 ifTrue:[^ textStartLeft].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2492
    tcol := col - 1.
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2493
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2494
    line := self visibleAt:visLineNr.
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2495
    (fontIsFixedWidth 
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2496
    and:[line isNil
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2497
         or:[line isMemberOf:String]]) ifTrue:[
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2498
        ^ (tcol * fontWidth) + textStartLeft
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2499
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2500
    line notNil ifTrue:[
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2501
        lineSize := line 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
  2502
    ] ifFalse:[
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2503
        lineSize := 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
  2504
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2505
    (lineSize == 0) ifTrue:[
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2506
        ^ (tcol * fontWidth) + textStartLeft
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2507
    ].
798
9ab00cb0d9d3 handle Text items in xOfCol...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  2508
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2509
    (lineSize < col) ifTrue:[
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2510
        ^ (line widthOn:self) 
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2511
          + (fontWidth * (tcol - lineSize)) 
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2512
          + textStartLeft
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2513
    ].
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2514
    (line isMemberOf:String) ifTrue:[
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  2515
        ^ (font widthOf:line from:1 to:tcol) + textStartLeft
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2516
    ].
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2517
    ^ ((line copyTo:tcol) widthOn:self) + textStartLeft
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2518
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2519
    "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
  2520
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2521
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2522
yOfLine:lineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2523
    "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
  2524
     - 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
  2525
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2526
    ^ self yOfVisibleLine:(self listLineToVisibleLine:lineNr)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2527
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2528
    "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
  2529
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2530
249
75b8fb924904 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
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
  2532
    "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
  2533
     - 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
  2534
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2535
    ^ ((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
  2536
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2537
75b8fb924904 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
!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
  2539
1525
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2540
currentLine
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2541
    "the current line (for relative gotos); 
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2542
     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
  2543
     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
  2544
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2545
    ^ firstLineShown
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2546
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2547
    "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
  2548
!
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2549
249
75b8fb924904 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
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
  2551
    "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
  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
    ^ 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
  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
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2556
heightForLines:numberOfLines
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2557
    "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
  2558
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2559
    "need a device font for query"
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2560
    font := font onDevice:device.
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2561
    ^ 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
  2562
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2563
    "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
  2564
!
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2565
249
75b8fb924904 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
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
  2567
    "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
  2568
     - 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
  2569
75b8fb924904 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
    | 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
  2571
75b8fb924904 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
    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
  2573
    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
  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
    "/
75b8fb924904 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
    "/ 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
  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
"/    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
  2579
"/        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
  2580
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2581
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2582
     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
  2583
    "
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2584
    font := font onDevice:device.
249
75b8fb924904 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
    ^ 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
  2586
"/                            + textStartTop
1773
1e941ac6f4cb add some to heightOfContents,
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
  2587
                            - (lineSpacing // 2)
1e941ac6f4cb add some to heightOfContents,
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
  2588
                            + (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
  2589
"/                            + (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
  2590
"/                            + (font descent * 2) "makes it look better"
1773
1e941ac6f4cb add some to heightOfContents,
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
  2591
                                .
249
75b8fb924904 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
75b8fb924904 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
"/    "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
  2594
"/    (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
  2595
"/        ^ 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
  2596
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2597
"/    "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
  2598
"/     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
  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
"/    ^ (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
  2601
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2602
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2603
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
  2604
    "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
  2605
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2606
    ^ 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
  2607
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2608
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2609
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
  2610
    "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
  2611
     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
  2612
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2613
    |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
  2614
75b8fb924904 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
    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
  2616
    lineString notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2617
	indent := lineString leftIndent.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2618
	indent == lineString size ifTrue:[^ 0].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2619
	^ 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
  2620
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2621
    ^ 0
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2622
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2623
    "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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2626
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
  2627
    "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
  2628
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2629
    ^ 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
  2630
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2631
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2632
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
  2633
    "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
  2634
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2635
    |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
  2636
     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
  2637
     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
  2638
     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
  2639
     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
  2640
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2641
    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
  2642
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2643
    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
  2644
    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
  2645
    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
  2646
    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
  2647
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2648
    (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
  2649
    (last > listSize) 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
  2650
	last := 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
  2651
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2652
    self from:first to:last do:[:lineString |
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2653
	lineString notNil 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
  2654
	    thisLen := lineString 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
  2655
	    (thisLen > max) 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
  2656
		max := thisLen
75b8fb924904 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
	    ]
75b8fb924904 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
    ].
75b8fb924904 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
    ^ 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
  2661
75b8fb924904 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
!
75b8fb924904 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
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2664
lineIsFullyVisible:line
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2665
    "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
  2666
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2667
    (line >= firstLineShown
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2668
     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
  2669
    ^ false.
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2670
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2671
    "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
  2672
!
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2673
249
75b8fb924904 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
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
  2675
    "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
  2676
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2677
    (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
  2678
    ^ 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
  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
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
  2682
    "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
  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
    ^ 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
  2685
!
75b8fb924904 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
678
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2687
preferredExtentForLines:numLines cols:numCols
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2688
    ^ (((font widthOf:'x') * numCols + margin + margin) 
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2689
      @ 
688
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2690
      (fontHeight * numLines + margin + margin + font descent + lineSpacing + topMargin)).
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2691
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2692
    "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
  2693
!
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2694
249
75b8fb924904 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
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
  2696
    "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
  2697
     - 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
  2698
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2699
    |max f 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
  2700
75b8fb924904 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
    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
  2702
    widthOfWidestLine notNil ifTrue:[^ widthOfWidestLine + (leftMargin * 2)].
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2703
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2704
    (d := device) isNil ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2705
        "/ mhmh - really dont know yet
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2706
        d := Screen current
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2707
    ].
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2708
    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
  2709
75b8fb924904 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
    includesNonStrings ifTrue:[
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2711
        max := list 
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2712
                   inject:0 
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2713
                   into:[:maxSoFar :entry |
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2714
                             (
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2715
                                 entry isNil ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2716
                                     0
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2717
                                 ] ifFalse:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2718
                                    entry isString ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2719
                                        f widthOf:entry
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2720
                                    ] ifFalse:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2721
                                        entry widthOn:self
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2722
                                    ]
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2723
                                 ]
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2724
                             ) max:maxSoFar.
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2725
                        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2726
    ] ifFalse:[
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2727
        false "fontIsFixedWidth" ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2728
            max := self lengthOfLongestLine * fontWidth
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2729
        ] ifFalse:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2730
            max := 0.
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2731
            list notNil ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2732
                list do:[:line |
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2733
                    line notNil ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2734
                        max := max max:(line widthOn:self)
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2735
                    ]
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2736
                ].
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2737
"/                max := max max:(f widthOf:list)
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2738
            ].
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2739
        ].
249
75b8fb924904 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
    ].
75b8fb924904 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
    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
  2742
    ^ max + (leftMargin * 2)
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2743
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  2744
    "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
  2745
!
75b8fb924904 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
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2747
widthOfLine:lineNr
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2748
    "return the width of a line in pixels"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2749
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2750
    |line f d|
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2751
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2752
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2753
    lineNr > list size ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2754
    line := list at:lineNr.
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2755
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2756
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2757
    (d := device) isNil ifTrue:[
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2758
        "/ mhmh - really dont know yet
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2759
        d := Screen current
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2760
    ].
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2761
    f := font := font onDevice:d.
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2762
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2763
    line isString ifTrue:[
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2764
        ^ f widthOf:line
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2765
    ].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2766
    ^ line widthOn:self
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2767
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2768
    "Created: / 10.11.1998 / 23:59:20 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2769
    "Modified: / 11.11.1998 / 15:25:07 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2770
!
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2771
249
75b8fb924904 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
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
  2773
    "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
  2774
     - 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
  2775
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2776
    ^ leftOffset 
75b8fb924904 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
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
  2780
    "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
  2781
     - 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
  2782
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2783
    ^ (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
  2784
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2785
75b8fb924904 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
!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
  2787
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2788
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
  2789
    "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
  2790
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2791
    self redrawInverted.
292
f46dea5bdd51 use new Delay wait
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
  2792
    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
  2793
    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
  2794
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2795
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2796
     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
  2797
     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
  2798
     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
  2799
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2800
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2801
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2802
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
  2803
    "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
  2804
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2805
    shown 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
  2806
	self redrawFromVisibleLine:1 to: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
  2807
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2808
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2809
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2810
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
  2811
    "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
  2812
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2813
    |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
  2814
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2815
    shown 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
  2816
	"if first line to redraw is above 1st 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
  2817
	 start redraw at 1st 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
  2818
	(lineNr < firstLineShown) 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
  2819
	    first := firstLineShown
125
claus
parents: 121
diff changeset
  2820
	] ifFalse:[
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2821
	    first := lineNr
125
claus
parents: 121
diff changeset
  2822
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2823
	visibleLine := self listLineToVisibleLine: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
  2824
	visibleLine notNil 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
  2825
	    self redrawFromVisibleLine:visibleLine to: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
  2826
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2827
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2828
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2829
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2830
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
  2831
    "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
  2832
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2833
    |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
  2834
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2835
    shown 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
  2836
	lastLineShown := firstLineShown + nLinesShown - 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
  2837
	(start <= lastLineShown) 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
  2838
	    (end >= firstLineShown) 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
  2839
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2840
		"if first line to redraw is above 1st 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
  2841
		 start redraw at 1st 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
  2842
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2843
		(start < firstLineShown) 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
  2844
		    first := 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
  2845
		] ifFalse:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2846
		    first := start
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2847
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2848
		(end > lastLineShown) 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
  2849
		    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
  2850
		] ifFalse:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2851
		    last := 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
  2852
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2853
		visibleFirst := self listLineToVisibleLine: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
  2854
		visibleLast := self listLineToVisibleLine:last.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2855
		self redrawFromVisibleLine:visibleFirst to:visibleLast
75b8fb924904 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
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2858
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2859
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2860
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2861
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
  2862
    "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
  2863
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2864
    shown 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
  2865
	self drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fgColor and: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
  2866
    ]
75b8fb924904 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
!
75b8fb924904 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
75b8fb924904 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
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
  2870
    "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
  2871
75b8fb924904 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
    |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
  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
    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
  2875
    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
  2876
    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
  2877
    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
  2878
    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
  2879
    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
  2880
    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
  2881
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2882
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2883
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
  2884
    "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
  2885
75b8fb924904 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
    |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
  2887
75b8fb924904 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
    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
  2889
    visibleLine notNil 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
  2890
	self redrawVisibleLine: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
  2891
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2892
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2893
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2894
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
  2895
    "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
  2896
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2897
    |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
  2898
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2899
    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
  2900
    visibleLine notNil 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
  2901
	self redrawVisibleLine:visibleLine 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
  2902
    ]
75b8fb924904 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
!
75b8fb924904 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
75b8fb924904 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
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
  2906
    "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
  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
    |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
  2909
75b8fb924904 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
    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
  2911
    visibleLine notNil 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
  2912
	self redrawVisibleLine:visibleLine 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
  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
!
75b8fb924904 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
75b8fb924904 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
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
  2917
    "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
  2918
75b8fb924904 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
    |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
  2920
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2921
    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
  2922
    visibleLine notNil 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
  2923
	self redrawVisibleLine:visibleLine 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
  2924
    ]
75b8fb924904 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
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2927
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
  2928
    "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
  2929
75b8fb924904 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
    shown 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
	self drawVisibleLine:visLineNr with:fgColor and: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
  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
!
75b8fb924904 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
75b8fb924904 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
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
  2936
    "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
  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
    shown 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
  2939
	self drawVisibleLine:visLineNr col:col with:fgColor and: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
  2940
    ]
75b8fb924904 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
75b8fb924904 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
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
  2944
    "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
  2945
75b8fb924904 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
    shown 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
  2947
	self drawVisibleLine:visLineNr from:startCol with:fgColor and: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
  2948
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2949
!
75b8fb924904 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
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
  2952
    "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
  2953
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2954
    shown 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
  2955
	self drawVisibleLine:visLineNr from:startCol to:endCol with:fgColor and: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
  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
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2958
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2959
!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
  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
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
  2962
    "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
  2963
     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
  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 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
  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
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
  2969
    "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
  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
    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
  2972
!
75b8fb924904 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
75b8fb924904 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
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
  2975
    "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
  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
    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
  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
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2980
horizontalScrollStep
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2981
    "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
  2982
     Here, the scrolling unit is characters."
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2983
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2984
    ^ font width
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2985
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2986
    "Created: / 21.5.1999 / 15:55:06 / cg"
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2987
!
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  2988
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2989
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
  2990
    "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
  2991
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2992
    |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
  2993
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2994
    (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
  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
    visLnr := self absoluteLineToVisibleLine: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
  2997
    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
  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
    xWant := self xOfCol:aCol inVisibleLine: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
  3000
    xVis := xWant - leftOffset.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3001
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3002
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3003
     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
  3004
     (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
  3005
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3006
"/    ((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
  3007
"/        ^ 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
  3008
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3009
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3010
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3011
     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
  3012
     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
  3013
    "
75b8fb924904 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
    (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
  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
    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
  3017
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3018
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3019
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
  3020
    "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
  3021
     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
  3022
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3023
    |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
  3024
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3025
    (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
  3026
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3027
"/  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
  3028
"/      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
  3029
"/      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
  3030
"/
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3031
"/    shown ifFalse:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3032
"/        firstLineShown := (aListLineNr - 1) max:1.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3033
"/        firstLineShown > (list size - nFullLinesShown) ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3034
"/            firstLineShown := list size - nFullLinesShown
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3035
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3036
"/        list size <= nFullLinesShown ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3037
"/            firstLineShown := 1
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3038
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3039
"/        ^ self
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3040
"/    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  3041
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3042
    (self needScrollToMakeLine:aListLineNr) ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3043
	^ self
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3044
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3045
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3046
    (aListLineNr < nFullLinesShown) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3047
	"/ at the very top of the list - show from top
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3048
	newTopLine := 1
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3049
    ] ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3050
	(nFullLinesShown < 3) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3051
	    "/ a small view - show from that line
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3052
	    newTopLine := aListLineNr
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3053
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3054
	    bott := self numberOfLines - (nFullLinesShown - 1).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3055
	    (aListLineNr > bott) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3056
		"/ at the end of the list - show the bottom of the list
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3057
		newTopLine := bott
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3058
	    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3059
		"/ somewhere else - place selected line into the middle of
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3060
		"/ the view
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3061
		newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3062
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3063
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3064
    ].
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3065
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3066
    self scrollToLine:newTopLine.
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3067
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3068
    "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
  3069
    "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
  3070
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3071
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3072
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
  3073
    "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
  3074
     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
  3075
1808
097b86f1473e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3076
    |index list|
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3077
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3078
    (list := self list) notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3079
	index := list indexOf:someString.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3080
	index ~~ 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3081
	    self makeLineVisible:index
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3082
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3083
    ]
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3084
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  3085
    "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
  3086
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3087
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3088
needScrollToMakeLine:aListLineNr
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3089
    "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
  3090
     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
  3091
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3092
    (aListLineNr >= firstLineShown) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3093
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3094
	    ^ false
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3095
	]
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3096
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3097
    ^ true
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3098
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3099
    "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
  3100
    "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
  3101
!
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  3102
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3103
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
  3104
    "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
  3105
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3106
    self scrollTo:(viewOrigin + (0 @ height))
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3107
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3108
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3109
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3110
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3111
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
  3112
    "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
  3113
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3114
    self scrollTo:(viewOrigin - (0 @ height))
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3115
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3116
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3117
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3118
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3119
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3120
scrollDown:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3121
    "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
  3122
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3123
    nLines ~~ 0 ifTrue:[
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3124
        self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3125
               redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3126
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3127
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3128
    "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
  3129
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3130
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3131
scrollDownPixels:pix
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3132
    "change origin to scroll down some pixels 
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3133
     (towards the bottom of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3134
     THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3135
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3136
    pix > 0 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3137
	self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3138
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3139
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3140
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3141
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3142
249
75b8fb924904 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
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
  3144
    "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
  3145
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3146
    |nPixel|
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3147
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3148
    nPixel := aPixelOffset - leftOffset.
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3149
    nPixel ~~ 0 ifTrue:[
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3150
        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
  3151
    ]
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3152
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  3153
    "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
  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
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
  3157
    "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
  3158
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3159
    nPixel ~~ 0 ifTrue:[
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3160
        self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3161
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3162
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3163
    "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
  3164
!
75b8fb924904 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
75b8fb924904 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
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
  3167
    "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
  3168
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3169
    nPixel ~~ 0 ifTrue:[
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3170
        self scrollTo:(viewOrigin + (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3171
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3172
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3173
    "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
  3174
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3175
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3176
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
  3177
    "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
  3178
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3179
    ^ 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
  3180
!
75b8fb924904 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
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
  3183
    "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
  3184
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3185
    ^ 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
  3186
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3187
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3188
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
  3189
    "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
  3190
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3191
    "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
  3192
     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
  3193
75b8fb924904 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
    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
  3195
!
75b8fb924904 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
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
  3198
    "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
  3199
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3200
    |pxlOffset|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3201
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3202
    aColNr == 1 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
  3203
	leftOffset ~~ 0 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
  3204
	    self scrollLeft:leftOffset.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3205
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3206
	^ 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
  3207
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3208
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3209
    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
  3210
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3211
    pxlOffset < leftOffset 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
  3212
	self scrollLeft:(leftOffset - pxlOffset)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3213
    ] ifFalse:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3214
	pxlOffset > leftOffset 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
  3215
	    self scrollRight:(pxlOffset - leftOffset)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3216
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3217
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3218
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3219
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3220
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
  3221
    "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
  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
    leftOffset ~~ 0 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
  3224
	self scrollToCol: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
  3225
    ]
75b8fb924904 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
!
75b8fb924904 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
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
  3229
    "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
  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
    aLineNr < firstLineShown 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
  3232
	self scrollUp:(firstLineShown - 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
  3233
    ] ifFalse:[
75b8fb924904 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
	aLineNr > firstLineShown 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
  3235
	    self scrollDown:(aLineNr - 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
  3236
	]
75b8fb924904 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
!
75b8fb924904 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
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3240
scrollToPercent:percentOrigin
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3241
    "scroll to a position given in percent of total"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3242
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3243
    "kludge - ListView thinks in lines"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3244
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3245
    self scrollHorizontalToPercent:percentOrigin x.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3246
    self scrollVerticalToPercent:percentOrigin y.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3247
!
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3248
249
75b8fb924904 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
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
  3250
    "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
  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
    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
  3253
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3254
75b8fb924904 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
scrollUp:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3256
    "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
  3257
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3258
    nLines ~~ 0 ifTrue:[
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3259
        self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3260
               redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3261
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3262
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  3263
    "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
  3264
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3265
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3266
scrollUpPixels:pix
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3267
    "change origin to scroll up some pixels 
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3268
     (towards the top of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3269
    THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3270
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3271
    pix > 0 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3272
	self scrollTo:(viewOrigin - (0 @ pix)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3273
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3274
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3275
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3276
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3277
249
75b8fb924904 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
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
  3279
    "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
  3280
75b8fb924904 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
    |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
  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
    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
  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
    "/ 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
  3286
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3287
    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
  3288
	nL := nL + 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
  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
    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
  3291
    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
  3292
!
75b8fb924904 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
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
  3295
    "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
  3296
     - 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
  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
    |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
  3299
75b8fb924904 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
    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
  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
    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
  3303
    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
  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
    (deltaT = autoScrollDeltaT) ifFalse:[
75b8fb924904 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
	autoScrollDeltaT := deltaT.
75b8fb924904 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
	autoScrollBlock 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
  3308
	    autoScrollBlock := [self 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
  3309
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3310
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3311
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3312
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3313
75b8fb924904 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
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
  3315
    "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
  3316
     - 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
  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
    |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
  3319
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3320
    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
  3321
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3322
    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
  3323
    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
  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
    (deltaT = autoScrollDeltaT) ifFalse:[
75b8fb924904 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
	autoScrollDeltaT := deltaT.
75b8fb924904 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
	autoScrollBlock 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
  3328
	    autoScrollBlock := [self scrollSelectLeft].
75b8fb924904 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
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
75b8fb924904 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
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3331
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3332
!
75b8fb924904 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
75b8fb924904 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
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
  3335
    "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
  3336
     - 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
  3337
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3338
    |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
  3339
75b8fb924904 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
    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
  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
    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
  3343
    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
  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
    (deltaT = autoScrollDeltaT) ifFalse:[
75b8fb924904 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
	autoScrollDeltaT := deltaT.
75b8fb924904 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
	autoScrollBlock 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
  3348
	    autoScrollBlock := [self scrollSelectRight].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3349
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3350
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3351
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3352
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3353
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3354
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
  3355
    "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
  3356
     - 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
  3357
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3358
    |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
  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
    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
  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
    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
  3363
    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
  3364
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3365
    (deltaT = autoScrollDeltaT) ifFalse:[
75b8fb924904 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
	autoScrollDeltaT := deltaT.
75b8fb924904 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
	autoScrollBlock 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
  3368
	    autoScrollBlock := [self 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
  3369
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
75b8fb924904 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
    ]
75b8fb924904 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
!
75b8fb924904 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
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
  3375
    "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
  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
    autoScrollBlock notNil 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
  3378
	self compressMotionEvents: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
  3379
	Processor removeTimedBlock:autoScrollBlock.
75b8fb924904 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
	autoScrollBlock := 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
  3381
	autoScrollDeltaT := 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
  3382
    ].
75b8fb924904 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
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3385
verticalScrollStep
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3386
    "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
  3387
     Here, the scrolling unit is lines."
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3388
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3389
    ^ 1
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3390
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3391
    "Created: / 21.5.1999 / 14:00:12 / cg"
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3392
!
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  3393
249
75b8fb924904 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
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
  3395
    "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
  3396
     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
  3397
     (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
  3398
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3399
    ^ 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
  3400
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3401
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3402
!ListView methodsFor:'scrolling basic'!
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3403
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3404
scrollTo:anOrigin redraw:doRedraw
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3405
    "change origin to have newOrigin be visible at the top-left.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3406
     The argument defines the integer device coordinates of the new top-left 
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3407
     point.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3408
    "
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3409
    |dltOrg
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3410
     noLn "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3411
     max  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3412
     tmp  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3413
     h    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3414
     w    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3415
     y0   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3416
     y1   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3417
     y    "{ Class:SmallInteger }"
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3418
     x    "{ Class:SmallInteger }"
1712
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  3419
     delta newFirstLine newViewOrigin newLeftOffset
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3420
     hBefore wBefore inv wg|
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3421
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3422
    hBefore := height.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3423
    wBefore := width.
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3424
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3425
    dltOrg := anOrigin - viewOrigin.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3426
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3427
"/  compute valid horizontal offset x
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3428
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3429
    (x := dltOrg x) ~~ 0 ifTrue:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3430
        tmp := leftOffset + x.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3431
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3432
        x < 0 ifTrue:[                                          "/ scrolling left
1888
5a6d274027bf fix: scroll-left
Claus Gittinger <cg@exept.de>
parents: 1885
diff changeset
  3433
            tmp < 0 ifTrue:[x := 0 - leftOffset]
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3434
        ] ifFalse:[                                             "/ scrolling right
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3435
         "/ allows scrolling to the right of widest line
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3436
            max := self widthOfContents + 10.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3437
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3438
            tmp + width > max ifTrue:[
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3439
                x := (max - leftOffset - width) max:0
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3440
            ]
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3441
        ]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3442
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3443
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3444
"/  compute valid vertical offset measured in lines
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3445
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3446
    (y := dltOrg y // fontHeight) ~~ 0 ifTrue:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3447
        tmp := firstLineShown + y.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3448
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3449
        y < 0 ifTrue:[                                          "/ scrolling up
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3450
            tmp < 1 ifTrue:[y := 1 - firstLineShown]
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3451
        ] ifFalse:[                                             "/ scrolling down
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3452
            max := self size.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3453
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3454
            tmp + nFullLinesShown > max ifTrue:[
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3455
                y := (max - firstLineShown - nFullLinesShown + 1) max:0
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3456
            ]
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3457
        ]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3458
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3459
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3460
    (x == 0 and:[y == 0]) ifTrue:[                              "/ has viewOrigin changed ?
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3461
        ^ self
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3462
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3463
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3464
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3465
    (noLn := y) ~~ 0 ifTrue:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3466
        y := y * fontHeight
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3467
    ].
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3468
    delta := (x @ y).
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3469
1582
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3470
    newFirstLine := firstLineShown + noLn.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3471
    newViewOrigin := viewOrigin + delta.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3472
    newLeftOffset := newViewOrigin x.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3473
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3474
    (shown and:[doRedraw]) ifFalse:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3475
        self originWillChange.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3476
        firstLineShown := newFirstLine.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3477
        viewOrigin := newViewOrigin.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3478
        leftOffset := newLeftOffset.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3479
        ^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3480
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3481
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3482
"/    (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[               "/ outstanding expose events
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3483
"/        self invalidate.                                        "/ redraw all
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3484
"/        self originWillChange.
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3485
"/        ^ self originChanged:(x @ y )
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3486
"/    ].
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3487
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3488
    (     (y ~~ 0 and:[x ~~ 0])         "/ both x and y changed
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3489
      or:[(noLn abs) >= nLinesShown     "/ at least one area is
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3490
      or:[(x abs) > (width // 4 * 3)]]  "/ big enough to redraw all
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3491
    ) ifTrue:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3492
        self originWillChange.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3493
        firstLineShown := newFirstLine.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3494
        viewOrigin := newViewOrigin.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3495
        leftOffset := newLeftOffset.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3496
        self invalidate.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3497
        ^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3498
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3499
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3500
    "/ OLD:
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3501
    "/ self repairDamage.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  3502
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3503
    (wg := self windowGroup) notNil ifTrue:[
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3504
        wg processRealExposeEventsFor:self.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3505
    ].
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3506
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3507
    self originWillChange.
1970
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3508
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3509
    "/ make certain, that all drawing is complete
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3510
    "/ device sync.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3511
1975
0eda51a6d48e uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents: 1972
diff changeset
  3512
    self catchExpose.
1970
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  3513
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3514
    x == 0 ifTrue:[                                             
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3515
        "/ scrolling vertical
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3516
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3517
        y0 := textStartTop + (y abs).
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3518
        h  := hBefore - margin - y0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3519
        w  := wBefore - margin.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3520
        y > 0 ifTrue:[                                          "/ copy down
1977
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  3521
            "/ kludge: if the selection highlighting draws into the textStartTop area,
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  3522
            "/ the copy below leaves some selection depris in the top area.
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  3523
            "/ Therefore, clear the top area.
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  3524
            "/ (should avoid this, in case we know there cannot be anything
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  3525
            "/  there - selection is nil or >= firstLineShown).
1983
3261af8573c6 scrolling redraw bug on w32
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
  3526
            self clearDeviceRectangleX:margin y:margin width:width-margin-margin height:(textStartTop-margin).
3261af8573c6 scrolling redraw bug on w32
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
  3527
"/            self invalidateDeviceRectangle:((margin@margin) corner:(width-margin@textStartTop)) repairNow:false.
1977
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  3528
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3529
            self copyFrom:self
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3530
                        x:0 y:y0 toX:0 y:textStartTop
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3531
                    width:w height:h async:true.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3532
            y1 := h.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3533
        ] ifFalse:[                                             "/ copy up
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3534
            self copyFrom:self
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3535
                        x:margin y:textStartTop toX:margin y:y0
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3536
                    width:w height:h async:true.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3537
            y1 := 0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3538
        ].
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3539
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3540
        inv := (margin@y1) extent:(w@y0).      
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3541
    ] ifFalse:[                                                 
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3542
        "/ scrolling horizontal
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3543
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3544
        x > 0 ifTrue:[                                          "/ scrolling right
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3545
            y0 := margin + x.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3546
            y1 := wBefore - y0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3547
        ] ifFalse:[                                             "/ scrolling left
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3548
            y0 := margin - x.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3549
            y1 := 0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3550
        ].
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3551
        h := hBefore - margin - margin.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3552
        w := wBefore - margin - y0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3553
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3554
        x > 0 ifTrue:[                                          "/ copy right
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3555
            self copyFrom:self x:y0 y:margin toX:margin y:margin
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3556
                    width:w height:h async:true.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3557
        ] ifFalse:[                                             "/ copy left
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3558
            "/self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3559
            self copyFrom:self x:margin y:margin toX:y0 y:margin
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3560
                    width:w height:h async:true.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3561
        ].
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3562
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3563
        inv := (y1@margin) extent:(y0@h).      
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3564
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3565
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3566
    firstLineShown := newFirstLine.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3567
    viewOrigin := newViewOrigin.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3568
    leftOffset := newLeftOffset.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  3569
1885
Claus Gittinger <cg@exept.de>
parents: 1884
diff changeset
  3570
    self invalidateDeviceRectangle:inv repairNow:false.
1712
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  3571
1975
0eda51a6d48e uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents: 1972
diff changeset
  3572
    self originChanged:delta.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  3573
    self waitForExpose.
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3574
2202
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  3575
    (wg := self windowGroup) notNil ifTrue:[
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  3576
        wg processRealExposeEventsFor:self.
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  3577
    ].
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  3578
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3579
"/    (hBefore ~= height or:[wBefore ~= width]) ifTrue:[
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3580
"/        self halt.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3581
"/    ].
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  3582
1983
3261af8573c6 scrolling redraw bug on w32
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
  3583
    "Modified: / 11.8.1999 / 19:40:47 / cg"
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3584
! !
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3585
249
75b8fb924904 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
!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
  3587
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3588
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
  3589
    "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
  3590
     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
  3591
     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
  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
    |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
  3594
75b8fb924904 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
    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
  3596
    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
  3597
75b8fb924904 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
    "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
  3599
    (wordCheck value:thisCharacter) 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
  3600
	[wordCheck value:thisCharacter] whileTrue:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3601
	    beginCol := beginCol - 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
  3602
	    beginCol < 1 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
  3603
		thisCharacter := Character space
75b8fb924904 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
	    ] ifFalse:[
75b8fb924904 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
		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
  3606
	    ]
75b8fb924904 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
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3608
	beginCol := beginCol + 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
  3609
    ] ifFalse:[
75b8fb924904 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
	"nope - maybe its a space"
75b8fb924904 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
	thisCharacter == Character space 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
  3612
	    [beginCol > 1 and:[thisCharacter == Character space]] whileTrue:[
75b8fb924904 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
		beginCol := beginCol - 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
  3614
		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
  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
	    thisCharacter ~~ Character space 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
  3617
		beginCol := beginCol + 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
  3618
	    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3619
	] ifFalse:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3620
	    "select 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
  3621
	]
75b8fb924904 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
    ^ 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
  3624
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3625
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3626
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
  3627
    "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
  3628
     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
  3629
     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
  3630
     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
  3631
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3632
    |endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3633
     len    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3634
     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
  3635
75b8fb924904 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
    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
  3637
    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
  3638
    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
  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
    "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
  3641
    (wordCheck value:thisCharacter) 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
  3642
	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
  3643
	[wordCheck value:thisCharacter] whileTrue:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3644
	    endCol := 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
  3645
	    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
  3646
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3647
	endCol := 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
  3648
    ] ifFalse:[
75b8fb924904 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
	"nope - maybe its a space"
75b8fb924904 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
	thisCharacter == Character space 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
  3651
	    len := (self listAt:selectLine) 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
  3652
	    endCol > len 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
  3653
		"select rest 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
  3654
		endCol := 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
  3655
	    ] ifFalse:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3656
		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
  3657
		[endCol <= len and:[thisCharacter == Character space]] whileTrue:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3658
		    endCol := 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
  3659
		    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
  3660
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3661
		endCol := 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
  3662
	    ]
75b8fb924904 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
	] ifFalse:[
75b8fb924904 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
	    "select 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
  3665
	]
125
claus
parents: 121
diff changeset
  3666
    ].
249
75b8fb924904 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
    ^ 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
  3668
!
75b8fb924904 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
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3670
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
  3671
    "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
  3672
     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
  3673
     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
  3674
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3675
    |lineString 
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3676
     found firstChar1 firstChar2 c pc
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3677
     col         "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3678
     cc          "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3679
     patternSize "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3680
     line1       "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3681
     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
  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
    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
  3684
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3685
	self withCursor:Cursor questionMark do:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3686
	    col := startCol - 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3687
	    firstChar1 := pattern at:1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3688
	    ignCase ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3689
		firstChar1 := firstChar1 asLowercase.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3690
		firstChar2 := firstChar1 asUppercase.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3691
	    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3692
		firstChar2 := firstChar1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3693
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3694
	    col > (list at:startLine) size ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3695
		col := -999
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3696
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3697
	    line1 := startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3698
	    line1 to:1 by:-1 do:[:lnr |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3699
		lineString := list at:lnr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3700
		lineString notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3701
		    lineSize := lineString size.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3702
		    col == -999 ifTrue:[col := lineSize - patternSize + 1].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3703
		    [(col > 0) 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3704
		     and:[(c := lineString at:col) ~= firstChar1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3705
		     and:[c ~= firstChar2]]] whileTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3706
			col := col - 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3707
		    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3708
		    [col > 0] whileTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3709
			cc := col.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3710
			found := true.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3711
			1 to:patternSize do:[:cnr |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3712
			    cc > lineSize ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3713
				found := false
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3714
			    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3715
				pc := pattern at:cnr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3716
				c := lineString at:cc.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3717
				pc ~= c ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3718
				    (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3719
					found := false
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3720
				    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3721
				]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3722
			    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3723
			    cc := cc + 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3724
			].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3725
			found ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3726
			    ^ block1 value:lnr value:col.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3727
			].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3728
			col := col - 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3729
			[(col > 0) 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3730
			and:[(c := lineString at:col) ~= firstChar1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3731
			and:[c ~= firstChar2]]] whileTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3732
			    col := col - 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3733
			]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3734
		    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3735
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3736
		col := -999.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3737
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3738
	]
249
75b8fb924904 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
    ].
75b8fb924904 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
    "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
  3741
75b8fb924904 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
    ^ block2 value
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3743
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3744
    "Created: 13.9.1997 / 01:06:19 / cg"
1338
9d59c19b9328 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  3745
    "Modified: 5.10.1997 / 01:53:18 / 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
  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
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3748
searchBackwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3749
    "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
  3750
     found evaluate block2.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3751
     Sorry, but pattern is no regular expression pattern (yet)"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3752
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3753
    ^ self
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3754
	searchBackwardFor:pattern 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3755
	ignoreCase:false 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3756
	startingAtLine:startLine col:startCol 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3757
	ifFound:block1 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3758
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3759
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3760
    "Modified: 13.9.1997 / 01:07:36 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3761
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3762
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3763
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
  3764
    "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
  3765
     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
  3766
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  3767
    |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
  3768
     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
  3769
     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
  3770
     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
  3771
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3772
    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
  3773
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3774
	self withCursor:Cursor questionMark do:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3775
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3776
	    col := startCol + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3777
	    line1 := startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3778
	    line2 := list size.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3779
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3780
	    pattern includesUnescapedMatchCharacters ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3781
		p := pattern species new:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3782
		(pattern startsWith:$*) ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3783
		    p := p , '*'
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3784
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3785
		p := p , pattern.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3786
		(pattern endsWith:$*) ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3787
		    p := p , '*'
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3788
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3789
		realPattern := pattern.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3790
		(realPattern startsWith:$*) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3791
		    realPattern := realPattern copyFrom:2
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3792
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3793
		line1 to:line2 do:[:lnr |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3794
		    lineString := list at:lnr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3795
		    lineString notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3796
			"/ first a crude check ...
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3797
			(p match:lineString ignoreCase:ignCase) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3798
			    "/ ok, there it is; look at which position
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3799
			    col := lineString 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3800
					findMatchString:realPattern 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3801
					startingAt:col 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3802
					ignoreCase:ignCase 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3803
					ifAbsent:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3804
			    col ~~ 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3805
				^ block1 value:lnr value:col.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3806
			    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3807
			].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3808
		    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3809
		    col := 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3810
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3811
	    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3812
		p := pattern withoutMatchEscapes.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3813
		line1 to:line2 do:[:lnr |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3814
		    lineString := list at:lnr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3815
		    lineString isString ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3816
			ignCase ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3817
			    col := lineString 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3818
					findMatchString:p 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3819
					startingAt:col 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3820
					ignoreCase:ignCase 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3821
					ifAbsent:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3822
			] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3823
			    col := lineString 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3824
					findString:p 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3825
					startingAt:col 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3826
					ifAbsent:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3827
			].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3828
			col ~~ 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3829
			    ^ block1 value:lnr value:col.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3830
			]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3831
		    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3832
		    col := 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3833
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3834
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3835
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3836
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3837
    "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
  3838
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3839
    ^ block2 value
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  3840
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3841
    "Created: 13.9.1997 / 01:06:31 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3842
    "Modified: 13.9.1997 / 01:11:28 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3843
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3844
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3845
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3846
    "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
  3847
     found evaluate block2."
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3848
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3849
    ^ self
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3850
	searchForwardFor:pattern 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3851
	ignoreCase:false 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3852
	startingAtLine:startLine col:startCol 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3853
	ifFound:block1 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3854
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3855
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3856
    "Modified: 13.9.1997 / 01:07:11 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  3857
! !
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3858
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3859
!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
  3860
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3861
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
  3862
    "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
  3863
     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
  3864
     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
  3865
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3866
    |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
  3867
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3868
    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
  3869
    list notNil ifTrue:[
2188
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3870
        nLines := self size.
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3871
        1 to:nLines do:[:index |
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3872
            line := self at:index.
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3873
            line notNil ifTrue:[
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3874
                line isString ifTrue:[
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3875
                    newLine := line withTabsExpanded.
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3876
                    newLine ~~ line ifTrue:[
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3877
                        list at:index put:newLine
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3878
                    ].
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3879
                ] ifFalse:[
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3880
                    includesNonStrings := true.
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3881
                ]
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3882
            ]
ef616e3ac785 #expandTabs do not raise any change notification
ca
parents: 2182
diff changeset
  3883
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3884
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3885
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3886
    "Modified: 30.8.1995 / 19:06:37 / claus"
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  3887
    "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
  3888
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3889
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3890
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
  3891
    "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
  3892
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3893
    ^ 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
  3894
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3895
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3896
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
  3897
    "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
  3898
     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
  3899
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3900
    |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
  3901
     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
  3902
     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
  3903
     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
  3904
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3905
    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
  3906
    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
  3907
    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
  3908
    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
  3909
    [thisTab <= col] whileTrue:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3910
	(tabIndex == nTabs) ifTrue:[^ 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
  3911
	tabIndex := 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
  3912
	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
  3913
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3914
    ^ 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
  3915
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3916
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3917
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
  3918
    "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
  3919
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3920
    |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
  3921
     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
  3922
     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
  3923
     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
  3924
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3925
    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
  3926
    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
  3927
    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
  3928
    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
  3929
    [thisTab < col] whileTrue:[
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3930
	(tabIndex == nTabs) ifTrue:[^ 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
  3931
	tabIndex := 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
  3932
	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
  3933
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3934
    (tabIndex == 1) 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
  3935
	^ 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
  3936
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3937
    ^ 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
  3938
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3939
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3940
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
  3941
    "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
  3942
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3943
    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
  3944
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3945
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3946
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
  3947
    "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
  3948
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3949
    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
  3950
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3951
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3952
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
  3953
    "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
  3954
     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
  3955
     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
  3956
     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
  3957
     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
  3958
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3959
    |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
  3960
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3961
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3962
     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
  3963
     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
  3964
     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
  3965
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3966
    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
  3967
    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
  3968
    (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
  3969
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3970
    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
  3971
    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
  3972
    [newLine startsWith:eightSpaces] whileTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3973
	newLine := newLine copyFrom:9.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3974
	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
  3975
    ].
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3976
    ^ (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
  3977
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3978
    "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
  3979
!
75b8fb924904 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
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
  3982
    "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
  3983
     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
  3984
     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
  3985
     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
  3986
75b8fb924904 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
    |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
  3988
     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
  3989
     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
  3990
     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
  3991
75b8fb924904 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
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3993
     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
  3994
     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
  3995
     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
  3996
     (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
  3997
      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
  3998
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3999
    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
  4000
    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
  4001
    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
  4002
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4003
    currentMax := line size + (nTabs * 7).
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4004
    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
  4005
    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
  4006
    line do:[:character |
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4007
	(character == (Character tab)) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4008
	    nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4009
	    [dstIndex < nextTab] whileTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4010
		tmpString at:dstIndex put:(Character space).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4011
		dstIndex := dstIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4012
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4013
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4014
	    tmpString at:dstIndex put:character.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4015
	    dstIndex := dstIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4016
	].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4017
	(dstIndex > currentMax) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4018
	    "
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4019
	     this cannot happen with <= 8 tabs
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4020
	    "
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4021
	    currentMax := currentMax + currentMax.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4022
	    nString := line species new:currentMax.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4023
	    nString replaceFrom:1 to:(dstIndex - 1) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4024
			   with:tmpString startingAt:1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4025
	    tmpString := nString.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4026
	    nString := nil
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4027
	].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4028
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4029
	"make stc-optimizer happy
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4030
	 - no need to return value of ifTrue:/ifFalse above"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4031
	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
  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
    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
  4034
    dstIndex == currentMax ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4035
	^ 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
  4036
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4037
    ^ tmpString copyTo:dstIndex
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4038
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4039
    "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
  4040
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4042
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
  4043
    "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
  4044
     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
  4045
     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
  4046
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4047
    ^ 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
  4048
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4049
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  4050
!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
  4051
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4052
version
2208
a37459b4dffa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2202
diff changeset
  4053
    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.227 2000-08-09 22:18:02 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
  4054
! !