ListView.st
author Claus Gittinger <cg@exept.de>
Tue, 24 Feb 1998 18:33:49 +0100
changeset 1452 d4c481299b88
parent 1451 3598c65cd89d
child 1453 d07b4b418106
permissions -rw-r--r--
fix bitBlt-copying of margin when removing a line.
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
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
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
    14
	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
    15
		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
    16
		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
    17
		fontAscent fontIsFixedWidth fontWidth autoScroll autoScrollBlock
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
    18
		autoScrollDeltaT lastSearchPattern lastSearchIgnoredCase
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
    19
		wordCheck includesNonStrings widthOfWidestLine listMsg viewOrigin
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
    20
		listChannel'
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
    21
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions'
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    22
	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
    23
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    24
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    25
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
    26
!ListView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    27
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    28
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    29
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    30
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    31
	      All Rights Reserved
38
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
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    34
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    36
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    37
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    38
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    39
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    40
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    41
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    42
documentation
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    43
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    44
    a View for (string-)lists.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    45
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    46
    This class can only passively display collections of strings-
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    47
    selections, editing, cursors etc. must be done in subclasses.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    48
    see SelectionInListView, TextView etc.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    49
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    50
    This code currently handles only fixed-height fonts correctly -
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    51
    should be rewritten in some places ...
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    52
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    53
    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
    54
    which should be changed to have this behavior optionally for smooth scroll.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    55
120
claus
parents: 118
diff changeset
    56
    The text is internally kept in the list instance variable, and is supposed to consist
claus
parents: 118
diff changeset
    57
    of a collection (Ordered- or StringCollection) of line entries.
claus
parents: 118
diff changeset
    58
    Typically, individual entries are either strings or nil (for empty lines).
claus
parents: 118
diff changeset
    59
    However, any object which supports the displayOn: and widthIn: protocol can be
claus
parents: 118
diff changeset
    60
    used - see MultipleColumnListEntry as an example.
claus
parents: 118
diff changeset
    61
    Therefore, ListView (and all subclasses) are prepared to handle non-string entries
claus
parents: 118
diff changeset
    62
    (especially: attributed Text).
claus
parents: 118
diff changeset
    63
claus
parents: 118
diff changeset
    64
    The internal version of the text has tabulators expanded to blanks - when text is exchanged
claus
parents: 118
diff changeset
    65
    with an external medium (i.e. reading/writing files), these are expanded/compressed assuming
claus
parents: 118
diff changeset
    66
    a tab-setting of 8. This is done independent of the users tab setting, which is used
claus
parents: 118
diff changeset
    67
    while the text is edited. Thus, even if the tab setting is multiple of 4's, tabs are
claus
parents: 118
diff changeset
    68
    written in multiples of 8 when the text is saved. Since this is the default on all ascii
claus
parents: 118
diff changeset
    69
    terminals and printers, this assures that the text looks correctly indented when finally printed.
claus
parents: 118
diff changeset
    70
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    71
    Notice:
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    72
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    73
    ListView is one of the oldest widget classes in the current system and
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    74
    definitely requires some rewrite:
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    75
120
claus
parents: 118
diff changeset
    76
    Due to historic reasons (ListView implemented scrolling before the general
claus
parents: 118
diff changeset
    77
    scrolling code in View was added), this one does scrolling different from all other
claus
parents: 118
diff changeset
    78
    views. The general scrolling code (in View) uses the transformation for transparent scrolling.
claus
parents: 118
diff changeset
    79
    Here, the transformation is not used, instead it is done again, by keeping the firstLineShown
claus
parents: 118
diff changeset
    80
    (i.e. vertical offset) and leftOffset (horizontal offset).
claus
parents: 118
diff changeset
    81
    The most annoying consequence of this is, that scrolling is done by lines here, 
claus
parents: 118
diff changeset
    82
    while its done in pixels in the View class. Thus, be careful, when changing things
claus
parents: 118
diff changeset
    83
    (better: dont touch it ;-)
claus
parents: 118
diff changeset
    84
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    85
    Also, all controller functionality is completely performed by the listView
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    86
    (and subclasses) itself. It is still possible, to define and set a specialized
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    87
    controller, though. I.e. if you like to change the input behavior, define
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    88
    a corresponding controller class and intersect the keyXXX/buttonXXX messages
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    89
    there.
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    90
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    91
    This will be totally rewritten ... so dont depend on the internals; especially the scrolling
120
claus
parents: 118
diff changeset
    92
    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
    93
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    94
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
    95
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    96
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
    97
      list                <aCollection>           the text strings, a collection of lines.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
    98
						  Nils may be used for empty lines.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
    99
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   100
      firstLineShown      <Number>                the index of the 1st visible line (1 ..)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   101
      leftOffset          <Number>                left offset for horizontal scroll
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
      nFullLinesShown     <Number>                the number of unclipped lines in visible area
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   104
                                                  (internal; updated on size changes)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   105
      nLinesShown         <Number>                the number of lines in visible area, incl. partial
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   106
                                                  (internal; updated on size changes)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   107
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   108
      fgColor             <Color>                 color to draw characters
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   109
      bgColor             <Color>                 the background
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
      partialLines        <Boolean>               allow last line to be partial displayed
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   112
      leftMargin          <Number>                margin at left in pixels
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   113
      topMargin           <Number>                margin at top in pixels
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   114
      textStartLeft       <Number>                margin + leftMargin (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   115
      textStartTop        <Number>                margin + topMargin (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   116
      innerWidth          <Number>                width - margins (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   117
      tabPositions        <aCollection>           tab stops (cols)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   118
      fontHeight          <Number>                font height in pixels (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   119
      fontAscent          <Number>                font ascent in pixels (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   120
      fontIsFixed         <Boolean>               true if its a fixed font (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   121
      fontWidth           <Number>                width of space (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   122
      lineSpacing         <Number>                pixels between lines
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   123
      lastSearchPattern   <String>                last pattern for searching 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   124
						  (kept to provide a default for next search)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   125
      lastSearchIgnoredCase   <Boolean>           last search ignored case
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   126
						  (kept to provide a default for next search)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   127
      wordCheck           <Block>                 rule used for check for word boundaries in word select
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   128
                                                  The default rule is to return true for alphaNumeric characters.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   129
                                                  (can be changed to allow for underscore and other
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   130
                                                   characters to be treated as alphaCharacters)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   131
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   132
      autoScrollBlock     <Block>                 block installed as timeoutBlock when doing an
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   133
                                                  autoScroll (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   134
      autoScrollDeltaT                            computed scroll time delta in seconds (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   135
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   136
      includesNonStrings                          cached flag if any non-strings are in list
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   137
      widthOfWidestLine                           cached width of widest line
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   138
      listMsg                                     if view has a model and listMsg is non-nil,
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   139
                                                  this is sent to the model to aquired a new contents
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   140
                                                  whenever a change of the aspect  (aspectMsg) occurs.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   141
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   142
      viewOrigin                                  the current origin 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   143
120
claus
parents: 118
diff changeset
   144
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   145
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   146
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   147
      textForegroundColor                         defaults to Black
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   148
      textBackgroundColor                         defaults to White
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   149
      textFont                                    defaults to defaultFont
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   150
      textTabPositions                            defaults to #(1 9 17 25 ...)
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   151
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   152
    [author:]
911
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 909
diff changeset
   153
        Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   154
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   155
    [see also:]
911
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 909
diff changeset
   156
        TextView EditTextView
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   157
        
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   158
"
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   159
!
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   160
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   161
examples 
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   162
"
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   163
    ListViews alone are rarely used - its mostly an abstract superclass
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   164
    for TextView, EditTextView and SelectionInListView.
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   165
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   166
    anyway, here are a few examples:
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   167
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   168
     basic simple setup:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   169
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   170
	|top l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   171
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   172
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   173
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   174
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   175
	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
   176
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   177
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   178
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   179
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   180
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   181
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   182
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   183
      specifying textMargins (these have NOTHING to do with the viewInset):
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   184
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   185
	|top l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   186
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   187
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   188
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   189
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   190
	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
   191
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   192
	l topMargin:10.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   193
	l leftMargin:20.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   194
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   195
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   196
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   197
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   198
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   199
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   200
      globally set the fg/bg colors:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   201
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   202
	|top l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   203
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   204
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   205
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   206
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   207
	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
   208
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   209
	l foregroundColor:(Color white).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   210
	l backgroundColor:(Color blue).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   211
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   212
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   213
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   214
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   215
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   216
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   217
      non-string (text) entries:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   218
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   219
	|top list l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   220
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   221
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   222
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   223
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   224
	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
   225
	list := #('all' 'of' 'your' 'preferred' 'colors') 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   226
		with:#(red green blue 'orange' cyan)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   227
		collect:[:s :clr | 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   228
			    Text string:s 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   229
				 emphasis:(Array with:#bold
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   230
						 with:(#color->(Color name:clr))) ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   231
	l list:list.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   232
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   233
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   234
									[exEnd]
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   235
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   236
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   237
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   238
      generic non-string entries:
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   239
      (notice: ColoredListEntry is obsoleted by Text)
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   240
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   241
	|top list l|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   242
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   243
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   244
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   245
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   246
	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
   247
	list := #('all' 'of' 'your' 'preferred' 'colors') 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   248
		with:#(red green blue 'orange' cyan)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   249
		collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   250
	l list:list.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   251
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   252
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   253
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   254
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   255
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   256
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   257
      using a model (default listMessage is aspectMessage):
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   258
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   259
	|top model l theModelsText|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   260
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   261
	model := Plug new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   262
	model respondTo:#modelsAspect
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   263
		   with:[ theModelsText ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   264
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   265
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   266
	top extent:100@200.
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
	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
   269
	l model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   270
	l aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   271
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   272
	top open.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   273
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   274
	Delay waitForSeconds:3.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   275
	theModelsText := #('foo' 'bar' 'baz').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   276
	model changed:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   277
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   278
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   279
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   280
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   281
      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
   282
      for two listViews:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   283
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   284
	|top model l1 l2 plainText|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   285
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   286
	plainText := #('').
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
	model := Plug new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   289
	model respondTo:#modelsUppercaseText
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   290
		   with:[ plainText asStringCollection 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   291
			      collect:[:l | l asUppercase]].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   292
	model respondTo:#modelsLowercaseText
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   293
		   with:[ plainText asStringCollection 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   294
			      collect:[:l | l asLowercase]].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   295
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   296
	top := StandardSystemView extent:200@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   297
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   298
	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
   299
	l1 model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   300
	l1 aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   301
	l1 listMessage:#modelsUppercaseText.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   302
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   303
	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
   304
	l2 model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   305
	l2 aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   306
	l2 listMessage:#modelsLowercaseText.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   307
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   308
	top open.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   309
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   310
	Delay waitForSeconds:3.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   311
	plainText := #('foo' 'bar' 'baz').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   312
	model changed:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   313
									[exEnd]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   314
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   315
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   316
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   317
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   318
!ListView class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   319
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   320
defaultTabPositions
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   321
    ^ self tab8Positions
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   322
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   323
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   324
tab4Positions
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   325
    ^ #(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
   326
	85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145)
120
claus
parents: 118
diff changeset
   327
!
claus
parents: 118
diff changeset
   328
claus
parents: 118
diff changeset
   329
tab8Positions
claus
parents: 118
diff changeset
   330
    ^ #(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
   331
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   332
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   333
updateStyleCache
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   334
    "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
   335
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   336
    <resource: #style (#'text.foregroundColor' #'text.backgroundColor'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   337
                       #'text.tabPositions'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   338
                       #'text.font')>
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   339
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   340
    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   341
    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:White.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   342
    DefaultFont := StyleSheet fontAt:'text.font'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   343
    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
   344
    DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions].
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   345
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   346
    "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
   347
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   348
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   349
!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
   350
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   351
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
   352
    "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
   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
    ^ 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
   355
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   356
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   357
backgroundColor:aColor
1222
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   358
    "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
   359
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   360
    bgColor ~~ aColor ifTrue:[
1222
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   361
        bgColor := aColor.
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   362
        self viewBackground:bgColor.
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   363
        shown ifTrue:[
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   364
            self invalidate "/ clear; redraw
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   365
        ]
249
75b8fb924904 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
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   367
1222
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   368
    "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
   369
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   370
75b8fb924904 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
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
   372
    "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
   373
     Redraws everything.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   374
     CAVEAT: with the addition of Text objects,
1234
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   375
             this method is going to be obsoleted by a textStyle
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   376
             method, which allows specific control over
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   377
             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
   378
75b8fb924904 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
    aFont isNil ifTrue:[
1234
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   380
        ^ self error:'nil font'
249
75b8fb924904 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
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   382
    font ~~ aFont ifTrue:[
1234
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   383
        super font:(aFont on:device).
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   384
        preferredExtent := nil.
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   385
        widthOfWidestLine := nil. "/ i.e. unknown
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   386
        self getFontParameters.
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   387
        realized ifTrue:[
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   388
            (font graphicsDevice == device) ifTrue:[
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   389
                self getFontParameters.
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   390
                self computeNumberOfLinesShown.
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   391
                shown ifTrue:[
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   392
                    self redrawFromVisibleLine:1 to:nLinesShown
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   393
                ]
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   394
            ].
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   395
            self contentsChanged
9c7d9fb08c3f update label in case of font changed
ca
parents: 1222
diff changeset
   396
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   397
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   398
780
48f97576806f use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 776
diff changeset
   399
    "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
   400
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   401
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   402
fontHeight:pixels
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   403
    "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
   404
     by which lines are vertically separated."
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   405
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   406
    fontHeight ~~ pixels ifTrue:[
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   407
        fontHeight := pixels.
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   408
    ]
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   409
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   410
    "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
   411
!
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   412
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   413
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
   414
    "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
   415
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   416
    ^ 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
   417
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   418
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   419
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
   420
    "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
   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
    fgColor ~~ aColor ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   423
	fgColor := aColor.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   424
	shown ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   425
	    self invalidate 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   426
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   427
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   428
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   429
    "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
   430
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   431
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   432
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
   433
    "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
   434
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   435
    ((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   436
	fgColor := color1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   437
	bgColor := color2.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   438
	shown ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   439
	    self invalidate 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   440
	]
249
75b8fb924904 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
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   442
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   443
    "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
   444
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   445
75b8fb924904 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
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
   447
    "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
   448
     - 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
   449
     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
   450
75b8fb924904 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
    ^ 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
   452
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   453
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   454
innerHorizontalMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   455
    "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
   456
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   457
    ^ leftMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   458
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   459
    "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
   460
!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   461
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   462
innerVerticalMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   463
    "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
   464
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   465
    ^ topMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   466
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   467
    "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
   468
!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   469
249
75b8fb924904 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
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
   471
    "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
   472
75b8fb924904 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
    ^ 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
   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
75b8fb924904 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
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
   477
    "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
   478
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   479
    leftMargin := aNumber.
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   480
    textStartLeft := aNumber + margin.
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   481
    innerWidth := width - aNumber - margin
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   482
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   483
    "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
   484
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   485
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   486
level:aNumber
1249
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   487
    "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
   488
     (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
   489
376
fb823917008e correctly handle level changes if abs(lvl) changes
ca
parents: 352
diff changeset
   490
    |newMargin|
fb823917008e correctly handle level changes if abs(lvl) changes
ca
parents: 352
diff changeset
   491
1298
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   492
    aNumber ~~ level ifTrue:[
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   493
        newMargin := aNumber abs.
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   494
        textStartLeft := leftMargin + newMargin.
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   495
        textStartTop := topMargin + newMargin.
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   496
        innerWidth := width - textStartLeft - newMargin.
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   497
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   498
        super level:aNumber.
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   499
    ]
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   500
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   501
    "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
   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
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   504
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
   505
    "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
   506
     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
   507
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   508
    lineSpacing ~~ pixels ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   509
	lineSpacing := pixels.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   510
	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
   511
    ]
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   512
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   513
    "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
   514
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   515
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   516
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
   517
    "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
   518
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   519
    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
   520
    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
   521
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   522
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   523
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
   524
    "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
   525
75b8fb924904 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
    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
   527
    textStartTop := topMargin + margin.
339
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   528
!
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   529
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   530
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
   531
    "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
   532
     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
   533
     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
   534
     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
   535
     (national) characters.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   536
     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
   537
     (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
   538
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   539
    wordCheck := aBlock.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   540
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   541
    "Modified: 22.5.1996 / 12:26:55 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   542
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   543
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   544
!ListView methodsFor:'accessing-contents'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   545
249
75b8fb924904 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
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
   547
    "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
   548
75b8fb924904 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
    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
   550
    includesNonStrings ifFalse:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   551
        includesNonStrings := (aString notNil and:[aString isString not]).
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   552
"/        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
   553
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   554
    shown ifTrue:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   555
        self redrawLine:(self size).
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   556
        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
   557
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   558
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   559
    "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
   560
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   561
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   562
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
   563
    "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
   564
1351
03d1b138f98f add:aString beforeIndex:
ca
parents: 1338
diff changeset
   565
    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
   566
    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
   567
    includesNonStrings ifFalse:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   568
        includesNonStrings := (aString notNil and:[aString isString not]).
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   569
"/        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
   570
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   571
    shown ifTrue:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   572
        self redrawFromLine:index.
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   573
        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
   574
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   575
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   576
    "Modified: 22.10.1996 / 23:18:53 / cg"
65
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   577
!
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   578
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   579
at:lineNr
120
claus
parents: 118
diff changeset
   580
    "retrieve a line; return nil if beyond end-of-text.
claus
parents: 118
diff changeset
   581
     this allows textViews to be used like collections in some places."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   582
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   583
    list isNil ifTrue:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   584
    (lineNr between:1 and:self size) ifFalse:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   585
    ^ list at:lineNr
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   586
!
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   587
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   588
at:index put:aString
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   589
    "change a line and redisplay"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   590
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   591
    |visibleLine y|
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   592
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   593
    self withoutRedrawAt:index put:aString.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   594
    shown ifTrue:[
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   595
        "/ synchronous:
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   596
        self redrawLine:index
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   597
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   598
        "/ asynchronous:
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   599
"/        visibleLine := self listLineToVisibleLine:index.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   600
"/        visibleLine notNil ifTrue:[
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   601
"/            y := self yOfVisibleLine:visibleLine.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   602
"/            self invalidate:((margin @ y) extent:(width@fontHeight))
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   603
"/        ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   604
    ]
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   605
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   606
    "Modified: 18.4.1997 / 14:52:28 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   607
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   608
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   609
characterAtLine:lineNr col:colNr
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   610
    "return the character at physical line/col. 
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   611
     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
   612
     Return a space character if nothing is there
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   613
     (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
   614
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   615
    |line|
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   616
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   617
    list notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   618
	line := self listAt:lineNr.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   619
	line notNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   620
	    (line size >= colNr) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   621
		^ line at:colNr
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   622
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   623
	]
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   624
    ].
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   625
    ^ Character space
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   626
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   627
    "Created: 29.4.1996 / 12:11:00 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   628
    "Modified: 29.4.1996 / 12:12:41 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   629
!
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   630
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   631
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
   632
    "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
   633
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   634
    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
   635
    ^ list asStringCollection asString
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   636
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   637
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   638
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
   639
    "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
   640
     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
   641
     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
   642
     to a collection of line-strings here."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   643
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   644
    |l|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   645
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   646
    l := something.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   647
    l notNil ifTrue:[
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   648
        l isString ifTrue:[
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   649
            l := l asStringCollection
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   650
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   651
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   652
    self list:l
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   653
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   654
    "Modified: 5.6.1997 / 11:11:54 / cg"
51
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   655
!
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   656
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   657
from:from to:to do:aBlock
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   658
    "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
   659
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   660
    ^ list from:from to:to do:aBlock.
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   661
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   662
    "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
   663
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   664
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   665
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
   666
    "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
   667
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   668
    ^ 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
   669
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   670
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   671
list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   672
    "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
   673
     This returns the views internal list - modifying it may confuse
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   674
     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
   675
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   676
    ^ list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   677
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   678
    "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
   679
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   680
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   681
list:aCollection
128
claus
parents: 127
diff changeset
   682
    "set the contents (a collection of strings or list entries) 
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   683
     and scroll to 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
   684
     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
   685
     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
   686
     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
   687
     (remembered to optimize later redraws)."
128
claus
parents: 127
diff changeset
   688
claus
parents: 127
diff changeset
   689
    self list:aCollection expandTabs:true
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   690
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   691
    "Modified: 5.6.1997 / 11:10:45 / cg"
128
claus
parents: 127
diff changeset
   692
!
claus
parents: 127
diff changeset
   693
claus
parents: 127
diff changeset
   694
list:aCollection expandTabs:expand
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   695
    "set the contents (a collection of strings) and scroll to top-left.
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   696
     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
   697
     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
   698
     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
   699
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   700
    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
   701
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   702
    "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
   703
!
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   704
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   705
list:aCollection expandTabs:expand scanForNonStrings:scan
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   706
    "set the contents (a collection of strings) and scroll to top-left.
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   707
     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
   708
     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
   709
     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
   710
     (remembered to optimize later redraws)."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   711
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   712
    self
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   713
        list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   714
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   715
    "Modified: 5.6.1997 / 12:40:35 / cg"
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   716
!
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   717
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   718
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   719
    "set the contents (a collection of strings) and scroll to top-left.
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   720
     If expand is true, tabs are expanded (to spaces).
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   721
     If scan is true, scan the passed list for nonStrings; 
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   722
     otherwise, take the information from the nonStrings arg.
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   723
     (the nonStrings information is remembered to optimize later redraws & height computations)."
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   724
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   725
    |oldFirst oldLeft nonStringsBefore|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   726
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   727
    (aCollection isNil and:[list isNil]) ifTrue:[
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   728
        "no change"
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   729
        self scrollToTop.
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   730
        self scrollToLeft.
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   731
        ^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   732
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   733
    list := aCollection.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   734
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   735
    nonStringsBefore := includesNonStrings.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   736
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   737
152
claus
parents: 148
diff changeset
   738
    list notNil ifTrue:[
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   739
        expand ifTrue:[
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   740
            self expandTabs
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   741
        ] ifFalse:[
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   742
            scan ifTrue:[
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   743
                includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   744
            ] ifFalse:[
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   745
                includesNonStrings := nonStrings
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   746
            ]
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   747
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   748
    ].
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   749
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[self getFontParameters].
152
claus
parents: 148
diff changeset
   750
125
claus
parents: 121
diff changeset
   751
    widthOfWidestLine := nil.   "/ i.e. unknown
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   752
    oldFirst := firstLineShown.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   753
    oldLeft := leftOffset.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   754
    firstLineShown := 1.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   755
    leftOffset := 0.
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   756
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   757
    realized ifTrue:[
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   758
        self computeNumberOfLinesShown.
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   759
        self contentsChanged.
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   760
        "
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   761
         dont use scroll here to avoid the redraw
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   762
        "
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   763
        oldFirst ~~ firstLineShown ifTrue:[
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   764
            self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   765
        ].
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   766
        shown ifTrue:[
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   767
            self redrawFromVisibleLine:1 to:nLinesShown
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   768
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   769
    ]
153
claus
parents: 152
diff changeset
   770
claus
parents: 152
diff changeset
   771
    "Modified: 30.8.1995 / 19:07:13 / claus"
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   772
    "Modified: 5.6.1997 / 11:09:56 / cg"
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   773
    "Created: 5.6.1997 / 12:40:06 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   774
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   775
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   776
removeIndex:lineNr
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   777
    "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
   778
1452
d4c481299b88 fix bitBlt-copying of margin when removing a line.
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   779
    |visLine w h x y2
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   780
     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
   781
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   782
    (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
   783
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   784
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   785
     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
   786
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   787
    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
   788
    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
   789
    visLine notNil ifTrue:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   790
        w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
1433
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   791
"/        x := textStartLeft.
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   792
"/ CLAUS fixes leftOver selection pixels
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   793
        w := w + leftMargin.
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   794
        x := margin.
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   795
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   796
        srcY := topMargin + (visLine * fontHeight).
1452
d4c481299b88 fix bitBlt-copying of margin when removing a line.
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   797
        h := ((nLinesShown - visLine) * fontHeight).
d4c481299b88 fix bitBlt-copying of margin when removing a line.
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   798
        y2 := srcY + h.
d4c481299b88 fix bitBlt-copying of margin when removing a line.
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   799
        y2 >= (height - margin) ifTrue:[
d4c481299b88 fix bitBlt-copying of margin when removing a line.
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   800
            h := (height - margin - ((nLinesShown - visLine) * fontHeight)).
d4c481299b88 fix bitBlt-copying of margin when removing a line.
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   801
        ].
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   802
        self catchExpose.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   803
        self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   804
            copyFrom:self 
1433
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   805
            x:x y:srcY
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   806
            toX:x y:(srcY - fontHeight)
1452
d4c481299b88 fix bitBlt-copying of margin when removing a line.
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
   807
            width:w height:h
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   808
            async:true.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   809
        self redrawVisibleLine:nFullLinesShown.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   810
        "
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   811
         redraw last partial line - if any
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   812
        "
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   813
        (nFullLinesShown ~~ nLinesShown) ifTrue:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   814
            self redrawVisibleLine:nLinesShown
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   815
        ].
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   816
        self waitForExpose
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   817
    ]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   818
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
   819
    "Modified: 29.1.1997 / 13:05:50 / 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
   820
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   821
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   822
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
   823
    "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
   824
     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
   825
     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
   826
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   827
    (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
   828
    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
   829
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   830
    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
   831
	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
   832
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   833
    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
   834
    ^ 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
   835
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   836
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   837
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
   838
    "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
   839
     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
   840
     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
   841
     (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
   842
     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
   843
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   844
    |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
   845
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   846
    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
   847
    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
   848
    l notNil ifTrue:[
288
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   849
	l isString ifTrue:[
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   850
	    l := l asStringCollection
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   851
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   852
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   853
    self setList:l.
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   854
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   855
    "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
   856
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   857
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   858
setList:aCollection
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   859
    "set the contents (a collection of strings);
153
claus
parents: 152
diff changeset
   860
     do not change position (i.e. do not scroll).
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   861
     This can be used to update a self-changing list 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   862
     (for example: a file list being shown, without disturbing user too much)"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   863
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   864
    ^ self setList:aCollection expandTabs:true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   865
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   866
153
claus
parents: 152
diff changeset
   867
setList:aCollection expandTabs:expandTabs
claus
parents: 152
diff changeset
   868
    "set the contents (a collection of strings);
claus
parents: 152
diff changeset
   869
     do not change position (i.e. do not scroll).
claus
parents: 152
diff changeset
   870
     This can be used to update a self-changing list 
claus
parents: 152
diff changeset
   871
     (for example: a file list being shown, without disturbing the user too much)"
claus
parents: 152
diff changeset
   872
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   873
    |oldFirst nonStringsBefore linesShownBefore|
153
claus
parents: 152
diff changeset
   874
claus
parents: 152
diff changeset
   875
    (aCollection isNil and:[list isNil]) ifTrue:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   876
        "no change"
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   877
        ^ self
153
claus
parents: 152
diff changeset
   878
    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   879
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   880
"/    list isNil ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   881
"/        linesShownBefore := (1 to:nLinesShown) collect:[:i | ''].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   882
"/    ] ifFalse:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   883
"/        linesShownBefore := (firstLineShown to:(firstLineShown+nLinesShown-1))
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   884
"/                            collect:[:i | (self at:i) ? ''].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   885
"/    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   886
153
claus
parents: 152
diff changeset
   887
    list := aCollection.
claus
parents: 152
diff changeset
   888
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   889
    nonStringsBefore := includesNonStrings.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   890
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   891
153
claus
parents: 152
diff changeset
   892
    list notNil ifTrue:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   893
        expandTabs ifTrue:[
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   894
            self expandTabs
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   895
        ] ifFalse:[
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   896
            includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   897
        ].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   898
    ].
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   899
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[self getFontParameters].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   900
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   901
"/ 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
   902
    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
   903
    innerWidth >= self widthOfContents ifTrue:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   904
        leftOffset := 0.
153
claus
parents: 152
diff changeset
   905
    ].
claus
parents: 152
diff changeset
   906
    self contentsChanged.
claus
parents: 152
diff changeset
   907
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   908
"/ new - reposition vertically if too big
153
claus
parents: 152
diff changeset
   909
    (firstLineShown + nFullLinesShown) > self size ifTrue:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   910
        oldFirst := firstLineShown.
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   911
        firstLineShown := self size - nFullLinesShown + 1.
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   912
        firstLineShown < 1 ifTrue:[firstLineShown := 1].
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   913
        self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   914
        linesShownBefore := nil.
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   915
        shown ifTrue:[
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   916
            self clear.
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   917
        ]
153
claus
parents: 152
diff changeset
   918
    ].
claus
parents: 152
diff changeset
   919
"/ end new
claus
parents: 152
diff changeset
   920
    shown ifTrue:[
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   921
          self redrawFromVisibleLine:1 to:nLinesShown
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   922
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   923
"/        linesShownBefore isNil ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   924
"/            self redrawFromVisibleLine:1 to:nLinesShown
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   925
"/        ] ifFalse:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   926
"/            1 to:nLinesShown do:[:l |
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   927
"/                |oldLine newLine|
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   928
"/
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   929
"/                newLine := self visibleAt:l.
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   930
"/                newLine size == 0 ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   931
"/                    newLine := ''
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   932
"/                ].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   933
"/                oldLine := linesShownBefore at:l ifAbsent:nil.
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   934
"/                oldLine size == 0 ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   935
"/                    oldLine := ''
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   936
"/                ].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   937
"/                oldLine ~= newLine ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   938
"/                    self redrawVisibleLine:l
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   939
"/                ]
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   940
"/            ]
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   941
"/        ]
153
claus
parents: 152
diff changeset
   942
    ]
claus
parents: 152
diff changeset
   943
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   944
    "Modified: 18.12.1995 / 23:27:54 / stefan"
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   945
    "Modified: 6.3.1997 / 15:23:37 / cg"
153
claus
parents: 152
diff changeset
   946
!
claus
parents: 152
diff changeset
   947
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   948
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
   949
    "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
   950
     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
   951
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   952
    ^ list size.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   953
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   954
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   955
stringAtLine:lineNr from:col1 to:col2
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   956
    "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
   957
     including col2. 
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   958
     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
   959
     Fills the string with space characters at the right.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   960
     (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
   961
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   962
    |line len s|
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   963
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   964
    len := col2 - col1 + 1.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   965
    list notNil ifTrue:[
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   966
        line := self listAt:lineNr.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   967
        line notNil ifTrue:[
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   968
            (line size >= col1) ifTrue:[
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   969
                s := line copyFrom:col1.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   970
                s size < len ifTrue:[
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   971
                    ^ s paddedTo:len
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   972
                ].
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   973
                ^ s copyTo:len
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   974
            ]
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   975
        ]
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   976
    ].
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   977
    ^ String new:len withAll:Character space
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   978
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   979
    "Created: 7.1.1997 / 19:58:43 / cg"
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   980
!
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   981
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   982
withoutRedrawAt:index put: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
   983
    "change a line without 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
   984
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   985
    |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
   986
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   987
    self checkForExistingLine: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
   988
    list at:index put:aString.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   989
    includesNonStrings ifFalse:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   990
        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
   991
    ] ifTrue:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   992
        (aString isNil or:[aString isString]) ifTrue:[
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   993
            includesNonStrings := (list findFirst:[:l | l notNil and:[l isString not]]) ~~ 0.
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   994
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   995
    ].
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   996
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   997
    widthOfWidestLine notNil ifTrue:[
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   998
        aString isString ifTrue:[
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   999
            w := font widthOf:aString
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1000
        ] ifFalse:[
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1001
            w := aString widthOn:self
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1002
        ].
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1003
        w > widthOfWidestLine ifTrue:[
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1004
            widthOfWidestLine := w
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1005
        ] ifFalse:[
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1006
            widthOfWidestLine := nil "/ means: unknown
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1007
        ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1008
    ]
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1009
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1010
    "Modified: 22.10.1996 / 23:19:29 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1011
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1012
118
claus
parents: 116
diff changeset
  1013
!ListView methodsFor:'accessing-mvc'!
claus
parents: 116
diff changeset
  1014
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1015
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
  1016
    "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
  1017
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1018
    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
  1019
    aDictionary at:#listMessage put:listMsg
118
claus
parents: 116
diff changeset
  1020
!
claus
parents: 116
diff changeset
  1021
125
claus
parents: 121
diff changeset
  1022
listMessage 
claus
parents: 121
diff changeset
  1023
    "return the listMsg selector; 
claus
parents: 121
diff changeset
  1024
     if non-nil, this is the message sent to the model (if any) to aquire
claus
parents: 121
diff changeset
  1025
     a new text upon change of the aspect.
120
claus
parents: 118
diff changeset
  1026
     This defaults to the aspect-selector."
118
claus
parents: 116
diff changeset
  1027
125
claus
parents: 121
diff changeset
  1028
    ^ listMsg
claus
parents: 121
diff changeset
  1029
!
claus
parents: 121
diff changeset
  1030
claus
parents: 121
diff changeset
  1031
listMessage:aSymbol 
claus
parents: 121
diff changeset
  1032
    "ST-80 compatibility: set the listMsg selector; 
claus
parents: 121
diff changeset
  1033
     if non-nil, this will be sent to the model (if any) to aquire a 
claus
parents: 121
diff changeset
  1034
     new text upon change of the aspect.
claus
parents: 121
diff changeset
  1035
     This defaults to the aspect-selector."
claus
parents: 121
diff changeset
  1036
claus
parents: 121
diff changeset
  1037
    listMsg := aSymbol.
120
claus
parents: 118
diff changeset
  1038
!
claus
parents: 118
diff changeset
  1039
907
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1040
model:aModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1041
    "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
  1042
     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
  1043
     changes."
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1044
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1045
    super model:aModel.
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1046
    self getListFromModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1047
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1048
    "Created: 31.12.1996 / 14:56:43 / stefan"
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1049
!
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1050
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1051
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
  1052
    "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
  1053
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1054
    ^ self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:nil 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1055
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
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
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
  1058
    "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
  1059
75b8fb924904 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
    ^self on:aModel aspect:aspectSymbol change:changeSymbol list:aspectSymbol menu:nil 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1061
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1062
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1063
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
  1064
    "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
  1065
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1066
    aspectSymbol notNil ifTrue:[aspectMsg := aspectSymbol. 
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1067
                             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
  1068
    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
  1069
    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
  1070
    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
  1071
    self model:aModel.
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1072
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1073
    "Modified: 2.1.1997 / 16:11:16 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1074
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1075
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1076
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
  1077
    "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
  1078
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1079
    ^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1080
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1081
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1082
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
  1083
    "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
  1084
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1085
    ^ self on:aModel aspect:aspectSymbol change:nil list:listSymbol menu:menuSymbol 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1086
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1087
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1088
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
  1089
    "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
  1090
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1091
    ^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
  1092
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1093
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1094
!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
  1095
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1096
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
  1097
    changedObject == model ifTrue:[
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1098
        (aspectMsg notNil
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1099
        and:[something == aspectMsg]) ifTrue:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1100
            ^ self getListFromModel.
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1101
        ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1102
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1103
        something == #size ifTrue:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1104
            ^ self getListFromModelScroll:false.
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1105
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1106
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1107
    ^ 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
  1108
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1109
    "Modified: 5.3.1997 / 16:14:01 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1110
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1111
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1112
!ListView methodsFor:'drawing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1113
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1114
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1115
    "draw a visible line range in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1116
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1117
    |y         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1118
     x         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1119
     startLine "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1120
     endLine   "{ Class: SmallInteger }"
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1121
     listSize e sH|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1122
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1123
    y := self yOfVisibleLine:startVisLineNr.
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1124
    sH := lineSpacing // 2.
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1125
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1126
    self paint:bg.
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1127
    self fillRectangleX:margin 
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1128
		      y:y-sH
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1129
		  width:(width - (margin * 2))
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1130
		 height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1131
    list isNil ifTrue:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1132
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1133
    y := y + fontAscent.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1134
    listSize := self size.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1135
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1136
    startLine := startVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1137
    endLine := endVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1138
    (startLine == 0) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1139
	y := y + fontHeight.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1140
	startLine := startLine + 1
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1141
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1142
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1143
    (endLine > listSize) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1144
	e := listSize
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1145
    ] ifFalse:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1146
	e := endLine
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1147
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1148
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1149
    (startLine <= e) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1150
	x := textStartLeft - leftOffset.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1151
	self paint:fg on:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1152
	self from:startLine to:e do:[:line |
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1153
	    line notNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1154
		self displayOpaqueString:line x:x y:y
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1155
	    ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1156
	    y := y + fontHeight
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1157
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1158
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1159
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1160
    "Modified: 24.2.1996 / 16:41:48 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1161
!
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1162
131
claus
parents: 128
diff changeset
  1163
drawLine:line atX:x inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1164
    "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
  1165
     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
  1166
     Low level entry; not meant for public use."
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1167
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1168
    |y|
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1169
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1170
    y := self yOfVisibleLine:visLineNr.
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1171
    self paint:bg.
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1172
    self fillRectangleX:margin y:y - (lineSpacing//2)
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1173
		  width:(width - (2 * margin)) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1174
		 height:fontHeight.
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1175
    line notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1176
	self paint:fg on:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1177
	self displayOpaqueString:line x:x y:(y + fontAscent)
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1178
    ]
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1179
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1180
    "Modified: 28.2.1996 / 14:46:07 / cg"
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1181
!
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1182
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1183
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
  1184
    "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
  1185
     given x position in fg/bg. Clears partial line before drawing the string.
131
claus
parents: 128
diff changeset
  1186
     Low level entry; not meant for public use."
claus
parents: 128
diff changeset
  1187
claus
parents: 128
diff changeset
  1188
    |y|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1189
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1190
    y := self yOfVisibleLine:visLineNr.
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1191
"/    self paint:bg.
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1192
"/    self fillRectangleX:x "margin" y:y - (lineSpacing//2)
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1193
"/                  width:(width - margin - x) 
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1194
"/                 height:fontHeight.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1195
    line notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1196
	self paint:fg on:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1197
	self displayOpaqueString:line x:x y:(y + fontAscent)
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1198
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1199
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1200
    "Modified: 28.2.1996 / 18:36:33 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1201
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1202
131
claus
parents: 128
diff changeset
  1203
drawLine:line inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1204
    "draw a given string at visible lines position in fg/bg"
claus
parents: 128
diff changeset
  1205
claus
parents: 128
diff changeset
  1206
    self drawLine:line atX:(textStartLeft - leftOffset) inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1207
!
claus
parents: 128
diff changeset
  1208
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1209
drawVisibleLine:visLineNr col:col with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1210
    "draw single character at col index of visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1211
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1212
    |y yf x lineString characterString|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1213
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1214
    lineString := self visibleAt:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1215
    x := (self xOfCol:col inVisibleLine:visLineNr) - leftOffset.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1216
    y := self yOfVisibleLine:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1217
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1218
    self paint:bg.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1219
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1220
    (lineString notNil and:[lineString isString not])
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1221
    ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1222
	self drawVisibleLine:visLineNr with:fg and:bg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1223
    ] ifFalse:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1224
	yf := y - (lineSpacing//2).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1225
	col > lineString size ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1226
	    self fillRectangleX:x y:yf width:(font width) height:fontHeight.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1227
	    self paint:fg
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1228
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1229
	    characterString := lineString copyFrom:col to:col.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1230
	    self fillRectangleX:x y:yf 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1231
			  width:(font widthOf:characterString)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1232
			 height:fontHeight.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1233
	    self paint:fg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1234
	    self displayString:characterString x:x y:(y + fontAscent)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1235
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1236
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1237
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1238
    "Modified: 12.5.1996 / 12:47:07 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1239
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1240
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1241
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1242
    "draw part of a visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1243
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  1244
    |y yf x lineString len characterString w|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1245
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1246
    (endCol >= startCol) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1247
	lineString := self visibleAt:visLineNr.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1248
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1249
	(lineString notNil and:[lineString isString not])
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1250
	ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1251
	    self drawVisibleLine:visLineNr with:fg and:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1252
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1253
	    x := (self xOfCol:startCol inVisibleLine:visLineNr) - leftOffset.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1254
	    y := (self yOfVisibleLine:visLineNr).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1255
	    yf := y - (lineSpacing // 2).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1256
	    len := lineString size.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1257
	    (startCol > len) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1258
		len := endCol - startCol + 1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1259
		self paint:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1260
		self fillRectangleX:x y:yf 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1261
			      width:(fontWidth * len) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1262
			     height:fontHeight
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1263
	    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1264
		(endCol > len) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1265
		    characterString := lineString species new:endCol.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1266
		    characterString replaceFrom:1 to:len with:lineString startingAt:1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1267
		    lineString := characterString
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1268
		].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1269
		self paint:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1270
		fontIsFixedWidth ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1271
		    w := (endCol - startCol + 1) * fontWidth
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1272
		] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1273
		    (lineString isMemberOf:String) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1274
			w := font widthOf:lineString from:startCol to:endCol
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1275
		    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1276
			w := (lineString copyFrom:startCol to:endCol) widthOn:self
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1277
		    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1278
		].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1279
		self fillRectangleX:x y:yf 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1280
			      width:w
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1281
			      height:fontHeight.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1282
		self paint:fg on:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1283
		self displayOpaqueString:lineString from:startCol to:endCol x:x y:(y + fontAscent)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1284
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1285
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1286
    ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1287
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  1288
    "Modified: 22.5.1996 / 15:52:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1289
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1290
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1291
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
  1292
    "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
  1293
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1294
    |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
  1295
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1296
    (startCol < 1) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1297
	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
  1298
    ] ifFalse:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1299
	index1 := startCol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1300
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1301
    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
  1302
    x := (self xOfCol:index1 inVisibleLine:visLineNr) - 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
  1303
    self paint: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
  1304
    self fillRectangleX:x y:y - (lineSpacing // 2)
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1305
		  width:(width + leftOffset - x)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1306
		 height: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
  1307
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1308
    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
  1309
    lineString notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1310
	lineString isString ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1311
	    self drawVisibleLine:visLineNr with:fg and:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1312
	] ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1313
	    index2 := lineString size.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1314
	    (index2 < index1) ifTrue:[^ self].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1315
	    (index1 <= index2) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1316
		self paint:fg on:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1317
		self displayOpaqueString:lineString from:index1 to:index2 x:x y:(y + fontAscent)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1318
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1319
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1320
    ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1321
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1322
    "Modified: 12.5.1996 / 12:47:49 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1323
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1324
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1325
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
  1326
    "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
  1327
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1328
    self 
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1329
	drawLine:(self visibleAt:visLineNr) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1330
	atX:(textStartLeft - leftOffset) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1331
	inVisible:visLineNr 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1332
	with:fg 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1333
	and:bg
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1334
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1335
    "Modified: 28.2.1996 / 19:30:23 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1336
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1337
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1338
!ListView methodsFor:'event processing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1339
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1340
contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1341
    "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
  1342
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1343
    |listSize newOrigin|
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1344
890
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1345
    shown ifTrue:[
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1346
        list notNil ifTrue:[
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1347
            listSize := self numberOfLines.
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1348
990
c466fa72c6e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1349
            listSize == 0 ifTrue:[
c466fa72c6e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1350
                widthOfWidestLine := 0.
c466fa72c6e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1351
            ].
c466fa72c6e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1352
        
890
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1353
            "
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1354
             if we are beyond the end, scroll up a bit
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1355
            "
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1356
            ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1357
                newOrigin := listSize - nFullLinesShown + 1.
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1358
                newOrigin < 1 ifTrue:[
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1359
                    newOrigin := 1
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1360
                ].
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1361
                self scrollToLine: newOrigin.
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1362
            ].
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1363
        ].
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1364
    ].
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1365
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1366
    ^ super contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1367
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1368
    "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
  1369
    "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
  1370
!
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1371
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1372
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
  1373
    "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
  1374
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1375
    <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
  1376
			  #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
  1377
			  #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
  1378
    |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
  1379
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1380
    (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
  1381
    (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
  1382
    (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
  1383
    (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
  1384
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1385
    (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
  1386
    (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
  1387
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1388
    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
  1389
    (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
  1390
	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
  1391
	    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
  1392
	] 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
  1393
	    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
  1394
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1395
	^ 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
  1396
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1397
    (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
  1398
	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
  1399
	    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
  1400
	] 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
  1401
	    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
  1402
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1403
	^ 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
  1404
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1405
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1406
    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
  1407
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1408
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1409
redrawX:x y:y width:w height:h
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1410
    "a region must be redrawn"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1411
1425
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1412
    |startLine stopLine startCol endCol line|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1413
127
claus
parents: 125
diff changeset
  1414
    shown ifFalse:[^ self].
claus
parents: 125
diff changeset
  1415
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1416
    startLine := self visibleLineOfY:y.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1417
    stopLine := self visibleLineOfY:(y + h).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1418
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1419
    "if text-margin is affected"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1420
    x < textStartLeft ifTrue:[
1425
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1421
        self paint:bgColor.
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1422
        self fillRectangleX:margin y:margin width:(textStartLeft - margin)
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1423
                                           height:(height - margin - margin)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1424
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1425
    y < textStartTop ifTrue:[
1425
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1426
        self paint:bgColor.
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1427
        self fillRectangleX:margin y:margin width:(width - margin - margin)
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1428
                                           height:(textStartTop - margin)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1429
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1430
    (w > (width // 4 * 3)) ifTrue:[
1425
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1431
        "if area is big enough redraw whole lines"
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1432
        self redrawFromVisibleLine:startLine to:stopLine
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1433
    ] ifFalse:[
1425
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1434
        includesNonStrings ifTrue:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1435
            startLine to:stopLine do:[:i |
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1436
                self redrawVisibleLine:i
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1437
            ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1438
        ] ifFalse:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1439
            line := self visibleAt:startLine.
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1440
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1441
            (fontIsFixedWidth 
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1442
            and:[line notNil
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1443
            and:[line isMemberOf:String]]) ifFalse:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1444
                "start/end col has to be computed for each line"
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1445
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1446
                startLine to:stopLine do:[:i |
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1447
                    startCol := self colOfX:x inVisibleLine:i.
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1448
                    endCol := self colOfX:(x + w) inVisibleLine:i.
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1449
                    startCol > 0 ifTrue:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1450
                        endCol > 0 ifTrue:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1451
                            self redrawVisibleLine:i from:startCol to:endCol
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1452
                        ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1453
                    ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1454
                ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1455
            ] ifTrue:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1456
                "start/end col is the same for all lines"
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1457
                startCol := self colOfX:x inVisibleLine:startLine.
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1458
                endCol := self colOfX:(x + w) inVisibleLine:startLine.
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1459
                startCol > 0 ifTrue:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1460
                    endCol > 0 ifTrue:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1461
                        startLine to:stopLine do:[:i |
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1462
                            line := self visibleAt:i.
1450
4ae9757ed852 bug fix:
ca
parents: 1448
diff changeset
  1463
                            (line isMemberOf:String) ifTrue:[
1425
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1464
                                self redrawVisibleLine:i from:startCol to:endCol
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1465
                            ] ifFalse:[
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1466
                                self redrawVisibleLine:i
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1467
                            ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1468
                        ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1469
                    ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1470
                ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1471
            ]
31c50dd004b5 do not draw using fromCol:toCol:, if there is a chance
Claus Gittinger <cg@exept.de>
parents: 1354
diff changeset
  1472
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1473
    ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1474
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1475
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1476
sizeChanged:how
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1477
    "size changed - move origin up if possible"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1478
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1479
    |listSize newOrigin|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1480
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1481
    super sizeChanged:how.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
  1482
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1483
    self computeNumberOfLinesShown.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1484
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1485
    innerWidth := width - textStartLeft - margin.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1486
    shown ifFalse:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1487
    list isNil ifTrue:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1488
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1489
"/    how ~~ #smaller ifTrue:[
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1490
"/        self invalidate 
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1491
"/    ].
643
89c06c80ff2a redraw in sizeChange
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
  1492
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1493
    listSize := self numberOfLines.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1494
    "
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1495
     if we are beyond the end, scroll up a bit
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1496
    "
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1497
    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1498
        newOrigin := listSize - nFullLinesShown + 1.
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1499
        newOrigin < 1 ifTrue:[
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1500
            newOrigin := 1
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1501
        ].
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1502
        self scrollToLine: newOrigin.
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1503
        ^ self
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1504
    ].
643
89c06c80ff2a redraw in sizeChange
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
  1505
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1506
    "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
  1507
    "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
  1508
! !
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1510
!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
  1511
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1512
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
  1513
    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
  1514
75b8fb924904 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
    "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
  1516
    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
  1517
    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
  1518
    fgColor := fgColor on:device.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1519
    bgColor := bgColor on:device
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1520
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1521
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1522
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
  1523
    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
  1524
    ^ 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
  1525
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1526
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1527
fetchDeviceResources
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1528
    "fetch device colors, to avoid reallocation at redraw time"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1529
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1530
    super fetchDeviceResources.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1531
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1532
    fgColor notNil ifTrue:[fgColor := fgColor on:device].
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1533
    bgColor notNil ifTrue:[bgColor := bgColor on:device].
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1534
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1535
    "Created: 14.1.1997 / 00:12:12 / cg"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1536
!
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1537
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1538
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1539
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1540
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1541
    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
  1542
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1543
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device]
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1544
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1545
    self topMargin:(self verticalPixelPerMillimeter:0.5) rounded.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1546
    self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1547
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1548
    lineSpacing := 0.
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1549
    fgColor := DefaultForegroundColor.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1550
    bgColor := DefaultBackgroundColor.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1551
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1552
    "Modified: 22.1.1997 / 11:57: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
  1553
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1554
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1555
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
  1556
    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
  1557
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1558
    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
  1559
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1560
    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
  1561
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1562
    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
  1563
    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
  1564
    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
  1565
    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
  1566
    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
  1567
    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
  1568
    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
  1569
    tabPositions := DefaultTabPositions.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1570
    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
  1571
    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
  1572
    wordCheck := [:char | char isNationalAlphaNumeric].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1573
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1574
    autoScroll := true.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1575
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1576
    "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
  1577
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1578
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1579
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
  1580
    |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
  1581
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1582
    extentChanged ifTrue:[
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1583
        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
  1584
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1585
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1586
    firstLineShown ~~ 1 ifTrue:[
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1587
        sz := self size.
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1588
        firstLineShown + nLinesShown > sz ifTrue:[
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1589
            self scrollToLine:sz - nLinesShown.
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1590
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1591
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1592
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1593
    super realize.
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1594
1081
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1595
"/ old: fetch models value on realize;
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1596
"/ 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
  1597
"/
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1598
"/    model notNil ifTrue:[
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1599
"/        self getListFromModel.
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1600
"/    ]
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1601
825
d115a0923b7d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 820
diff changeset
  1602
    "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
  1603
    "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
  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
75b8fb924904 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
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
  1607
    "recreate after a snapin"
75b8fb924904 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
75b8fb924904 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
    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
  1610
75b8fb924904 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
    "
75b8fb924904 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
     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
  1613
     - 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
  1614
    "
75b8fb924904 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
    topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
75b8fb924904 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
    self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
75b8fb924904 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
    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
  1618
! !
75b8fb924904 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
!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
  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
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
  1623
    "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
  1624
75b8fb924904 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
    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
  1626
    (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
  1627
    (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
  1628
    ^ 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
  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
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
  1632
    "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
  1633
     - 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
  1634
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1635
    |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
  1636
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1637
    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
  1638
    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
  1639
    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
  1640
	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
  1641
	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
  1642
	    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
  1643
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1644
	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
  1645
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1646
    ^ 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
  1647
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1648
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1649
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1650
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
  1651
    "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
  1652
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1653
    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
  1654
	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
  1655
	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
  1656
    ] 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
  1657
	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
  1658
	    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
  1659
	    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
  1660
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1661
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1662
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1663
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1664
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
  1665
    "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
  1666
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1667
    |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
  1668
     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
  1669
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1670
    xRel := x - textStartLeft + leftOffset.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1671
    (xRel <= 0) ifTrue:[^ 1].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1672
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1673
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1674
     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
  1675
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1676
    fontIsFixedWidth ifTrue:[
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1677
        ^ (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
  1678
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1679
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1680
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1681
     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
  1682
    "
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1683
    lineString := self visibleAt:visLineNr.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1684
    lineString notNil ifTrue:[
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1685
        lineString := lineString asString.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1686
        (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1687
            linePixelWidth := lineString widthOn:self
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1688
        ] ifFalse:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1689
            linePixelWidth := font widthOf:lineString
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1690
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1691
    ] ifFalse:[
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1692
        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
  1693
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1694
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1695
    (linePixelWidth <= xRel) ifTrue:[
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1696
        fontWidth == 0 ifTrue:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1697
            "
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1698
             although this 'cannot happen',
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1699
             it seems that X reports this width for some strange fonts ...
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1700
            "
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1701
            ^ lineString size   
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1702
        ].
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1703
        ^ 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
  1704
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1705
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1706
    "/ cannot simply count individual characters,
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1707
    "/ 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
  1708
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1709
    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
  1710
    (runCol == 0) ifTrue:[runCol := 1].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1711
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1712
    hasEmphasis ifTrue:[
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1713
        posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1714
        posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1715
    ] ifFalse:[    
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1716
        posLeft := font widthOf:lineString from:1 to:(runCol - 1).
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1717
        posRight := font widthOf:lineString from:1 to:runCol.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1718
    ].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1719
249
75b8fb924904 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
    done := (posLeft <= xRel) and:[posRight > xRel].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1721
249
75b8fb924904 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
    [done] whileFalse:[
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1723
        oPosRight := posRight.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1724
        oPosLeft := posLeft.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1725
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1726
        (posRight <= xRel) ifTrue:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1727
            runCol := runCol + 1.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1728
            posLeft := posRight.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1729
            hasEmphasis ifTrue:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1730
                posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1731
            ] ifFalse:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1732
                posRight := font widthOf:lineString from:1 to:runCol
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1733
            ]
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1734
        ] ifFalse:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1735
            (posLeft > xRel) ifTrue:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1736
                runCol := runCol - 1.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1737
                (runCol == 0) ifTrue:[^ 0].
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1738
                posRight := posLeft.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1739
                hasEmphasis ifTrue:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1740
                    posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1741
                ] ifFalse:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1742
                    posLeft := font widthOf:lineString from:1 to:(runCol - 1)
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1743
                ]
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1744
            ]
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1745
        ].
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1746
        done := (posLeft <= xRel) and:[posRight > xRel].
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1747
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1748
        ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1749
            "/ paranoia: just in case there are unprintable characters
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1750
            "/ (avoid endless loop if the binary search does not make progress)
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1751
            done := true.
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1752
         ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1753
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
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
    ^ runCol
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1756
1259
aba6a9deab8d break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  1757
    "Modified: 2.7.1997 / 14:54: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
  1758
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1759
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1760
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
  1761
    "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
  1762
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1763
    |innerHeight|
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1764
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1765
    innerHeight := self innerHeight.
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1766
    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
  1767
    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
  1768
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1769
    partialLines ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1770
	((nLinesShown * fontHeight) < innerHeight) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1771
	    nLinesShown := nLinesShown + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1772
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1773
    ]
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1774
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1775
    "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
  1776
!
75b8fb924904 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
75b8fb924904 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
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
  1779
    "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
  1780
     - 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
  1781
75b8fb924904 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
    |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
  1783
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1784
    self obsoleteMethodWarning.
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1785
249
75b8fb924904 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
    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
  1787
    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
  1788
75b8fb924904 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
    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
  1790
    aList do:[:line |
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1791
	((line size == 0) or:[line isBlank]) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1792
	    newList add:newLine.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1793
	    newLine := ''
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1794
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1795
	    special := ((line at:1) == ${) or:[(line includes:$\)].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1796
	    special := special or:[(line at:1) == $}].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1797
	    special ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1798
		newList add:(newLine , line)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1799
	    ] ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1800
		charIndex := 1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1801
		[charIndex <= line size] whileTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1802
		    char := line at:charIndex.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1803
		    ((char == ${ ) or:[char == $} ]) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1804
			"left-brace: ignore rest of line"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1805
			charIndex := line size + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1806
		    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1807
			(char == $\) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1808
			    inEscape := true
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1809
			] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1810
			    inEscape ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1811
				(char == Character space) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1812
				    inEscape := false
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1813
				]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1814
			    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1815
				newLine := newLine copyWith:char
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1816
			    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1817
			].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1818
			charIndex := charIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1819
		    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1820
		]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1821
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1822
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1823
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1824
    ^ newList
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1825
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1826
    "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
  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
75b8fb924904 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
getFontParameters
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  1830
    "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
  1831
     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
  1832
     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
  1833
     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
  1834
     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
  1835
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1836
    |hMax|
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1837
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1838
    font := font on:device.
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1839
    hMax := font height.
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1840
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1841
    includesNonStrings == true ifTrue:[
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1842
        "/
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1843
        "/ find maximum height of lines
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1844
        "/
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1845
        hMax := list inject:hMax into:[:maxSoFar :thisLine | 
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1846
                                        thisLine isNil ifTrue:[
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1847
                                            maxSoFar
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1848
                                        ] ifFalse:[
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1849
                                            (thisLine isMemberOf:String) ifTrue:[
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1850
                                                maxSoFar
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1851
                                            ] ifFalse:[   
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1852
                                                maxSoFar max:(thisLine heightOn:self)
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1853
                                            ]
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1854
                                        ]
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1855
                              ].
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1856
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1857
    ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1858
    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
  1859
    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
  1860
    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
  1861
    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
  1862
1260
5a548d4c6724 handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
  1863
    "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
  1864
!
75b8fb924904 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
75b8fb924904 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
getListFromModel
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1867
    "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
  1868
     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
  1869
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1870
    |text msg|
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1871
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1872
    model notNil ifTrue:[
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1873
        msg := listMsg.
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1874
        msg isNil ifTrue:[
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1875
            msg := aspectMsg
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1876
        ].
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1877
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1878
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1879
        msg notNil ifTrue:[
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1880
            text := model perform:msg.
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1881
            text notNil ifTrue:[
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1882
                text := text asStringCollection.
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1883
            ].
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1884
"/ 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
  1885
"/ as the view!!
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1886
"/            text ~= list ifTrue:[
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1887
                self list:text
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1888
"/            ].
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  1889
        ].
249
75b8fb924904 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
    ].
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1891
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1892
    "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
  1893
    "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
  1894
!
75b8fb924904 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
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1896
getListFromModelScroll:aBoolean
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1897
    "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
  1898
     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
  1899
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1900
    |text msg|
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1901
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1902
    model notNil ifTrue:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1903
        msg := listMsg.
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1904
        msg isNil ifTrue:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1905
            msg := aspectMsg
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1906
        ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1907
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1908
        msg notNil ifTrue:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1909
            text := model perform:msg.
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1910
            text notNil ifTrue:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1911
                text := text asStringCollection.
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1912
            ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1913
"/ 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
  1914
"/ as the view!!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1915
"/            text ~= list ifTrue:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1916
                aBoolean ifTrue:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1917
                    self list:text
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1918
                ] ifFalse:[
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1919
                    self setList:text
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1920
                ]
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1921
"/            ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1922
        ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1923
    ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1924
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1925
    "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
  1926
    "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
  1927
    "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
  1928
!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1929
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1930
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
  1931
    "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
  1932
     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
  1933
     - 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
  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
    |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
  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
    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
  1938
    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
  1939
    lastLine := 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
  1940
    [sum < charPos] 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
  1941
	(lineNr > lastLine) ifTrue:[^ 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
  1942
	sum := sum + (self at:lineNr) size + 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
  1943
	lineNr := 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
  1944
    ].
75b8fb924904 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
    ^ 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
  1946
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1948
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
  1949
    "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
  1950
     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
  1951
     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
  1952
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1953
    |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
  1954
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1955
    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
  1956
    (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
  1957
    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
  1958
    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
  1959
    ^ 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
  1960
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1961
    "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
  1962
!
75b8fb924904 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
75b8fb924904 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
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
  1965
    "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
  1966
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1967
    |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
  1968
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1969
    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
  1970
    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
  1971
    (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
  1972
    ^ 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
  1973
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1975
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
  1976
    "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
  1977
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1978
    |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
  1979
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1980
    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
  1981
    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
  1982
    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
  1983
    (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
  1984
    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
  1985
    (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
  1986
    ^ 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
  1987
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1988
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1989
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
  1990
    "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
  1991
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1992
    |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
  1993
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1994
    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
  1995
    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
  1996
    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
  1997
    (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
  1998
    ^ 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
  1999
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2000
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2001
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
  2002
    "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
  2003
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2004
    |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
  2005
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2006
    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
  2007
    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
  2008
    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
  2009
    (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
  2010
    ^ 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
  2011
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2013
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
  2014
    "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
  2015
     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
  2016
     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
  2017
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2018
    |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
  2019
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2020
    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
  2021
    (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
  2022
    (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
  2023
	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
  2024
    ] 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
  2025
	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
  2026
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2027
    (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
  2028
    ^ ''
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2029
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2031
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
  2032
    "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
  2033
     - 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
  2034
1448
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2035
    ^ (((y - textStartTop) // fontHeight) + 1) max:1
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2036
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2037
    "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
  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
75b8fb924904 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
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
  2041
    "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
  2042
75b8fb924904 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
    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
  2044
    ^ 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
  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
75b8fb924904 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
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
  2048
    "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
  2049
     (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
  2050
     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
  2051
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2052
    |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
  2053
     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
  2054
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2055
    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
  2056
    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
  2057
    (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
  2058
    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
  2059
    (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
  2060
    ^ 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
  2061
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2062
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2063
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
  2064
    "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
  2065
     - 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
  2066
     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
  2067
     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
  2068
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2069
    |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
  2070
957
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2071
    ^ innerWidth
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2072
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2073
"/    "for small width, its not worth searching for
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2074
"/     longest line ...
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2075
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2076
"/    (width < 300) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2077
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2078
"/    "for large lists, search may take longer than scrolling full
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2079
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2080
"/    self size > 2000 ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2081
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2082
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2083
"/     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
  2084
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2085
"/    (viewBackground isColor not
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2086
"/     or:[viewBackground isDithered]) ifTrue:[
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2087
"/        ^ width
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2088
"/    ].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2089
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2090
"/    w := self widthOfWidestLineBetween:firstLine and:lastLine.
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2091
"/    (w > innerWidth) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2092
"/    ^ w
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2093
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2094
    "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
  2095
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2096
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2097
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
  2098
    "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
  2099
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2100
    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
  2101
    entry isString ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2102
	^ 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
  2103
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2104
    ^ entry widthOn:self
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2105
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2106
    "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
  2107
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2108
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2109
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
  2110
    "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
  2111
     - 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
  2112
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2113
    |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
  2114
     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
  2115
     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
  2116
     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
  2117
     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
  2118
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2119
    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
  2120
	^ 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
  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
    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
  2124
	^ (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
  2125
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2126
    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
  2127
    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
  2128
    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
  2129
    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
  2130
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2131
    (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
  2132
    (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
  2133
	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
  2134
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2135
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2136
    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
  2137
	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
  2138
	    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
  2139
	    (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
  2140
		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
  2141
	    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2142
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2143
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2144
    ^ 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
  2145
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2146
75b8fb924904 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
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
  2148
    "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
  2149
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2150
    |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
  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
    tcol := 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
  2153
    fontIsFixedWidth ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2154
	^ (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
  2155
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2156
    line := 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
  2157
    line notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2158
	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
  2159
    ] ifFalse:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2160
	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
  2161
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2162
    (lineSize == 0) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2163
	^ (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
  2164
    ].
798
9ab00cb0d9d3 handle Text items in xOfCol...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  2165
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2166
    (lineSize < col) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2167
	^ (line widthOn:self) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2168
	  + (fontWidth * (tcol - lineSize)) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2169
	  + 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
  2170
    ].
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2171
    (line isMemberOf:String) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2172
	^ (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
  2173
    ].
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2174
    ^ ((line copyTo:tcol) widthOn:self) + textStartLeft
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2175
798
9ab00cb0d9d3 handle Text items in xOfCol...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  2176
    "Modified: 19.7.1996 / 20:38: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
  2177
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2178
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2179
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
  2180
    "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
  2181
     - 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
  2182
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2183
    ^ ((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
  2184
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2185
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2186
!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
  2187
75b8fb924904 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
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
  2189
    "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
  2190
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2191
    ^ 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
  2192
!
75b8fb924904 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
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2194
heightForLines:numberOfLines
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2195
    "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
  2196
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2197
    "need a device font for query"
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2198
    font := font on:device.
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2199
    ^ 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
  2200
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2201
    "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
  2202
!
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2203
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2204
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
  2205
    "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
  2206
     - 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
  2207
75b8fb924904 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
    | 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
  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
    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
  2211
    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
  2212
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2213
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2214
    "/ 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
  2215
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2216
"/    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
  2217
"/        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
  2218
"/    ].
75b8fb924904 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
    "
75b8fb924904 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
     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
  2221
    "
75b8fb924904 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
    font := font on:device.
75b8fb924904 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
    ^ 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
  2224
"/                            + 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
  2225
			    - (lineSpacing // 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
  2226
"/                            + (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
  2227
"/                            + (font descent * 2) "makes it look better"
75b8fb924904 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
75b8fb924904 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
"/    "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
  2231
"/    (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
  2232
"/        ^ 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
  2233
"/    ].
75b8fb924904 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
"/    "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
  2235
"/     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
  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
"/    ^ (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
  2238
!
75b8fb924904 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
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
  2241
    "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
  2242
75b8fb924904 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
    ^ 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
  2244
!
75b8fb924904 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
75b8fb924904 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
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
  2247
    "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
  2248
     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
  2249
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2250
    |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
  2251
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2252
    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
  2253
    lineString notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2254
	indent := lineString leftIndent.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2255
	indent == lineString size ifTrue:[^ 0].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2256
	^ 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
  2257
    ].
75b8fb924904 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
    ^ 0
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2259
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2260
    "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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2263
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
  2264
    "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
  2265
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2266
    ^ 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
  2267
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2268
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2269
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
  2270
    "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
  2271
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2272
    |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
  2273
     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
  2274
     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
  2275
     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
  2276
     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
  2277
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2278
    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
  2279
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2280
    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
  2281
    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
  2282
    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
  2283
    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
  2284
75b8fb924904 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
    (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
  2286
    (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
  2287
	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
  2288
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2289
    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
  2290
	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
  2291
	    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
  2292
	    (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
  2293
		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
  2294
	    ]
75b8fb924904 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
	]
75b8fb924904 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
    ^ 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
  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
!
75b8fb924904 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
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2301
lineIsFullyVisible:line
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2302
    "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
  2303
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2304
    (line >= firstLineShown
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2305
     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
  2306
    ^ false.
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2307
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2308
    "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
  2309
!
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2310
249
75b8fb924904 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
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
  2312
    "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
  2313
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2314
    (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
  2315
    ^ 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
  2316
!
75b8fb924904 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
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
  2319
    "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
  2320
75b8fb924904 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
    ^ 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
  2322
!
75b8fb924904 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
678
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2324
preferredExtentForLines:numLines cols:numCols
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2325
    ^ (((font widthOf:'x') * numCols + margin + margin) 
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2326
      @ 
688
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2327
      (fontHeight * numLines + margin + margin + font descent + lineSpacing + topMargin)).
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2328
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2329
    "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
  2330
!
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2331
249
75b8fb924904 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
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
  2333
    "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
  2334
     - 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
  2335
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2336
    |max f|
249
75b8fb924904 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
75b8fb924904 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
    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
  2339
    widthOfWidestLine notNil ifTrue:[^ widthOfWidestLine + (leftMargin * 2)].
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2340
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2341
    device isNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2342
	"/ mhmh - really dont know yet
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2343
	f := font on:Screen current
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2344
    ] ifFalse:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2345
	f := font := font on:device.
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2346
    ].
249
75b8fb924904 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
    includesNonStrings ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2349
	max := list 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2350
		   inject:0 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2351
		   into:[:maxSoFar :entry |
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2352
			     (
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2353
				 entry isNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2354
				     0
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2355
				 ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2356
				    entry isString ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2357
					f widthOf:entry
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2358
				    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2359
					entry widthOn:self
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2360
				    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2361
				 ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2362
			     ) max:maxSoFar.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2363
			]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2364
    ] ifFalse:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2365
	fontIsFixedWidth ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2366
	    max := self lengthOfLongestLine * fontWidth
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2367
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2368
	    max := 0.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2369
	    list notNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2370
		list do:[:line |
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2371
		    line notNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2372
			max := max max:(line widthOn:self)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2373
		    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2374
		].
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2375
"/                max := max max:(f widthOf:list)
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2376
	    ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2377
	].
249
75b8fb924904 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
    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
  2380
    ^ max + (leftMargin * 2)
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2381
776
007d1d3463cf use Screen current instead of Display
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  2382
    "Modified: 5.7.1996 / 13:54: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
  2383
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2384
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2385
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
  2386
    "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
  2387
     - 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
  2388
75b8fb924904 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
    ^ 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
  2390
!
75b8fb924904 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
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
  2393
    "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
  2394
     - 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
  2395
75b8fb924904 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
    ^ (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
  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
75b8fb924904 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
!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
  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
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
  2402
    "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
  2403
75b8fb924904 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
    self redrawInverted.
292
f46dea5bdd51 use new Delay wait
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
  2405
    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
  2406
    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
  2407
75b8fb924904 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
    "
75b8fb924904 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
     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
  2410
     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
  2411
     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
  2412
    "
75b8fb924904 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
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
  2416
    "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
  2417
75b8fb924904 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
    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
  2419
	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
  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
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
  2424
    "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
  2425
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2426
    |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
  2427
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2428
    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
  2429
	"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
  2430
	 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
  2431
	(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
  2432
	    first := firstLineShown
125
claus
parents: 121
diff changeset
  2433
	] 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
  2434
	    first := lineNr
125
claus
parents: 121
diff changeset
  2435
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2436
	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
  2437
	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
  2438
	    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
  2439
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2440
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2441
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2442
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2443
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
  2444
    "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
  2445
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2446
    |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
  2447
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2448
    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
  2449
	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
  2450
	(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
  2451
	    (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
  2452
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2453
		"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
  2454
		 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
  2455
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2456
		(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
  2457
		    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
  2458
		] 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
  2459
		    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
  2460
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2461
		(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
  2462
		    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
  2463
		] 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
  2464
		    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
  2465
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2466
		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
  2467
		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
  2468
		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
  2469
	    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2470
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2471
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2472
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2473
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2474
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
  2475
    "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
  2476
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2477
    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
  2478
	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
  2479
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2480
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2481
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2482
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
  2483
    "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
  2484
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2485
    |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
  2486
75b8fb924904 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
    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
  2488
    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
  2489
    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
  2490
    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
  2491
    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
  2492
    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
  2493
    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
  2494
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2495
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2496
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
  2497
    "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
  2498
75b8fb924904 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
    |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
  2500
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2501
    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
  2502
    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
  2503
	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
  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
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2506
75b8fb924904 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
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
  2508
    "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
  2509
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2510
    |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
  2511
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2512
    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
  2513
    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
  2514
	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
  2515
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2516
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2517
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2518
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
  2519
    "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
  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
    |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
  2522
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2523
    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
  2524
    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
  2525
	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
  2526
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2527
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2528
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2529
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
  2530
    "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
  2531
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2532
    |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
  2533
75b8fb924904 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
    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
  2535
    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
  2536
	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
  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
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2540
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
  2541
    "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
  2542
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2543
    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
  2544
	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
  2545
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2546
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2547
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2548
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
  2549
    "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
  2550
75b8fb924904 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
    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
  2552
	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
  2553
    ]
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2556
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
  2557
    "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
  2558
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2559
    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
  2560
	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
  2561
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2562
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2563
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2564
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
  2565
    "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
  2566
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2567
    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
  2568
	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
  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
! !
75b8fb924904 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
!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
  2573
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2574
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
  2575
    "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
  2576
     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
  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
    ^ 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
  2579
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2580
75b8fb924904 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
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
  2582
    "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
  2583
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2584
    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
  2585
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2586
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2587
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
  2588
    "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
  2589
75b8fb924904 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
    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
  2591
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2592
75b8fb924904 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
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
  2594
    "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
  2595
75b8fb924904 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
    |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
  2597
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2598
    (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
  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
    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
  2601
    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
  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
    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
  2604
    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
  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
    "
75b8fb924904 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
     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
  2608
     (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
  2609
    "
75b8fb924904 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
"/    ((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
  2611
"/        ^ 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
  2612
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2613
75b8fb924904 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
     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
  2616
     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
  2617
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2618
    (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
  2619
75b8fb924904 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
    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
  2621
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2622
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2623
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
  2624
    "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
  2625
     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
  2626
75b8fb924904 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
    |bott|
75b8fb924904 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
    (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
  2630
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2631
"/  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
  2632
"/      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
  2633
"/      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
  2634
"/
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2635
"/    shown ifFalse:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2636
"/        firstLineShown := (aListLineNr - 1) max:1.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2637
"/        firstLineShown > (list size - nFullLinesShown) ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2638
"/            firstLineShown := list size - nFullLinesShown
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2639
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2640
"/        list size <= nFullLinesShown ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2641
"/            firstLineShown := 1
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2642
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2643
"/        ^ self
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2644
"/    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2645
249
75b8fb924904 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
    (aListLineNr >= firstLineShown) ifTrue:[
883
84da1a010350 positioning fix
ca
parents: 864
diff changeset
  2647
        (aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
84da1a010350 positioning fix
ca
parents: 864
diff changeset
  2648
            ^ self
84da1a010350 positioning fix
ca
parents: 864
diff changeset
  2649
        ]
249
75b8fb924904 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
    ].
75b8fb924904 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
    (aListLineNr < nFullLinesShown) ifTrue:[
883
84da1a010350 positioning fix
ca
parents: 864
diff changeset
  2652
        ^ self scrollToLine: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
  2653
    ].
75b8fb924904 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
    (nFullLinesShown < 3) ifTrue:[
883
84da1a010350 positioning fix
ca
parents: 864
diff changeset
  2655
        ^ self scrollToLine:aListLineNr
249
75b8fb924904 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
    ].
75b8fb924904 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
    bott := self numberOfLines - (nFullLinesShown - 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
  2658
    (aListLineNr > bott) ifTrue:[
883
84da1a010350 positioning fix
ca
parents: 864
diff changeset
  2659
        ^ self scrollToLine:bott
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2660
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2661
    self scrollToLine:(aListLineNr - (nFullLinesShown // 2) + 1)
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2662
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2663
    "Modified: 26.5.1996 / 16:00:32 / cg"
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2664
    "Modified: 18.12.1996 / 17:48:22 / 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
  2665
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2666
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2667
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
  2668
    "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
  2669
     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
  2670
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2671
    |line index list|
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2672
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2673
    (list := self list) notNil ifTrue:[
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2674
        index := list indexOf:someString.
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2675
        index ~~ 0 ifTrue:[
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2676
            self makeLineVisible:index
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2677
        ]
249
75b8fb924904 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
    ]
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2679
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2680
    "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
  2681
!
75b8fb924904 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
75b8fb924904 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
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
  2684
    "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
  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
    |nLines|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2687
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2688
    nLines := 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
  2689
    (firstLineShown + nLines + nFullLinesShown > self size) ifTrue:[
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2690
        nLines := self size - firstLineShown - nFullLinesShown + 1
125
claus
parents: 121
diff changeset
  2691
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2692
    nLines <= 0 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
  2693
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2694
    self originWillChange.
75b8fb924904 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
    firstLineShown := firstLineShown + nLines.
663
3d8c7512db08 fixed argument of #origininChanged:
ca
parents: 652
diff changeset
  2696
    self originChanged:0 @ (nLines * fontHeight).
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2697
    "/ self redrawFromVisibleLine:1 to:nLinesShown
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2698
    self invalidate
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2699
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2700
    "Modified: 17.4.1997 / 01:46: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
  2701
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2702
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2703
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
  2704
    "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
  2705
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2706
    |oldOrg|
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2707
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2708
    (firstLineShown == 1) ifFalse:[
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2709
        self originWillChange.
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2710
        oldOrg := firstLineShown.
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2711
        firstLineShown := firstLineShown - nFullLinesShown.
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2712
        (firstLineShown < 1) ifTrue:[
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2713
            firstLineShown := 1
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2714
        ].
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2715
        self originChanged:0 @ (firstLineShown - oldOrg * fontHeight).
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2716
        "/ self redrawFromVisibleLine:1 to:nLinesShown
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2717
        self invalidate
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2718
    ]
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2719
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2720
    "Modified: 17.4.1997 / 01:46:57 / 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
  2721
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2722
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2723
scrollDown
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2724
    "change origin to scroll down one line (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
  2725
75b8fb924904 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
    self scrollDown:1
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2727
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2728
    "Modified: 24.2.1996 / 16:17: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
  2729
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2730
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2731
scrollDown:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2732
    "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
  2733
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2734
    |w     "{ 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
  2735
     h     "{ Class:SmallInteger }"
332
284baf841664 scroll-off-by-one bug fixed (I hope)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2736
     n     "{ 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
  2737
     m2    "{ 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
  2738
     count "{ 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
  2739
     y0    "{ Class:SmallInteger }"
332
284baf841664 scroll-off-by-one bug fixed (I hope)
Claus Gittinger <cg@exept.de>
parents: 311
diff changeset
  2740
     y1    "{ Class:SmallInteger }"
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2741
     nPixel sz sH partialCopy|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2742
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2743
    count := nLines.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2744
    sz := 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
  2745
    (firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[
986
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2746
        count := sz - firstLineShown - nFullLinesShown + 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
  2747
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2748
    count <= 0 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
  2749
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2750
    self originWillChange.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2751
    nPixel := fontHeight * count.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2752
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2753
    shown ifFalse:[
986
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2754
        firstLineShown := firstLineShown + count.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2755
        viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2756
    ] ifTrue:[
986
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2757
        (count >= nLinesShown) ifTrue:[
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2758
            firstLineShown := firstLineShown + count.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2759
            viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2760
            "/ self redrawFromVisibleLine:1 to:nLinesShown.
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2761
            self invalidate
986
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2762
        ] ifFalse:[
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2763
            m2 := margin * 2.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2764
            w := self widthForScrollBetween:firstLineShown 
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2765
                                        and:(firstLineShown + nLinesShown).
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2766
            w := w + leftMargin.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2767
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2768
            sH := lineSpacing // 2.    
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2769
            y0 := textStartTop - sH.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2770
            h := nPixel + y0.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2771
            n := height - h + (lineSpacing " //2 ").   
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2772
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2773
            y1 := h + n - 1.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2774
            y1 >= (height - margin) ifTrue:[
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2775
                partialCopy := true.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2776
                y1 := height - margin - 1
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2777
            ].
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2778
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2779
            self catchExpose.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2780
            self 
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2781
                copyFrom:self x:margin y:h
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2782
                toX:margin y:y0
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2783
                width:w height:(y1 - h + 1)
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2784
                async:true.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2785
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2786
            firstLineShown := firstLineShown + count.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2787
            viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2788
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2789
            (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2790
                self paint:bgColor.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2791
                self fillRectangleX:margin y:(y0 + (y1 - h + 1))
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2792
                              width:w height:sH.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2793
            ].
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2794
            self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2795
            self waitForExpose.
7f50e27cb732 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  2796
        ].
249
75b8fb924904 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
    ].
663
3d8c7512db08 fixed argument of #origininChanged:
ca
parents: 652
diff changeset
  2798
    self originChanged:(0 @ nPixel).
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2799
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2800
    "Modified: 17.4.1997 / 01:47:46 / 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
  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
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2803
scrollDownPixels:pix
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2804
    "change origin to scroll down some pixels 
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2805
     (towards the bottom of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2806
     THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2807
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2808
    |w     "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2809
     h     "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2810
     n     "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2811
     m2    "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2812
     count "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2813
     y0    "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2814
     y1    "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2815
     nLines nPixel sz sH partialCopy|
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2816
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2817
    nLines := pix / fontHeight.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2818
    count := nLines.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2819
    sz := self size.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2820
    (firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2821
        count := sz - firstLineShown - nFullLinesShown + 1
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2822
    ].
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2823
    count <= 0 ifTrue:[^ self].
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2824
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2825
    self originWillChange.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2826
    nPixel := fontHeight * count.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2827
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2828
    shown ifFalse:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2829
        firstLineShown := firstLineShown + count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2830
        viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2831
    ] ifTrue:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2832
        (count >= nLinesShown) ifTrue:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2833
            firstLineShown := firstLineShown + count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2834
            viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2835
            self redrawFromVisibleLine:1 to:nLinesShown.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2836
        ] ifFalse:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2837
            m2 := margin * 2.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2838
            w := self widthForScrollBetween:firstLineShown 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2839
                                        and:(firstLineShown + nLinesShown).
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2840
            w := w + leftMargin.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2841
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2842
            sH := lineSpacing // 2.    
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2843
            y0 := textStartTop - sH.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2844
            h := nPixel + y0.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2845
            n := height - h + (lineSpacing " //2 ").   
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2846
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2847
            y1 := h + n - 1.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2848
            y1 >= (height - margin) ifTrue:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2849
                partialCopy := true.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2850
                y1 := height - margin - 1
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2851
            ].
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2852
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2853
            self catchExpose.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2854
            self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2855
                copyFrom:self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2856
                x:margin y:h
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2857
                toX:margin y:y0
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2858
                width:w height:(y1 - h + 1)
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2859
                async:true.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2860
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2861
            firstLineShown := firstLineShown + count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2862
            viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2863
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2864
            (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2865
                self paint:bgColor.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2866
                self fillRectangleX:margin y:(y0 + (y1 - h + 1))
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2867
                              width:w height:sH.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2868
            ].
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2869
            self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2870
            self waitForExpose.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2871
        ].
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2872
    ].
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2873
    self originChanged:(0 @ nPixel).
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2874
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  2875
    "Modified: 29.1.1997 / 13:06:15 / cg"
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2876
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2877
249
75b8fb924904 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
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
  2879
    "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
  2880
75b8fb924904 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
    |orgX|
75b8fb924904 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
    orgX := 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
  2884
75b8fb924904 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
    (aPixelOffset < orgX) 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
  2886
	self scrollLeft:(orgX - 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
  2887
    ] 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
  2888
	(aPixelOffset > orgX) 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
  2889
	    self scrollRight:(aPixelOffset - orgX)
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2890
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2891
    ]
75b8fb924904 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
scrollLeft
75b8fb924904 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
    "scroll left by one 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
      - question is how much is a good for variable fonts"
75b8fb924904 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
75b8fb924904 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
    self scrollLeft: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
  2899
!
75b8fb924904 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
75b8fb924904 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
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
  2902
    "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
  2903
663
3d8c7512db08 fixed argument of #origininChanged:
ca
parents: 652
diff changeset
  2904
    |newLeftOffset delta|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2905
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2906
    nPixel <= 0 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
  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
    newLeftOffset := leftOffset - 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
  2909
    newLeftOffset <= 0 ifTrue:[
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2910
        leftOffset == 0 ifTrue:[^ self].
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2911
        newLeftOffset := 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
  2912
    ].
75b8fb924904 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
    self originWillChange.
663
3d8c7512db08 fixed argument of #origininChanged:
ca
parents: 652
diff changeset
  2915
    delta := newLeftOffset - leftOffset.
249
75b8fb924904 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
    leftOffset := newLeftOffset.
75b8fb924904 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
    viewOrigin := newLeftOffset @ viewOrigin y.
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2918
    "/ self redrawFromVisibleLine:1 to:nLinesShown.
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2919
    self invalidate.
663
3d8c7512db08 fixed argument of #origininChanged:
ca
parents: 652
diff changeset
  2920
    self originChanged:(delta @ 0)
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2921
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2922
    "Modified: 17.4.1997 / 01:48: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
  2923
!
75b8fb924904 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
scrollRight
75b8fb924904 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
    "scroll right by one 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
  2927
      - question is how much is a good for variable fonts"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2928
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2929
    self scrollRight: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
  2930
!
75b8fb924904 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
75b8fb924904 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
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
  2933
    "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
  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
    |wMax cnt|
75b8fb924904 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
75b8fb924904 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
    cnt := 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
  2939
75b8fb924904 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
 commenting out the block below allows scrolling to the right 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
  2942
 the widest 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
  2943
"
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2944
" "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2945
    "
75b8fb924904 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
     the 10 below allows scrolling somewhat behind the end of the 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
  2947
    "
75b8fb924904 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
    wMax := self widthOfContents + 10.
75b8fb924904 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
    (leftOffset + nPixel + width > wMax) ifTrue:[
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2950
        cnt := wMax - leftOffset - width
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2951
    ].
75b8fb924904 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
" "
75b8fb924904 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
    cnt <= 0 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
  2954
    self originWillChange.
75b8fb924904 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
    leftOffset := leftOffset + cnt.
75b8fb924904 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
    viewOrigin := leftOffset @ viewOrigin y.
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2957
    "/ self redrawFromVisibleLine:1 to:nLinesShown.
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2958
    self invalidate.
249
75b8fb924904 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
    self originChanged:(cnt @ 0)
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2960
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  2961
    "Modified: 17.4.1997 / 01:48:27 / 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
  2962
!
75b8fb924904 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
75b8fb924904 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
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
  2965
    "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
  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
    ^ 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
  2968
!
75b8fb924904 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
75b8fb924904 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
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
  2971
    "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
  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
    ^ 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
  2974
!
75b8fb924904 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
820
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2976
scrollTo:newOrigin 
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2977
    "change origin to have newOrigin be visible at the top-left.
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2978
     The argument defines the integer device coordinates of the new top-left 
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2979
     point."
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2980
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2981
    "due to historic reasons, the work is actually done by scrollUp/Down
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2982
     scrollLeft/Right (those where implemented first).
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2983
     This will be changed to do all work here, and call it from
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2984
     the other scrolling methods."
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2985
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2986
    |dX   "{ Class:SmallInteger }"
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2987
     dY   "{ Class:SmallInteger }"
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2988
     m2   "{ Class:SmallInteger }" |
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2989
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2990
    dX := newOrigin x - viewOrigin x.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2991
    dY := newOrigin y - viewOrigin y.
820
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  2992
    dX = 0 ifTrue:[
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2993
        dY < 0 ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2994
            ^ self scrollUpPixels:(dY negated).
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2995
        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2996
        dY > 0 ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2997
            ^ self scrollDownPixels:dY.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2998
        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2999
        ^ self
820
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3000
    ].
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3001
    dY = 0 ifTrue:[
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3002
        dX < 0 ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3003
            ^ self scrollLeft:dX negated
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3004
        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3005
        dX > 0 ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3006
            ^ self scrollRight:dX
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3007
        ].
820
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3008
    ].
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3009
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3010
    self originWillChange.
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3011
    self setViewOrigin:newOrigin.
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3012
    shown ifTrue:[
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3013
        m2 := margin * 2. "top & bottom margins"
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3014
        self redrawDeviceX:margin y:margin
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3015
                     width:(width - m2)
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3016
                    height:(height - m2).
820
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3017
    ].
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3018
    self originChanged:(dX negated @ dY negated).
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3019
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3020
    "Modified: 22.5.1996 / 11:18:30 / cg"
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3021
    "Created: 7.8.1996 / 17:51:34 / stefan"
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  3022
    "Modified: 16.12.1996 / 14:07:32 / stefan"
820
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3023
!
a28312b50684 Define #scrollTo: here to call scrollUp/Down/Left/Right.
Stefan Vogel <sv@exept.de>
parents: 808
diff changeset
  3024
249
75b8fb924904 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
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
  3026
    "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
  3027
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3028
    "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
  3029
     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
  3030
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3031
    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
  3032
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3033
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3034
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
  3035
    "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
  3036
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3037
    |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
  3038
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3039
    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
  3040
	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
  3041
	    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
  3042
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3043
	^ 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
  3044
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3045
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3046
    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
  3047
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3048
    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
  3049
	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
  3050
    ] 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
  3051
	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
  3052
	    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
  3053
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3054
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3055
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3056
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3057
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
  3058
    "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
  3059
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3060
    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
  3061
	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
  3062
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3063
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3065
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
  3066
    "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
  3067
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3068
    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
  3069
	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
  3070
    ] 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
  3071
	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
  3072
	    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
  3073
	]
75b8fb924904 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
    ]
75b8fb924904 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
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3076
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3077
scrollToPercent:percentOrigin
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3078
    "scroll to a position given in percent of total"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3079
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3080
    "kludge - ListView thinks in lines"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3081
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3082
    self scrollHorizontalToPercent:percentOrigin x.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3083
    self scrollVerticalToPercent:percentOrigin y.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3084
!
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3085
249
75b8fb924904 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
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
  3087
    "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
  3088
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3089
    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
  3090
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3091
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3092
scrollUp
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3093
    "change origin to scroll up one line (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
  3094
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3095
    self scrollUp:1
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3096
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3097
    "Modified: 24.2.1996 / 16:17: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
  3098
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3099
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3100
scrollUp:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3101
    "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
  3102
75b8fb924904 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
    |w      "{ 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
  3104
     h      "{ 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
  3105
     count  "{ 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
  3106
     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
  3107
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3108
    count := nLines.
75b8fb924904 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
    count >= firstLineShown ifTrue:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3110
        count := firstLineShown - 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3111
    ].
75b8fb924904 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
    (count == 0) 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
  3113
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3114
    self originWillChange.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3115
    nPixel := fontHeight * count.
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3116
    shown ifFalse:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3117
        firstLineShown := firstLineShown - count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3118
        viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
249
75b8fb924904 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
    ] ifTrue:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3120
        (count >= nLinesShown) ifTrue:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3121
            firstLineShown := firstLineShown - count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3122
            viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  3123
            "/ self redrawFromVisibleLine:1 to:nLinesShown.
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  3124
            self invalidate.
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3125
        ] ifFalse:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3126
            w := self widthForScrollBetween:firstLineShown
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3127
                                        and:(firstLineShown + nLinesShown).
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3128
            w := w + leftMargin.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3129
            h := nPixel + margin.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3130
            self catchExpose.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3131
            self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3132
                copyFrom:self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3133
                x:margin y:margin 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3134
                toX:margin y:h
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3135
                width:w height:(height - h)
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3136
                async:true.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3137
            firstLineShown := firstLineShown - count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3138
            viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3139
            self redrawFromVisibleLine:1 to:count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3140
            self waitForExpose.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3141
        ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3142
    ].
663
3d8c7512db08 fixed argument of #origininChanged:
ca
parents: 652
diff changeset
  3143
    self originChanged:(0 @ (nPixel negated)).
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3144
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
  3145
    "Modified: 17.4.1997 / 01:48:50 / 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
  3146
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3147
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3148
scrollUpPixels:pix
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3149
    "change origin to scroll up some pixels 
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3150
     (towards the top of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3151
    THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3152
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3153
    |w      "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3154
     h      "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3155
     count  "{ Class:SmallInteger }"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3156
     nLines nPixel|
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3157
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3158
    nLines := pix / fontHeight.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3159
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3160
    count := nLines.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3161
    count >= firstLineShown ifTrue:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3162
        count := firstLineShown - 1
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3163
    ].
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3164
    (count == 0) ifTrue:[^ self].
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3165
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3166
    self originWillChange.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3167
    nPixel := fontHeight * count.
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3168
    shown ifFalse:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3169
        firstLineShown := firstLineShown - count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3170
        viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3171
    ] ifTrue:[
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3172
        (count >= nLinesShown) ifTrue:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3173
            firstLineShown := firstLineShown - count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3174
            viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3175
            self redrawFromVisibleLine:1 to:nLinesShown.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3176
        ] ifFalse:[
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3177
            w := self widthForScrollBetween:firstLineShown
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3178
                                        and:(firstLineShown + nLinesShown).
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3179
            w := w + leftMargin.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3180
            h := nPixel + margin.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3181
            self catchExpose.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3182
            self 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3183
                copyFrom:self x:margin y:margin 
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3184
                toX:margin y:h
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3185
                width:w height:(height - h)
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3186
                async:true.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3187
            firstLineShown := firstLineShown - count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3188
            viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3189
            self redrawFromVisibleLine:1 to:count.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3190
            self waitForExpose.
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3191
        ].
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3192
    ].
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3193
    self originChanged:(0 @ (nPixel negated)).
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3194
984
dbd60475b3f5 explicit async bitBlt
Claus Gittinger <cg@exept.de>
parents: 967
diff changeset
  3195
    "Modified: 29.1.1997 / 13:06:46 / cg"
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3196
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3197
249
75b8fb924904 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
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
  3199
    "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
  3200
75b8fb924904 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
    |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
  3202
75b8fb924904 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
    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
  3204
    "/
75b8fb924904 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
    "/ 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
  3206
    "/
75b8fb924904 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
    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
  3208
	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
  3209
    ].
75b8fb924904 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
    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
  3211
    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
  3212
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3213
75b8fb924904 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
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
  3215
    "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
  3216
     - 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
  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
    |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
  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
    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
  3221
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3222
    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
  3223
    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
  3224
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3225
    (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
  3226
	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
  3227
	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
  3228
	    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
  3229
	    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
  3230
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3231
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3232
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3233
75b8fb924904 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
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
  3235
    "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
  3236
     - 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
  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
    |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
  3239
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3240
    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
  3241
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3242
    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
  3243
    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
  3244
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3245
    (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
  3246
	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
  3247
	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
  3248
	    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
  3249
	    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
  3250
	]
75b8fb924904 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
!
75b8fb924904 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
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
  3255
    "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
  3256
     - 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
  3257
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3258
    |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
  3259
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3260
    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
  3261
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3262
    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
  3263
    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
  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
    (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
  3266
	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
  3267
	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
  3268
	    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
  3269
	    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
  3270
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3271
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3272
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3273
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3274
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
  3275
    "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
  3276
     - 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
  3277
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3278
    |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
  3279
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3280
    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
  3281
75b8fb924904 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
    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
  3283
    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
  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
    (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
  3286
	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
  3287
	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
  3288
	    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
  3289
	    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
  3290
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3291
    ]
75b8fb924904 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
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
  3295
    "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
  3296
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3297
    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
  3298
	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
  3299
	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
  3300
	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
  3301
	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
  3302
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3303
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3304
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3305
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
  3306
    "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
  3307
     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
  3308
     (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
  3309
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3310
    ^ 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
  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
!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
  3314
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3315
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
  3316
    "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
  3317
     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
  3318
     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
  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
    |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
  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
    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
  3323
    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
  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
    "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
  3326
    (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
  3327
	[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
  3328
	    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
  3329
	    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
  3330
		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
  3331
	    ] 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
  3332
		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
  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
	].
75b8fb924904 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
	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
  3336
    ] 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
  3337
	"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
  3338
	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
  3339
	    [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
  3340
		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
  3341
		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
  3342
	    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3343
	    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
  3344
		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
  3345
	    ].
75b8fb924904 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
	] 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
  3347
	    "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
  3348
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3349
    ].
75b8fb924904 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
    ^ 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
  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
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
  3354
    "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
  3355
     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
  3356
     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
  3357
     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
  3358
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3359
    |endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3360
     len    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3361
     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
  3362
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3363
    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
  3364
    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
  3365
    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
  3366
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3367
    "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
  3368
    (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
  3369
	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
  3370
	[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
  3371
	    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
  3372
	    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
  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
	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
  3375
    ] 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
  3376
	"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
  3377
	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
  3378
	    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
  3379
	    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
  3380
		"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
  3381
		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
  3382
	    ] 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
  3383
		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
  3384
		[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
  3385
		    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
  3386
		    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
  3387
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3388
		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
  3389
	    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3390
	] 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
  3391
	    "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
  3392
	]
125
claus
parents: 121
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
    ^ 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
  3395
!
75b8fb924904 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
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3397
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
  3398
    "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
  3399
     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
  3400
     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
  3401
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3402
    |lineString 
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3403
     found firstChar1 firstChar2 c pc
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3404
     col         "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3405
     cc          "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3406
     patternSize "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3407
     line1       "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3408
     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
  3409
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3410
    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
  3411
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3412
        self withCursor:Cursor questionMark do:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3413
            col := startCol - 1.
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3414
            firstChar1 := pattern at:1.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3415
            ignCase ifTrue:[
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3416
                firstChar1 := firstChar1 asLowercase.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3417
                firstChar2 := firstChar1 asUppercase.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3418
            ] ifFalse:[
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3419
                firstChar2 := firstChar1
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3420
            ].
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3421
            col > (list at:startLine) size ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3422
                col := -999
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3423
            ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3424
            line1 := startLine.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3425
            line1 to:1 by:-1 do:[:lnr |
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3426
                lineString := list at:lnr.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3427
                lineString notNil ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3428
                    lineSize := lineString size.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3429
                    col == -999 ifTrue:[col := lineSize - patternSize + 1].
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3430
                    [(col > 0) 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3431
                     and:[(c := lineString at:col) ~= firstChar1
1338
9d59c19b9328 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  3432
                     and:[c ~= firstChar2]]] whileTrue:[
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3433
                        col := col - 1
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3434
                    ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3435
                    [col > 0] whileTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3436
                        cc := col.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3437
                        found := true.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3438
                        1 to:patternSize do:[:cnr |
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3439
                            cc > lineSize ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3440
                                found := false
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3441
                            ] ifFalse:[
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3442
                                pc := pattern at:cnr.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3443
                                c := lineString at:cc.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3444
                                pc ~= c ifTrue:[
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3445
                                    (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3446
                                        found := false
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3447
                                    ]
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3448
                                ]
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3449
                            ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3450
                            cc := cc + 1
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3451
                        ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3452
                        found ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3453
                            ^ block1 value:lnr value:col.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3454
                        ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3455
                        col := col - 1.
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3456
                        [(col > 0) 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3457
                        and:[(c := lineString at:col) ~= firstChar1
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3458
                        and:[c ~= firstChar2]]] whileTrue:[
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3459
                            col := col - 1
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3460
                        ]
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3461
                    ]
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3462
                ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3463
                col := -999.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3464
            ]
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3465
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3466
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3467
    "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
  3468
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3469
    ^ block2 value
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3470
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3471
    "Created: 13.9.1997 / 01:06:19 / cg"
1338
9d59c19b9328 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  3472
    "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
  3473
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3474
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3475
searchBackwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3476
    "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
  3477
     found evaluate block2.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3478
     Sorry, but pattern is no regular expression pattern (yet)"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3479
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3480
    ^ self
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3481
        searchBackwardFor:pattern 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3482
        ignoreCase:false 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3483
        startingAtLine:startLine col:startCol 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3484
        ifFound:block1 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3485
        ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3486
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3487
    "Modified: 13.9.1997 / 01:07:36 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3488
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3489
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3490
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
  3491
    "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
  3492
     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
  3493
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  3494
    |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
  3495
     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
  3496
     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
  3497
     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
  3498
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3499
    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
  3500
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3501
        self withCursor:Cursor questionMark do:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3502
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3503
            col := startCol + 1.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3504
            line1 := startLine.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3505
            line2 := list size.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3506
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3507
            pattern includesUnescapedMatchCharacters ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3508
                p := pattern species new:0.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3509
                (pattern startsWith:$*) ifFalse:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3510
                    p := p , '*'
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3511
                ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3512
                p := p , pattern.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3513
                (pattern endsWith:$*) ifFalse:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3514
                    p := p , '*'
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3515
                ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3516
                realPattern := pattern.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3517
                (realPattern startsWith:$*) ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3518
                    realPattern := realPattern copyFrom:2
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3519
                ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3520
                line1 to:line2 do:[:lnr |
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3521
                    lineString := list at:lnr.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3522
                    lineString notNil ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3523
                        "/ first a crude check ...
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3524
                        (p match:lineString ignoreCase:ignCase) ifTrue:[
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3525
                            "/ ok, there it is; look at which position
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3526
                            col := lineString 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3527
                                        findMatchString:realPattern 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3528
                                        startingAt:col 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3529
                                        ignoreCase:ignCase 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3530
                                        ifAbsent:0.
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3531
                            col ~~ 0 ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3532
                                ^ block1 value:lnr value:col.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3533
                            ]
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3534
                        ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3535
                    ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3536
                    col := 1
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3537
                ]
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3538
            ] ifFalse:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3539
                p := pattern withoutMatchEscapes.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3540
                line1 to:line2 do:[:lnr |
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3541
                    lineString := list at:lnr.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3542
                    lineString isString ifTrue:[
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3543
                        ignCase ifTrue:[
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3544
                            col := lineString 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3545
                                        findMatchString:p 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3546
                                        startingAt:col 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3547
                                        ignoreCase:ignCase 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3548
                                        ifAbsent:0.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3549
                        ] ifFalse:[
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3550
                            col := lineString 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3551
                                        findString:p 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3552
                                        startingAt:col 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3553
                                        ifAbsent:0.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3554
                        ].
1178
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3555
                        col ~~ 0 ifTrue:[
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3556
                            ^ block1 value:lnr value:col.
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3557
                        ]
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3558
                    ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3559
                    col := 1
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3560
                ]
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3561
            ].
c221e0f8cbb6 handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  3562
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3563
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3564
    "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
  3565
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3566
    ^ block2 value
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  3567
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3568
    "Created: 13.9.1997 / 01:06:31 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3569
    "Modified: 13.9.1997 / 01:11:28 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3570
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3571
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3572
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3573
    "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
  3574
     found evaluate block2."
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3575
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3576
    ^ self
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3577
        searchForwardFor:pattern 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3578
        ignoreCase:false 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3579
        startingAtLine:startLine col:startCol 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3580
        ifFound:block1 
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3581
        ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3582
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3583
    "Modified: 13.9.1997 / 01:07:11 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  3584
! !
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3585
75b8fb924904 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:'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
  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
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
  3589
    "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
  3590
     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
  3591
     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
  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
    |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
  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
    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
  3596
    list notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3597
	nLines := self size.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3598
	1 to:nLines do:[:index |
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3599
	    line := self at:index.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3600
	    line notNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3601
		line isString ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3602
		    newLine := line withTabsExpanded.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3603
		    newLine ~~ line ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3604
			self withoutRedrawAt:index put:newLine
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3605
		    ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3606
		] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3607
		    includesNonStrings := true.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3608
		]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3609
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3610
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3611
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3612
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3613
    "Modified: 30.8.1995 / 19:06:37 / claus"
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  3614
    "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
  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
75b8fb924904 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
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
  3618
    "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
  3619
75b8fb924904 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
    ^ 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
  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
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
  3624
    "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
  3625
     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
  3626
75b8fb924904 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
    |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
  3628
     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
  3629
     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
  3630
     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
  3631
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3632
    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
  3633
    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
  3634
    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
  3635
    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
  3636
    [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
  3637
	(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
  3638
	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
  3639
	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
  3640
    ].
75b8fb924904 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
    ^ 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
  3642
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3643
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3644
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
  3645
    "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
  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
    |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
  3648
     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
  3649
     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
  3650
     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
  3651
75b8fb924904 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
    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
  3653
    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
  3654
    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
  3655
    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
  3656
    [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
  3657
	(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
  3658
	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
  3659
	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
  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
    (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
  3662
	^ 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
  3663
    ].
75b8fb924904 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
    ^ 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
  3665
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3666
75b8fb924904 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
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
  3668
    "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
  3669
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3670
    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
  3671
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3672
75b8fb924904 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
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
  3674
    "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
  3675
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3676
    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
  3677
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3678
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3679
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
  3680
    "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
  3681
     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
  3682
     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
  3683
     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
  3684
     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
  3685
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3686
    |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
  3687
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3688
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3689
     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
  3690
     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
  3691
     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
  3692
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3693
    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
  3694
    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
  3695
    (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
  3696
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3697
    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
  3698
    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
  3699
    [newLine startsWith:eightSpaces] whileTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3700
	newLine := newLine copyFrom:9.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3701
	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
  3702
    ].
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3703
    ^ (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
  3704
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3705
    "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
  3706
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3707
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3708
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
  3709
    "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
  3710
     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
  3711
     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
  3712
     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
  3713
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3714
    |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
  3715
     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
  3716
     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
  3717
     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
  3718
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3719
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3720
     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
  3721
     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
  3722
     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
  3723
     (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
  3724
      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
  3725
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3726
    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
  3727
    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
  3728
    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
  3729
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3730
    currentMax := line size + (nTabs * 7).
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3731
    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
  3732
    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
  3733
    line do:[:character |
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3734
	(character == (Character tab)) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3735
	    nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3736
	    [dstIndex < nextTab] whileTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3737
		tmpString at:dstIndex put:(Character space).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3738
		dstIndex := dstIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3739
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3740
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3741
	    tmpString at:dstIndex put:character.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3742
	    dstIndex := dstIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3743
	].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3744
	(dstIndex > currentMax) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3745
	    "
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3746
	     this cannot happen with <= 8 tabs
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3747
	    "
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3748
	    currentMax := currentMax + currentMax.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3749
	    nString := line species new:currentMax.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3750
	    nString replaceFrom:1 to:(dstIndex - 1) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3751
			   with:tmpString startingAt:1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3752
	    tmpString := nString.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3753
	    nString := nil
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3754
	].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3755
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3756
	"make stc-optimizer happy
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3757
	 - no need to return value of ifTrue:/ifFalse above"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3758
	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
  3759
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3760
    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
  3761
    dstIndex == currentMax ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3762
	^ 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
  3763
    ].
75b8fb924904 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
    ^ tmpString copyTo:dstIndex
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3765
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3766
    "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
  3767
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3768
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3769
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
  3770
    "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
  3771
     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
  3772
     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
  3773
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3774
    ^ 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
  3775
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3776
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  3777
!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
  3778
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3779
version
1452
d4c481299b88 fix bitBlt-copying of margin when removing a line.
Claus Gittinger <cg@exept.de>
parents: 1451
diff changeset
  3780
    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.151 1998-02-24 17:33:49 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
  3781
! !