ListView.st
author Claus Gittinger <cg@exept.de>
Sun, 07 Mar 1999 16:07:10 +0100
changeset 1773 1e941ac6f4cb
parent 1756 4feaf69d64f0
child 1775 8ef9fab69bf9
permissions -rw-r--r--
add some to heightOfContents, to allow scrolling down to the real end (for last line fully visible)
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
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
    18
		autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
    19
		listMsg viewOrigin listChannel backgroundAlreadyClearedColor'
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
    20
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions
1699
b10682bac6f9 async redraw when scrolling horizontally
Claus Gittinger <cg@exept.de>
parents: 1693
diff changeset
    21
		DefaultLeftMargin DefaultTopMargin'
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
    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
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   104
						  (internal; updated on size changes)
1325
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
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   106
						  (internal; updated on size changes)
1325
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
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   128
						  The default rule is to return true for alphaNumeric characters.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   129
						  (can be changed to allow for underscore and other
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   130
						   characters to be treated as alphaCharacters)
1325
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
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   133
						  autoScroll (internal)
1325
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,
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   139
						  this is sent to the model to aquired a new contents
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   140
						  whenever a change of the aspect  (aspectMsg) occurs.
1325
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
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   144
      backgroundAlreadyClearedColor               internal; speedup by avoiding
1458
76e820fde1e7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   145
						  multiple fills when drawing
76e820fde1e7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
   146
						  internal lines
120
claus
parents: 118
diff changeset
   147
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   148
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   149
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   150
      textForegroundColor                         defaults to Black
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   151
      textBackgroundColor                         defaults to White
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   152
      textFont                                    defaults to defaultFont
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   153
      textTabPositions                            defaults to #(1 9 17 25 ...)
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
    [author:]
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   156
	Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   157
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   158
    [see also:]
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   159
	TextView EditTextView
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   160
        
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   161
"
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   162
!
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   163
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   164
examples 
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   165
"
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   166
    ListViews alone are rarely used - its mostly an abstract superclass
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   167
    for TextView, EditTextView and SelectionInListView.
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   168
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   169
    anyway, here are a few examples:
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   170
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   171
     basic simple setup:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   172
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   173
	|top l|
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
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   176
	top extent:100@200.
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
	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
   179
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   180
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   181
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   182
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   183
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   184
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   185
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   186
      specifying textMargins (these have NOTHING to do with the viewInset):
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   187
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   188
	|top l|
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
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   191
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   192
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   193
	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
   194
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   195
	l topMargin:10.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   196
	l leftMargin:20.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   197
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   198
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   199
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   200
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   201
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   202
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   203
      globally set the fg/bg colors:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   204
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   205
	|top l|
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
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   208
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   209
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   210
	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
   211
	l list:#('one' 'two' 'three').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   212
	l foregroundColor:(Color white).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   213
	l backgroundColor:(Color blue).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   214
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   215
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   216
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   217
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   218
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   219
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   220
      non-string (text) entries:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   221
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   222
	|top list l|
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
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   225
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   226
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   227
	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
   228
	list := #('all' 'of' 'your' 'preferred' 'colors') 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   229
		with:#(red green blue 'orange' cyan)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   230
		collect:[:s :clr | 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   231
			    Text string:s 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   232
				 emphasis:(Array with:#bold
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   233
						 with:(#color->(Color name:clr))) ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   234
	l list:list.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   235
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   236
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   237
									[exEnd]
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   238
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   239
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   240
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   241
      generic non-string entries:
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   242
      (notice: ColoredListEntry is obsoleted by Text)
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   243
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   244
	|top list l|
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
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   247
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   248
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   249
	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
   250
	list := #('all' 'of' 'your' 'preferred' 'colors') 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   251
		with:#(red green blue 'orange' cyan)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   252
		collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   253
	l list:list.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   254
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   255
	top open
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   256
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   257
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   258
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   259
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   260
      using a model (default listMessage is aspectMessage):
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   261
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   262
	|top model l theModelsText|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   263
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   264
	model := Plug new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   265
	model respondTo:#modelsAspect
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   266
		   with:[ theModelsText ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   267
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   268
	top := StandardSystemView new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   269
	top extent:100@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   270
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   271
	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
   272
	l model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   273
	l aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   274
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   275
	top open.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   276
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   277
	Delay waitForSeconds:3.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   278
	theModelsText := #('foo' 'bar' 'baz').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   279
	model changed:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   280
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   281
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   282
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   283
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   284
      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
   285
      for two listViews:
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   286
									[exBegin]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   287
	|top model l1 l2 plainText|
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   288
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   289
	plainText := #('').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   290
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   291
	model := Plug new.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   292
	model respondTo:#modelsUppercaseText
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 asUppercase]].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   295
	model respondTo:#modelsLowercaseText
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   296
		   with:[ plainText asStringCollection 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   297
			      collect:[:l | l asLowercase]].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   298
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   299
	top := StandardSystemView extent:200@200.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   300
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   301
	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
   302
	l1 model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   303
	l1 aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   304
	l1 listMessage:#modelsUppercaseText.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   305
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   306
	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
   307
	l2 model:model.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   308
	l2 aspect:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   309
	l2 listMessage:#modelsLowercaseText.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   310
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   311
	top open.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   312
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   313
	Delay waitForSeconds:3.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   314
	plainText := #('foo' 'bar' 'baz').
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   315
	model changed:#modelsAspect.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   316
									[exEnd]
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   317
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   318
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   319
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   320
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   321
!ListView class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   322
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   323
defaultTabPositions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   324
    "return an array containing the default tab positions"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   325
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   326
    ^ self tab8Positions
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   327
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   328
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   329
tab4Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   330
    "return an array containing tab positions for 4-col tabs"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   331
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   332
    ^ #(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
   333
	85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145)
120
claus
parents: 118
diff changeset
   334
!
claus
parents: 118
diff changeset
   335
claus
parents: 118
diff changeset
   336
tab8Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   337
    "return an array containing tab positions for 8-col tabs"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   338
120
claus
parents: 118
diff changeset
   339
    ^ #(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
   340
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   341
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   342
updateStyleCache
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   343
    "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
   344
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   345
    <resource: #style (#'text.foregroundColor' #'text.backgroundColor'
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   346
		       #'text.tabPositions'
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   347
		       #'text.font')>
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   348
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   349
    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   350
    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:White.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   351
    DefaultFont := StyleSheet fontAt:'text.font'.
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   352
    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
   353
    DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions].
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   354
    DefaultLeftMargin := 0.5.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   355
    DefaultTopMargin := 0.5.
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   356
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   357
    "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
   358
! !
75b8fb924904 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
!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
   361
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   362
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
   363
    "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
   364
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   365
    ^ 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
   366
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   367
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   368
backgroundColor:aColor
1222
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   369
    "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
   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
    bgColor ~~ aColor ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   372
	bgColor := aColor.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   373
	self viewBackground:bgColor.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   374
	shown ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   375
	    self invalidate "/ clear; redraw
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   376
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   377
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   378
1222
0770bb87d44e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   379
    "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
   380
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   381
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   383
    "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
   384
     Redraws everything.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   385
     CAVEAT: with the addition of Text objects,
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   386
	     this method is going to be obsoleted by a textStyle
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   387
	     method, which allows specific control over
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   388
	     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
   389
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   390
    aFont isNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   391
	^ 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
   392
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   393
    font ~~ aFont ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   394
	super font:(aFont on:device).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   395
	preferredExtent := nil.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   396
	widthOfWidestLine := nil. "/ i.e. unknown
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   397
	self getFontParameters.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   398
	realized ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   399
	    (font graphicsDevice == device) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   400
		self getFontParameters.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   401
		self computeNumberOfLinesShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   402
		shown ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   403
		    self redrawFromVisibleLine:1 to:nLinesShown
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   404
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   405
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   406
	    self contentsChanged
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   407
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   408
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   409
780
48f97576806f use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 776
diff changeset
   410
    "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
   411
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   412
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   413
fontHeight:pixels
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   414
    "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
   415
     by which lines are vertically separated."
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   416
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   417
    fontHeight ~~ pixels ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   418
	fontHeight := pixels.
1190
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   419
    ]
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   420
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   421
    "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
   422
!
c8f27edf064e use asyncronous invaluate, instead of synchronous redraw
Claus Gittinger <cg@exept.de>
parents: 1178
diff changeset
   423
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   424
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
   425
    "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
   426
75b8fb924904 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
    ^ 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
   428
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   429
75b8fb924904 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
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
   431
    "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
   432
75b8fb924904 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
    fgColor ~~ aColor ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   434
	fgColor := aColor.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   435
	shown ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   436
	    self invalidate 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   437
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   438
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   439
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   440
    "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
   441
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   442
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   443
foregroundColor: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
   444
    "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
   445
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   446
    ((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   447
	fgColor := color1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   448
	bgColor := color2.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   449
	shown ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   450
	    self invalidate 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   451
	]
249
75b8fb924904 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
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   453
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
   454
    "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
   455
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   456
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   457
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
   458
    "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
   459
     - 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
   460
     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
   461
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   462
    ^ 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
   463
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   464
290
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   465
innerHorizontalMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   466
    "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
   467
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   468
    ^ leftMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   469
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   470
    "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
   471
!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   472
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   473
innerVerticalMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   474
    "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
   475
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   476
    ^ topMargin
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   477
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   478
    "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
   479
!
f539121393b1 innerWidth:/innerHeight support; much more docu in editField
Claus Gittinger <cg@exept.de>
parents: 288
diff changeset
   480
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   481
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
   482
    "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
   483
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   484
    ^ 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
   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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   487
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
   488
    "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
   489
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   490
    leftMargin := aNumber.
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   491
    textStartLeft := aNumber + margin.
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   492
    innerWidth := width - aNumber - margin
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   493
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   494
    "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
   495
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   496
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   497
level:aNumber
1249
Claus Gittinger <cg@exept.de>
parents: 1241
diff changeset
   498
    "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
   499
     (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
   500
376
fb823917008e correctly handle level changes if abs(lvl) changes
ca
parents: 352
diff changeset
   501
    |newMargin|
fb823917008e correctly handle level changes if abs(lvl) changes
ca
parents: 352
diff changeset
   502
1298
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   503
    aNumber ~~ level ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   504
	newMargin := aNumber abs.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   505
	textStartLeft := leftMargin + newMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   506
	textStartTop := topMargin + newMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   507
	innerWidth := width - textStartLeft - newMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   508
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   509
	super level:aNumber.
1298
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   510
    ]
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   511
bcb4b7f72419 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   512
    "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
   513
!
75b8fb924904 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
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   515
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
   516
    "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
   517
     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
   518
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   519
    lineSpacing ~~ pixels ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   520
	lineSpacing := pixels.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   521
	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
   522
    ]
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   523
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   524
    "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
   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
75b8fb924904 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
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
   528
    "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
   529
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   530
    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
   531
    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
   532
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   533
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   534
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
   535
    "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
   536
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   537
    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
   538
    textStartTop := topMargin + margin.
339
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   539
!
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   540
ed1fcd2056f2 acced method to set the wordCheckBlock
ca
parents: 332
diff changeset
   541
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
   542
    "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
   543
     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
   544
     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
   545
     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
   546
     (national) characters.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   547
     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
   548
     (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
   549
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   550
    wordCheck := aBlock.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   551
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   552
    "Modified: 22.5.1996 / 12:26:55 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   553
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   554
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   555
!ListView methodsFor:'accessing-contents'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   556
249
75b8fb924904 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
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
   558
    "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
   559
75b8fb924904 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
    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
   561
    includesNonStrings ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   562
	includesNonStrings := (aString notNil and:[aString isString not]).
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   563
"/        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
   564
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   565
    shown ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   566
	self redrawLine:(self size).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   567
	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
   568
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   569
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   570
    "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
   571
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   572
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   573
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
   574
    "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
   575
1351
03d1b138f98f add:aString beforeIndex:
ca
parents: 1338
diff changeset
   576
    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
   577
    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
   578
    includesNonStrings ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   579
	includesNonStrings := (aString notNil and:[aString isString not]).
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   580
"/        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
   581
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   582
    shown ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   583
	self redrawFromLine:index.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   584
	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
   585
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   586
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   587
    "Modified: 22.10.1996 / 23:18:53 / cg"
65
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   588
!
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   589
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   590
at:lineNr
120
claus
parents: 118
diff changeset
   591
    "retrieve a line; return nil if beyond end-of-text.
claus
parents: 118
diff changeset
   592
     this allows textViews to be used like collections in some places."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   593
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   594
    list isNil ifTrue:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   595
    (lineNr between:1 and:self size) ifFalse:[^ nil].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   596
    ^ list at:lineNr
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   597
!
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   598
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   599
at:index put:aString
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   600
    "change a line and redisplay"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   601
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   602
    |visibleLine y fontHeightBefore|
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   603
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   604
    fontHeightBefore := fontHeight.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   605
    self withoutRedrawAt:index put:aString.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   606
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   607
    shown ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   608
	"/ synchronous drawing:
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   609
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   610
	"/ this could have changed the font height;
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   611
	"/ must clear all below last line, if it became smaller
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   612
	fontHeightBefore > fontHeight ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   613
	    (self listLineIsVisible:(self size)) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   614
		self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1))
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   615
				    corner:(width-margin) @ (height-margin).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   616
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   617
	    self redrawFromLine:index
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   618
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   619
	    self redrawLine:index
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   620
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   621
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   622
	"/ asynchronous:
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   623
"/        visibleLine := self listLineToVisibleLine:index.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   624
"/        visibleLine notNil ifTrue:[
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   625
"/            y := self yOfVisibleLine:visibleLine.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   626
"/            self invalidate:((margin @ y) extent:(width@fontHeight))
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   627
"/        ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   628
    ]
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   629
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   630
    "Modified: / 26.7.1998 / 13:36:33 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   631
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   632
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   633
characterAtLine:lineNr col:colNr
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   634
    "return the character at physical line/col. 
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   635
     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
   636
     Return a space character if nothing is there
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   637
     (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
   638
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   639
    |line|
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   640
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   641
    list notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   642
	line := self listAt:lineNr.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   643
	line notNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   644
	    (line size >= colNr) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   645
		^ line at:colNr
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   646
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
   647
	]
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   648
    ].
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   649
    ^ Character space
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   650
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   651
    "Created: 29.4.1996 / 12:11:00 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   652
    "Modified: 29.4.1996 / 12:12:41 / cg"
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   653
!
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   654
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   655
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
   656
    "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
   657
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   658
    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
   659
    ^ list asStringCollection asString
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   660
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   661
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   662
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
   663
    "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
   664
     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
   665
     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
   666
     to a collection of line-strings here."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   667
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   668
    |l|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   669
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   670
    l := something.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   671
    l notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   672
	l isString ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   673
	    l := l asStringCollection
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   674
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   675
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   676
    self list:l
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:11:54 / cg"
51
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   679
!
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
   680
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   681
from:from to:to do:aBlock
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   682
    "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
   683
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   684
    ^ list from:from to:to do:aBlock.
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   685
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   686
    "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
   687
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   688
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   689
grow:n
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   690
    "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
   691
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   692
    ^ 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
   693
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   694
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   695
list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   696
    "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
   697
     This returns the views internal list - modifying it may confuse
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   698
     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
   699
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   700
    ^ list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   701
1240
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: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
   703
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   704
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   705
list:aCollection
128
claus
parents: 127
diff changeset
   706
    "set the contents (a collection of strings or list entries) 
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   707
     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
   708
     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
   709
     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
   710
     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
   711
     (remembered to optimize later redraws)."
128
claus
parents: 127
diff changeset
   712
claus
parents: 127
diff changeset
   713
    self list:aCollection expandTabs:true
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
   714
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   715
    "Modified: 5.6.1997 / 11:10:45 / cg"
128
claus
parents: 127
diff changeset
   716
!
claus
parents: 127
diff changeset
   717
claus
parents: 127
diff changeset
   718
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
   719
    "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
   720
     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
   721
     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
   722
     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
   723
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   724
    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
   725
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   726
    "Modified: 5.6.1997 / 11: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
   727
!
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   728
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
   729
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
   730
    "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
   731
     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
   732
     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
   733
     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
   734
     (remembered to optimize later redraws)."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   735
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   736
    self
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   737
	list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   738
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   739
    "Modified: 5.6.1997 / 12:40:35 / cg"
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   740
!
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   741
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   742
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStrings
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   743
    "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
   744
     If expand is true, tabs are expanded (to spaces).
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   745
     If scan is true, scan the passed list for nonStrings; 
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   746
     otherwise, take the information from the nonStrings arg.
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   747
     (the nonStrings information is remembered to optimize later redraws & height computations)."
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
   748
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   749
    |oldFirst oldLeft nonStringsBefore fontHeightBefore|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   750
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   751
    (aCollection isNil and:[list isNil]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   752
	"no change"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   753
	self scrollToTop.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   754
	self scrollToLeft.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   755
	^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   756
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   757
    list := aCollection.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   758
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   759
    nonStringsBefore := includesNonStrings.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   760
    fontHeightBefore := fontHeight.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   761
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   762
152
claus
parents: 148
diff changeset
   763
    list notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   764
	expand ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   765
	    self expandTabs
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   766
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   767
	    scan ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   768
		includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   769
	    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   770
		includesNonStrings := nonStrings
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   771
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   772
	].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   773
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   774
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   775
	self getFontParameters.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   776
    ].
152
claus
parents: 148
diff changeset
   777
125
claus
parents: 121
diff changeset
   778
    widthOfWidestLine := nil.   "/ i.e. unknown
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   779
    oldFirst := firstLineShown.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   780
    oldLeft := leftOffset.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   781
    firstLineShown := 1.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   782
    leftOffset := 0.
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
   783
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   784
    realized ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   785
	(includesNonStrings ~~ nonStringsBefore) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   786
	    self computeNumberOfLinesShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   787
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   788
	self contentsChanged.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   789
	"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   790
	 dont use scroll here to avoid double redraw
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   791
	"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   792
	viewOrigin := 0 @ 0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   793
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   794
	oldFirst ~~ firstLineShown ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   795
	    self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   796
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   797
	shown ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   798
	    self redrawFromVisibleLine:1 to:nLinesShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   799
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   800
	    fontHeightBefore > fontHeight ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   801
		(self listLineIsVisible:(self size)) ifTrue:[
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   802
"/                    self clearRectangle:((margin @ (self yOfVisibleLine:nLinesShown+1))
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   803
"/                                        corner:(width-margin) @ (height-margin)).
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   804
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   805
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   806
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   807
    ]
153
claus
parents: 152
diff changeset
   808
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   809
    "Modified: / 30.8.1995 / 19:07:13 / claus"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   810
    "Created: / 5.6.1997 / 12:40:06 / cg"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   811
    "Modified: / 26.7.1998 / 13:47:35 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   812
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   813
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   814
removeIndex:lineNr
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   815
    "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
   816
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
   817
    |visLine w h x
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   818
     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
   819
75b8fb924904 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
    (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
   821
249
75b8fb924904 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
    "
75b8fb924904 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
     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
   824
    "
75b8fb924904 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
    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
   826
    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
   827
    visLine notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   828
	w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
1433
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   829
"/        x := textStartLeft.
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
   830
"/ CLAUS fixes leftOver selection pixels
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   831
	w := w + leftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   832
	x := margin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   833
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   834
	srcY := topMargin + (visLine * fontHeight).
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
   835
"/        h := ((nLinesShown - visLine) * fontHeight).
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   836
	h := (height - margin - srcY).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   837
	h > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   838
	    self catchExpose.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   839
	    self 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   840
		copyFrom:self 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   841
		x:x y:srcY
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   842
		toX:x y:(srcY - fontHeight)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   843
		width:w height:h
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   844
		async:true.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   845
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   846
	self redrawVisibleLine:nFullLinesShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   847
	"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   848
	 redraw last partial line - if any
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   849
	"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   850
	(nFullLinesShown ~~ nLinesShown) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   851
	    self redrawVisibleLine:nLinesShown
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   852
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   853
	h > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   854
	    self waitForExpose
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   855
	].
249
75b8fb924904 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
    ]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   857
1460
b9929a029249 dont bitBlt if height is <= 0
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
   858
    "Modified: / 27.2.1998 / 12:36:59 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   859
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   860
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   861
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
   862
    "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
   863
     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
   864
     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
   865
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   866
    (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
   867
    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
   868
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   869
    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
   870
	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
   871
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   872
    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
   873
    ^ 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
   874
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   875
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   876
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
   877
    "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
   878
     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
   879
     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
   880
     (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
   881
     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
   882
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   883
    |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
   884
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   885
    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
   886
    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
   887
    l notNil ifTrue:[
288
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   888
	l isString ifTrue:[
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   889
	    l := l asStringCollection
1185159943d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 267
diff changeset
   890
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   891
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   892
    self setList:l.
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   893
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   894
    "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
   895
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   896
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   897
setList:aCollection
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   898
    "set the contents (a collection of strings);
153
claus
parents: 152
diff changeset
   899
     do not change position (i.e. do not scroll).
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
   900
     This can be used to update a self-changing list 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   901
     (for example: a file list being shown, without disturbing user too much)"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   902
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   903
    ^ self setList:aCollection expandTabs:true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   904
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   905
153
claus
parents: 152
diff changeset
   906
setList:aCollection expandTabs:expandTabs
claus
parents: 152
diff changeset
   907
    "set the contents (a collection of strings);
claus
parents: 152
diff changeset
   908
     do not change position (i.e. do not scroll).
claus
parents: 152
diff changeset
   909
     This can be used to update a self-changing list 
claus
parents: 152
diff changeset
   910
     (for example: a file list being shown, without disturbing the user too much)"
claus
parents: 152
diff changeset
   911
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   912
    self setList:aCollection expandTabs:expandTabs redraw:true
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   913
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   914
    "Modified: / 22.4.1998 / 11:12:24 / cg"
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   915
!
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   916
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   917
setList:aCollection expandTabs:expandTabs redraw:doRedraw
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   918
    "set the contents (a collection of strings);
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   919
     do not change position (i.e. do not scroll).
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   920
     This can be used to update a self-changing list 
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   921
     (for example: a file list being shown, without disturbing the user too much)"
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   922
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   923
    |oldFirst nonStringsBefore linesShownBefore|
153
claus
parents: 152
diff changeset
   924
claus
parents: 152
diff changeset
   925
    (aCollection isNil and:[list isNil]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   926
	"no change"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   927
	^ self
153
claus
parents: 152
diff changeset
   928
    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   929
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   930
"/    list isNil ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   931
"/        linesShownBefore := (1 to:nLinesShown) collect:[:i | ''].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   932
"/    ] ifFalse:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   933
"/        linesShownBefore := (firstLineShown to:(firstLineShown+nLinesShown-1))
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   934
"/                            collect:[:i | (self at:i) ? ''].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   935
"/    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   936
153
claus
parents: 152
diff changeset
   937
    list := aCollection.
claus
parents: 152
diff changeset
   938
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   939
    nonStringsBefore := includesNonStrings.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   940
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   941
153
claus
parents: 152
diff changeset
   942
    list notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   943
	expandTabs ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   944
	    self expandTabs
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   945
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   946
	    includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   947
	].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   948
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   949
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   950
	self getFontParameters.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   951
	self computeNumberOfLinesShown.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   952
    ].
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   953
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   954
"/ 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
   955
    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
   956
    innerWidth >= self widthOfContents ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   957
	viewOrigin x:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   958
	leftOffset := 0.
153
claus
parents: 152
diff changeset
   959
    ].
claus
parents: 152
diff changeset
   960
    self contentsChanged.
claus
parents: 152
diff changeset
   961
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
   962
"/ new - reposition vertically if too big
153
claus
parents: 152
diff changeset
   963
    (firstLineShown + nFullLinesShown) > self size ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   964
	oldFirst := firstLineShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   965
	firstLineShown := self size - nFullLinesShown + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   966
	firstLineShown < 1 ifTrue:[firstLineShown := 1].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   967
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   968
	viewOrigin y:(firstLineShown - 1 * fontHeight).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   969
	self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   970
	linesShownBefore := nil.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   971
	shown ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   972
	    self clear.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   973
	]
153
claus
parents: 152
diff changeset
   974
    ].
claus
parents: 152
diff changeset
   975
"/ end new
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   976
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   977
    (shown and:[doRedraw]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   978
	  self redrawFromVisibleLine:1 to:nLinesShown
1101
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   979
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   980
"/        linesShownBefore isNil ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   981
"/            self redrawFromVisibleLine:1 to:nLinesShown
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   982
"/        ] ifFalse:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   983
"/            1 to:nLinesShown do:[:l |
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   984
"/                |oldLine newLine|
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   985
"/
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   986
"/                newLine := self visibleAt:l.
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   987
"/                newLine size == 0 ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   988
"/                    newLine := ''
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   989
"/                ].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   990
"/                oldLine := linesShownBefore at:l ifAbsent:nil.
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   991
"/                oldLine size == 0 ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   992
"/                    oldLine := ''
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   993
"/                ].
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   994
"/                oldLine ~= newLine ifTrue:[
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   995
"/                    self redrawVisibleLine:l
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   996
"/                ]
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   997
"/            ]
a38f49637175 oops - compare in #setList: does not work always ....
Claus Gittinger <cg@exept.de>
parents: 1099
diff changeset
   998
"/        ]
153
claus
parents: 152
diff changeset
   999
    ]
claus
parents: 152
diff changeset
  1000
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1001
    "Modified: / 18.12.1995 / 23:27:54 / stefan"
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1002
    "Created: / 22.4.1998 / 11:11:51 / cg"
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1003
    "Modified: / 26.7.1998 / 13:46:49 / cg"
153
claus
parents: 152
diff changeset
  1004
!
claus
parents: 152
diff changeset
  1005
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1006
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
  1007
    "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
  1008
     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
  1009
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1010
    ^ list size.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1011
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1012
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1013
stringAtLine:lineNr from:col1 to:col2
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1014
    "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
  1015
     including col2. 
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1016
     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
  1017
     Fills the string with space characters at the right.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1018
     (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
  1019
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1020
    |line len s|
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1021
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1022
    len := col2 - col1 + 1.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1023
    list notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1024
	line := self listAt:lineNr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1025
	line notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1026
	    (line size >= col1) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1027
		s := line copyFrom:col1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1028
		s size < len ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1029
		    ^ s paddedTo:len
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1030
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1031
		^ s copyTo:len
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1032
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1033
	]
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1034
    ].
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1035
    ^ String new:len withAll:Character space
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1036
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1037
    "Created: 7.1.1997 / 19:58:43 / cg"
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1038
!
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1039
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1040
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
  1041
    "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
  1042
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1043
    |w didIncludeNonStrings|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1044
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1045
    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
  1046
    list at:index put:aString.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1047
    didIncludeNonStrings := includesNonStrings.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1048
    includesNonStrings ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1049
	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
  1050
    ] ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1051
	(aString isNil or:[aString isString]) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1052
	    includesNonStrings := (list findFirst:[:l | l notNil and:[l isString not]]) ~~ 0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1053
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1054
    ].
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1055
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1056
    includesNonStrings ~~ didIncludeNonStrings ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1057
	self getFontParameters.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1058
	self computeNumberOfLinesShown
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1059
    ].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1060
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1061
    widthOfWidestLine notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1062
	aString isString ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1063
	    w := font widthOf:aString
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1064
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1065
	    w := aString widthOn:self
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1066
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1067
	w > widthOfWidestLine ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1068
	    widthOfWidestLine := w
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1069
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1070
	    widthOfWidestLine := nil "/ means: unknown
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1071
	].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1072
    ]
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1073
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1074
    "Modified: / 26.7.1998 / 13:00:14 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1075
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1076
118
claus
parents: 116
diff changeset
  1077
!ListView methodsFor:'accessing-mvc'!
claus
parents: 116
diff changeset
  1078
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1079
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
  1080
    "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
  1081
75b8fb924904 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
    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
  1083
    aDictionary at:#listMessage put:listMsg
118
claus
parents: 116
diff changeset
  1084
!
claus
parents: 116
diff changeset
  1085
125
claus
parents: 121
diff changeset
  1086
listMessage 
claus
parents: 121
diff changeset
  1087
    "return the listMsg selector; 
claus
parents: 121
diff changeset
  1088
     if non-nil, this is the message sent to the model (if any) to aquire
claus
parents: 121
diff changeset
  1089
     a new text upon change of the aspect.
120
claus
parents: 118
diff changeset
  1090
     This defaults to the aspect-selector."
118
claus
parents: 116
diff changeset
  1091
125
claus
parents: 121
diff changeset
  1092
    ^ listMsg
claus
parents: 121
diff changeset
  1093
!
claus
parents: 121
diff changeset
  1094
claus
parents: 121
diff changeset
  1095
listMessage:aSymbol 
claus
parents: 121
diff changeset
  1096
    "ST-80 compatibility: set the listMsg selector; 
claus
parents: 121
diff changeset
  1097
     if non-nil, this will be sent to the model (if any) to aquire a 
claus
parents: 121
diff changeset
  1098
     new text upon change of the aspect.
claus
parents: 121
diff changeset
  1099
     This defaults to the aspect-selector."
claus
parents: 121
diff changeset
  1100
claus
parents: 121
diff changeset
  1101
    listMsg := aSymbol.
120
claus
parents: 118
diff changeset
  1102
!
claus
parents: 118
diff changeset
  1103
907
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1104
model:aModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1105
    "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
  1106
     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
  1107
     changes."
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1108
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1109
    super model:aModel.
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1110
    self getListFromModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1111
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1112
    "Created: 31.12.1996 / 14:56:43 / stefan"
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1113
!
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1114
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1115
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
  1116
    "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
  1117
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1118
    ^ self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:nil 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1119
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1120
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1121
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
  1122
    "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
  1123
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1124
    ^self on:aModel aspect:aspectSymbol change:changeSymbol list:aspectSymbol menu:nil 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1125
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1126
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1127
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
  1128
    "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
  1129
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1130
    aspectSymbol notNil ifTrue:[aspectMsg := aspectSymbol. 
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1131
			     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
  1132
    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
  1133
    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
  1134
    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
  1135
    self model:aModel.
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1136
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1137
    "Modified: 2.1.1997 / 16:11:16 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1138
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1139
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1140
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
  1141
    "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
  1142
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1143
    ^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1144
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1145
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1146
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
  1147
    "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
  1148
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1149
    ^ self on:aModel aspect:aspectSymbol change:nil list:listSymbol menu:menuSymbol 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1150
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1151
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1152
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
  1153
    "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
  1154
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1155
    ^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
  1156
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1157
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1158
!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
  1159
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1160
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
  1161
    changedObject == model ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1162
	(aspectMsg notNil
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1163
	and:[something == aspectMsg]) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1164
	    ^ self getListFromModel.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1165
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1166
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1167
	something == #size ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1168
	    ^ self getListFromModelScroll:false.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1169
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1170
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1171
    ^ 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
  1172
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1173
    "Modified: 5.3.1997 / 16:14:01 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1174
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1175
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1176
!ListView methodsFor:'drawing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1177
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1178
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1179
    "draw a visible line range in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1180
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1181
    |y         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1182
     x         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1183
     startLine "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1184
     endLine   "{ Class: SmallInteger }"
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1185
     listSize e sH|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1186
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1187
    y := self yOfVisibleLine:startVisLineNr.
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1188
    sH := lineSpacing // 2.
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1189
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1190
    backgroundAlreadyClearedColor == bg ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1191
	self paint:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1192
	self fillRectangleX:margin 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1193
			  y:y-sH
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1194
		      width:(width - (margin * 2))
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1195
		     height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1196
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1197
    list isNil ifTrue:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1198
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1199
    y := y + fontAscent.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1200
    listSize := self size.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1201
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1202
    startLine := startVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1203
    endLine := endVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1204
    (startLine == 0) ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1205
	y := y + fontHeight.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1206
	startLine := startLine + 1
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1207
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1208
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1209
    (endLine > listSize) ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1210
	e := listSize
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1211
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1212
	e := endLine
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1213
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1214
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1215
    (startLine <= e) ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1216
	x := textStartLeft - leftOffset.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1217
	self paint:fg on:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1218
	self from:startLine to:e do:[:line |
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1219
	    line notNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1220
		self displayOpaqueString:line x:x y:y
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1221
	    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1222
	    y := y + fontHeight
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1223
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1224
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1225
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1226
    "Modified: / 3.10.1998 / 23:06:41 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1227
!
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  1228
131
claus
parents: 128
diff changeset
  1229
drawLine:line atX:x inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1230
    "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
  1231
     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
  1232
     Low level entry; not meant for public use."
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1233
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1234
    |y|
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1235
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1236
    y := self yOfVisibleLine:visLineNr.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1237
    backgroundAlreadyClearedColor == bg ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1238
	self paint:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1239
	self fillRectangleX:margin y:y - (lineSpacing//2)
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1240
		      width:(width - (2 * margin)) 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1241
		     height:fontHeight.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1242
    ].
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1243
    line notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1244
	self paint:fg on:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1245
	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
  1246
    ]
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1247
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1248
    "Modified: / 3.10.1998 / 23:05:17 / cg"
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1249
!
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1250
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1251
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
  1252
    "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
  1253
     given x position in fg/bg. Clears partial line before drawing the string.
131
claus
parents: 128
diff changeset
  1254
     Low level entry; not meant for public use."
claus
parents: 128
diff changeset
  1255
claus
parents: 128
diff changeset
  1256
    |y|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1257
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1258
    y := self yOfVisibleLine:visLineNr.
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1259
"/    self paint:bg.
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1260
"/    self fillRectangleX:x "margin" y:y - (lineSpacing//2)
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1261
"/                  width:(width - margin - x) 
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1262
"/                 height:fontHeight.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1263
    line notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1264
	self paint:fg on:bg.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1265
	self displayOpaqueString:line x:x y:(y + fontAscent)
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1266
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1267
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1268
    "Modified: 28.2.1996 / 18:36:33 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1269
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1270
131
claus
parents: 128
diff changeset
  1271
drawLine:line inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1272
    "draw a given string at visible lines position in fg/bg"
claus
parents: 128
diff changeset
  1273
claus
parents: 128
diff changeset
  1274
    self drawLine:line atX:(textStartLeft - leftOffset) inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  1275
!
claus
parents: 128
diff changeset
  1276
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1277
drawVisibleLine:visLineNr col:col with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1278
    "draw single character at col index of visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1279
1494
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1280
    |y yf x lineString characterString em|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1281
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1282
    lineString := self visibleAt:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1283
    x := (self xOfCol:col inVisibleLine:visLineNr) - leftOffset.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1284
    y := self yOfVisibleLine:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1285
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1286
    self paint:bg.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1287
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1288
    (lineString notNil and:[lineString isString not])
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  1289
    ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1290
	self drawVisibleLine:visLineNr with:fg and:bg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1291
    ] ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1292
	yf := y - (lineSpacing // 2).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1293
	col > lineString size ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1294
	    self fillRectangleX:x y:yf width:(font width) height:fontHeight.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1295
	    self paint:fg
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1296
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1297
	    characterString := lineString copyFrom:col to:col.
1494
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1298
"/            (em := characterString emphasis) notNil ifTrue:[
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1299
"/                em := em at:1.
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1300
"/                (Text emphasis:em includes:#italic) ifTrue:[
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1301
"/                    self paint:fg on:bg.
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1302
"/                    self displayOpaqueString:characterString x:x y:(y + fontAscent).
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1303
"/                    ^ self
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1304
"/                ]
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1305
"/            ].
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1306
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1307
	    self fillRectangleX:x y:yf 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1308
			  width:(font widthOf:characterString)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1309
			 height:fontHeight.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1310
	    self paint:fg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1311
	    self displayString:characterString x:x y:(y + fontAscent)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1312
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1313
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  1314
1494
0af9bd07aeda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
  1315
    "Modified: / 22.4.1998 / 09:13:32 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1316
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1317
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1318
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1319
    "draw part of a visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1320
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1321
    |y yf x lineString len characterString w sCol eCol|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1322
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1323
    (endCol >= startCol) ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1324
	sCol := startCol max:1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1325
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1326
	lineString := self visibleAt:visLineNr.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1327
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1328
	(lineString notNil and:[lineString isString not])
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1329
	ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1330
	    self drawVisibleLine:visLineNr with:fg and:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1331
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1332
	    x := (self xOfCol:sCol inVisibleLine:visLineNr) - leftOffset.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1333
	    y := (self yOfVisibleLine:visLineNr).
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1334
	    yf := y - (lineSpacing // 2).
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1335
	    len := lineString size.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1336
	    (sCol > len) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1337
		len := endCol - sCol + 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1338
		backgroundAlreadyClearedColor == bg ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1339
		    self paint:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1340
		    self fillRectangleX:x y:yf 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1341
				   width:(fontWidth * len) 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1342
				  height:fontHeight
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1343
		]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1344
	    ] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1345
		eCol := endCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1346
		(endCol > len) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1347
		    backgroundAlreadyClearedColor == bg ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1348
			characterString := lineString species new:endCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1349
			characterString replaceFrom:1 to:len with:lineString startingAt:1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1350
			lineString := characterString.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1351
		    ] ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1352
			eCol := len.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1353
		    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1354
		].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1355
		(lineString isMemberOf:String) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1356
		    fontIsFixedWidth ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1357
			w := (eCol - sCol + 1) * fontWidth
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1358
		    ] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1359
			w := font widthOf:lineString from:sCol to:eCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1360
		    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1361
		] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1362
		    w := (lineString copyFrom:sCol to:eCol) widthOn:self
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1363
		].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1364
		backgroundAlreadyClearedColor == bg ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1365
		    self paint:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1366
		    self fillRectangleX:x y:yf 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1367
				  width:w
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1368
				  height:fontHeight.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1369
		].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1370
		self paint:fg on:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1371
		self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1372
	    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1373
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1374
    ]
249
75b8fb924904 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
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1376
    "Modified: / 3.10.1998 / 22:59:41 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1377
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1378
249
75b8fb924904 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
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
  1380
    "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
  1381
75b8fb924904 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
    |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
  1383
75b8fb924904 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
    (startCol < 1) ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1385
	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
  1386
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1387
	index1 := startCol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1388
    ].
249
75b8fb924904 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
    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
  1390
    x := (self xOfCol:index1 inVisibleLine:visLineNr) - leftOffset.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1391
    backgroundAlreadyClearedColor == bg ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1392
	self paint:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1393
	self fillRectangleX:x y:y - (lineSpacing // 2)
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1394
		      width:(width + leftOffset - x)
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1395
		     height:fontHeight.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1396
    ].
249
75b8fb924904 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
    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
  1398
    lineString notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1399
	lineString isString ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1400
	    self drawVisibleLine:visLineNr with:fg and:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1401
	] ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1402
	    index2 := lineString size.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1403
	    (index2 < index1) ifTrue:[^ self].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1404
	    (index1 <= index2) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1405
		self paint:fg on:bg.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1406
		self displayOpaqueString:lineString from:index1 to:index2 x:x y:(y + fontAscent)
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1407
	    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  1408
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1409
    ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1410
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  1411
    "Modified: / 3.10.1998 / 23:07:56 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1412
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1413
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1414
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
  1415
    "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
  1416
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1417
    self 
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1418
	drawLine:(self visibleAt:visLineNr) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1419
	atX:(textStartLeft - leftOffset) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1420
	inVisible:visLineNr 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1421
	with:fg 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1422
	and:bg
427
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1423
a75bc351b17f slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
  1424
    "Modified: 28.2.1996 / 19:30:23 / cg"
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1425
!
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1426
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1427
fillRectangleX:x y:y width:w height:h
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1428
    "fill rectangle; checks whether the rectangle already is filled with
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1429
     the current paint (#redrawX:y:w:h).
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1430
    "
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1431
    backgroundAlreadyClearedColor ~~ paint ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1432
	super fillRectangleX:x y:y width:w height:h
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1433
    ]
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1434
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1435
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1436
!
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1437
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1438
invalidateLine:line
1466
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1439
    "invalidate the area of a single line.
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1440
     This arranges for that line to be redrawn asynchronously (later).
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1441
     If multiple such invalidations arrive, those areas may be lumped
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1442
     together for a block update.
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1443
     The update takes place when the windowGroup process gets a chance to
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1444
     process expose events."
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1445
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1446
    |yTop visLineNr|
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1447
 
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1448
    visLineNr := self listLineToVisibleLine:line.
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1449
    visLineNr notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1450
	yTop := self yOfVisibleLine:visLineNr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1451
	yTop isNil ifTrue:[^ self]. "/ not visible
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1452
	(yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1453
	self invalidate:(Rectangle 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1454
			    left:margin top:yTop 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1455
			    width:(width - (2 * margin)) height:fontHeight).
1465
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1456
    ]
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1457
7832492b8443 added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1458
    "Created: / 5.3.1998 / 01:24:19 / cg"
1466
fd077de6285d comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents: 1465
diff changeset
  1459
    "Modified: / 5.3.1998 / 13:41:31 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1460
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1461
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1462
!ListView methodsFor:'event processing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1463
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1464
contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1465
    "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
  1466
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1467
    |listSize newOrigin|
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1468
890
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1469
    shown ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1470
	list notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1471
	    listSize := self numberOfLines.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1472
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1473
	    listSize == 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1474
		widthOfWidestLine := 0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1475
	    ].
990
c466fa72c6e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 986
diff changeset
  1476
        
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1477
	    "
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1478
	     if we are beyond the end, scroll up a bit
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1479
	    "
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1480
	    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1481
		newOrigin := listSize - nFullLinesShown + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1482
		newOrigin < 1 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1483
		    newOrigin := 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1484
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1485
		self scrollToLine: newOrigin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1486
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1487
	].
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1488
    ].
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1489
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1490
    ^ super contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1491
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1492
    "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
  1493
    "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
  1494
!
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1495
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1496
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
  1497
    "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
  1498
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1499
    <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
  1500
			  #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
  1501
			  #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
  1502
    |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
  1503
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1504
    (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
  1505
    (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
  1506
    (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
  1507
    (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
  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
    (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
  1510
    (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
  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
    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
  1513
    (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
  1514
	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
  1515
	    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
  1516
	] 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
  1517
	    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
  1518
	].
75b8fb924904 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
	^ 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
  1520
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1521
    (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
  1522
	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
  1523
	    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
  1524
	] 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
  1525
	    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
  1526
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1527
	^ 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
  1528
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1529
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1530
    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
  1531
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1532
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1533
redrawX:x y:y width:w height:h
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1534
    "a region must be redrawn"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1535
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1536
    |startCol endCol line saveClip
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1537
     startLine "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1538
     stopLine  "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1539
    |
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1540
127
claus
parents: 125
diff changeset
  1541
    shown ifFalse:[^ self].
claus
parents: 125
diff changeset
  1542
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1543
    startLine := self visibleLineOfY:y.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1544
    stopLine := self visibleLineOfY:(y + h).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1545
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1546
    saveClip := clipRect.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1547
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1548
    self paint:bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1549
    self fillRectangleX:x y:y width:w height:h.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1550
    backgroundAlreadyClearedColor := bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1551
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1552
    (includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1553
	"includes non strings or area is big enough redraw whole lines"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1554
	self redrawFromVisibleLine:startLine to:stopLine
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1555
    ] ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1556
	line := self visibleAt:startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1557
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1558
	(fontIsFixedWidth and:[line isMemberOf:String]) ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1559
	    "start/end col has to be computed for each line"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1560
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1561
	    startLine to:stopLine do:[:i |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1562
		startCol := self colOfX:x inVisibleLine:i.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1563
		endCol := self colOfX:(x + w) inVisibleLine:i.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1564
		startCol > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1565
		    endCol > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1566
			self redrawVisibleLine:i from:startCol to:endCol
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1567
		    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1568
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1569
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1570
	] ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1571
	    "start/end col is the same for all lines"
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1572
	    startCol := self colOfX:x inVisibleLine:startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1573
	    endCol := self colOfX:(x + w) inVisibleLine:startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1574
	    startCol > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1575
		endCol > 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1576
		    startLine to:stopLine do:[:i |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1577
			line := self visibleAt:i.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1578
			(line isMemberOf:String) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1579
			    self redrawVisibleLine:i from:startCol to:endCol
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1580
			] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1581
			    self redrawVisibleLine:i
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1582
			]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1583
		    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1584
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1585
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1586
	]
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1587
    ].
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1588
    backgroundAlreadyClearedColor := nil.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  1589
    self clippingRectangle:saveClip.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1590
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1591
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1592
sizeChanged:how
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1593
    "size changed - move origin up if possible"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1594
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1595
    |listSize newOrigin|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1596
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1597
    super sizeChanged:how.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
  1598
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1599
    self computeNumberOfLinesShown.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1600
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1601
    innerWidth := width - textStartLeft - margin.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1602
    shown ifFalse:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1603
    list isNil ifTrue:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1604
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1605
"/    how ~~ #smaller ifTrue:[
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1606
"/        self invalidate 
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1607
"/    ].
643
89c06c80ff2a redraw in sizeChange
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
  1608
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1609
    listSize := self numberOfLines.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1610
    "
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  1611
     if we are beyond the end, scroll up a bit
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1612
    "
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1613
    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1614
	newOrigin := listSize - nFullLinesShown + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1615
	newOrigin < 1 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1616
	    newOrigin := 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1617
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1618
	self scrollToLine: newOrigin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1619
	^ self
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1620
    ].
643
89c06c80ff2a redraw in sizeChange
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
  1621
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  1622
    "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
  1623
    "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
  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
75b8fb924904 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
!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
  1627
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1628
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
  1629
    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
  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
    "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
  1632
    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
  1633
    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
  1634
    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
  1635
    bgColor := bgColor on:device
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1636
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1637
249
75b8fb924904 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
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
  1639
    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
  1640
    ^ 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
  1641
!
75b8fb924904 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
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1643
fetchDeviceResources
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1644
    "fetch device colors, to avoid reallocation at redraw time"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1645
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1646
    super fetchDeviceResources.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1647
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1648
    fgColor notNil ifTrue:[fgColor := fgColor on:device].
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1649
    bgColor notNil ifTrue:[bgColor := bgColor on:device].
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1650
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1651
    "Created: 14.1.1997 / 00:12:12 / cg"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1652
!
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1653
249
75b8fb924904 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
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1655
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1656
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1657
    |n|
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1658
249
75b8fb924904 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
    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
  1660
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1661
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device]
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
  1662
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1663
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1664
    n isInteger ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1665
	n := (self verticalPixelPerMillimeter:n) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1666
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1667
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1668
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1669
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1670
    n isInteger ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1671
	n := (self verticalPixelPerMillimeter:n) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1672
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1673
    self leftMargin:n.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1674
75b8fb924904 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
    lineSpacing := 0.
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1676
    fgColor := DefaultForegroundColor.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  1677
    bgColor := DefaultBackgroundColor.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  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
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
  1681
    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
  1682
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1683
    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
  1684
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1685
    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
  1686
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1687
    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
  1688
    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
  1689
    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
  1690
    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
  1691
    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
  1692
    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
  1693
    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
  1694
    tabPositions := DefaultTabPositions.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1695
    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
  1696
    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
  1697
    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
  1698
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1699
    autoScroll := true.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1700
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1701
    "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
  1702
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1703
75b8fb924904 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
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
  1705
    |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
  1706
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1707
    extentChanged ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1708
	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
  1709
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1710
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1711
    firstLineShown ~~ 1 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1712
	sz := self size.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1713
	firstLineShown + nLinesShown > sz ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1714
	    self scrollToLine:sz - nLinesShown.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1715
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1716
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1717
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1718
    super realize.
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1719
1081
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1720
"/ old: fetch models value on realize;
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1721
"/ 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
  1722
"/
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1723
"/    model notNil ifTrue:[
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1724
"/        self getListFromModel.
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  1725
"/    ]
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  1726
825
d115a0923b7d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 820
diff changeset
  1727
    "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
  1728
    "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
  1729
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1730
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1731
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
  1732
    "recreate after a snapin"
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1733
    |n|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1734
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1735
    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
  1736
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1737
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1738
     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
  1739
     - 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
  1740
    "
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1741
"/    topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1742
"/    self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1743
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1744
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1745
    n isInteger ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1746
	n := (self verticalPixelPerMillimeter:n) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1747
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1748
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1749
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1750
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1751
    n isInteger ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1752
	n := (self verticalPixelPerMillimeter:n) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1753
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1754
    self leftMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1755
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1756
    self getFontParameters
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1757
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1758
    "Modified: / 26.9.1998 / 17:09:32 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  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
75b8fb924904 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
!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
  1762
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1763
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
  1764
    "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
  1765
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1766
    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
  1767
    (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
  1768
    (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
  1769
    ^ 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
  1770
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1771
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1772
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
  1773
    "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
  1774
     - 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
  1775
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1776
    |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
  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
    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
  1779
    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
  1780
    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
  1781
	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
  1782
	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
  1783
	    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
  1784
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1785
	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
  1786
    ].
75b8fb924904 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
    ^ 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
  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
!
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1791
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
  1792
    "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
  1793
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1794
    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
  1795
	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
  1796
	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
  1797
    ] 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
  1798
	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
  1799
	    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
  1800
	    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
  1801
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1802
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1803
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1804
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1805
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
  1806
    "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
  1807
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1808
    |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
  1809
     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
  1810
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1811
    xRel := x - textStartLeft + leftOffset.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1812
    (xRel <= 0) ifTrue:[^ 1].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1813
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1814
    lineString := self visibleAt:visLineNr.
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1815
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1816
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1817
     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
  1818
    "
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1819
    (fontIsFixedWidth 
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1820
    and:[lineString isNil
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1821
	 or:[lineString isMemberOf:String]]) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1822
	^ (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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1825
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1826
     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
  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
    lineString notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1829
	lineString := lineString asString.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1830
	(hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1831
	    linePixelWidth := lineString widthOn:self
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1832
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1833
	    lineString := lineString string.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1834
	    linePixelWidth := font widthOf:lineString.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1835
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1836
    ] ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1837
	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
  1838
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1839
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1840
    (linePixelWidth <= xRel) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1841
	fontWidth == 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1842
	    "
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1843
	     although this 'cannot happen',
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1844
	     it seems that X reports this width for some strange fonts ...
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1845
	    "
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1846
	    ^ lineString size   
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1847
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1848
	^ 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
  1849
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1850
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1851
    "/ cannot simply count individual characters,
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1852
    "/ 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
  1853
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1854
    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
  1855
    (runCol == 0) ifTrue:[runCol := 1].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1856
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1857
    hasEmphasis ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1858
	posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1859
	posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1860
    ] ifFalse:[    
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1861
	posLeft := font widthOf:lineString from:1 to:(runCol - 1).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1862
	posRight := font widthOf:lineString from:1 to:runCol.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1863
    ].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1864
249
75b8fb924904 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
    done := (posLeft <= xRel) and:[posRight > xRel].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1866
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1867
    [done] whileFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1868
	oPosRight := posRight.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1869
	oPosLeft := posLeft.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1870
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1871
	(posRight <= xRel) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1872
	    runCol := runCol + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1873
	    posLeft := posRight.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1874
	    hasEmphasis ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1875
		posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1876
	    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1877
		posRight := font widthOf:lineString from:1 to:runCol
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1878
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1879
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1880
	    (posLeft > xRel) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1881
		runCol := runCol - 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1882
		(runCol == 0) ifTrue:[^ 0].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1883
		posRight := posLeft.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1884
		hasEmphasis ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1885
		    posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1886
		] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1887
		    posLeft := font widthOf:lineString from:1 to:(runCol - 1)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1888
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1889
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1890
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1891
	done := (posLeft <= xRel) and:[posRight > xRel].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1892
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1893
	((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1894
	    "/ paranoia: just in case there are unprintable characters
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1895
	    "/ (avoid endless loop if the binary search does not make progress)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1896
	    done := true.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1897
	 ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1898
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1899
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1900
    ^ runCol
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  1901
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  1902
    "Modified: / 3.9.1998 / 21:55:41 / 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
  1903
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1904
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1905
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
  1906
    "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
  1907
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1908
    |innerHeight|
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1909
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1910
    innerHeight := self innerHeight.
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1911
    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
  1912
    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
  1913
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1914
    partialLines ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1915
	((nLinesShown * fontHeight) < innerHeight) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1916
	    nLinesShown := nLinesShown + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1917
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1918
    ]
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1919
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  1920
    "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
  1921
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1922
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1923
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
  1924
    "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
  1925
     - 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
  1926
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1927
    |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
  1928
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1929
    self obsoleteMethodWarning.
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1930
249
75b8fb924904 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
    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
  1932
    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
  1933
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1934
    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
  1935
    aList do:[:line |
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1936
	((line size == 0) or:[line isBlank]) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1937
	    newList add:newLine.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1938
	    newLine := ''
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1939
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1940
	    special := ((line at:1) == ${) or:[(line includes:$\)].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1941
	    special := special or:[(line at:1) == $}].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1942
	    special ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1943
		newList add:(newLine , line)
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1944
	    ] ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1945
		charIndex := 1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1946
		[charIndex <= line size] whileTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1947
		    char := line at:charIndex.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1948
		    ((char == ${ ) or:[char == $} ]) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1949
			"left-brace: ignore rest of line"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1950
			charIndex := line size + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1951
		    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1952
			(char == $\) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1953
			    inEscape := true
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1954
			] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1955
			    inEscape ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1956
				(char == Character space) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1957
				    inEscape := false
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1958
				]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1959
			    ] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1960
				newLine := newLine copyWith:char
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1961
			    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1962
			].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1963
			charIndex := charIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1964
		    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1965
		]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1966
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  1967
	]
249
75b8fb924904 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
    ^ newList
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1970
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1971
    "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
  1972
!
75b8fb924904 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
getFontParameters
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  1975
    "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
  1976
     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
  1977
     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
  1978
     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
  1979
     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
  1980
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1981
    |hMax|
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1982
249
75b8fb924904 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
    font := font on:device.
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1984
    hMax := font height.
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  1985
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1986
    includesNonStrings == true ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1987
	"/
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1988
	"/ find maximum height of lines
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1989
	"/
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1990
	hMax := list inject:hMax into:[:maxSoFar :thisLine | 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1991
					thisLine isNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1992
					    maxSoFar
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1993
					] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1994
					    (thisLine isMemberOf:String) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1995
						maxSoFar
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1996
					    ] ifFalse:[   
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1997
						maxSoFar max:(thisLine heightOn:self)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1998
					    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  1999
					]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2000
			      ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2001
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2002
    ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2003
    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
  2004
    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
  2005
    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
  2006
    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
  2007
1260
5a548d4c6724 handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
  2008
    "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
  2009
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2010
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2011
getListFromModel
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2012
    "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
  2013
     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
  2014
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2015
    |text msg|
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2016
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2017
    model notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2018
	msg := listMsg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2019
	msg isNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2020
	    msg := aspectMsg
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2021
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2022
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2023
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2024
	msg notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2025
	    text := model perform:msg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2026
	    text notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2027
		text := text asStringCollection.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2028
	    ].
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2029
"/ 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
  2030
"/ as the view!!
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2031
"/            text ~= list ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2032
		self list:text
1027
fe7279540aa5 Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents: 993
diff changeset
  2033
"/            ].
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2034
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2035
    ].
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2036
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2037
    "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
  2038
    "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
  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
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2041
getListFromModelScroll:aBoolean
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2042
    "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
  2043
     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
  2044
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2045
    |text msg|
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2046
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2047
    model notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2048
	msg := listMsg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2049
	msg isNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2050
	    msg := aspectMsg
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2051
	].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2052
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2053
	msg notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2054
	    text := model perform:msg.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2055
	    text notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2056
		text := text asStringCollection.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2057
	    ].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2058
"/ 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
  2059
"/ as the view!!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2060
"/            text ~= list ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2061
		aBoolean ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2062
		    self list:text
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2063
		] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2064
		    self setList:text
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2065
		]
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2066
"/            ].
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2067
	].
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2068
    ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2069
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2070
    "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
  2071
    "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
  2072
    "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
  2073
!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2074
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2075
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
  2076
    "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
  2077
     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
  2078
     - 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
  2079
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2080
    |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
  2081
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2082
    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
  2083
    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
  2084
    lastLine := self size.
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2085
    [(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2086
	sum := sum + (self at:lineNr) size + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2087
	lineNr := lineNr + 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2088
    ].
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2089
    sum == charPos ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2090
	^ lineNr
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2091
    ].
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2092
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2093
    ^ lineNr - 1
1479
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2094
f0c3e77e03b6 fixed #lineOfCharacterPosition: (for last character pos)
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  2095
    "Modified: / 5.4.1998 / 17:19:28 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  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
75b8fb924904 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
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
  2099
    "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
  2100
     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
  2101
     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
  2102
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2103
    |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
  2104
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2105
    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
  2106
    (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
  2107
    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
  2108
    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
  2109
    ^ 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
  2110
75b8fb924904 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
    "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
  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
75b8fb924904 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
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
  2115
    "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
  2116
75b8fb924904 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
    |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
  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
    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
  2120
    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
  2121
    (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
  2122
    ^ 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
  2123
!
75b8fb924904 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
75b8fb924904 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
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
  2126
    "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
  2127
75b8fb924904 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
    |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
  2129
75b8fb924904 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
    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
  2131
    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
  2132
    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
  2133
    (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
  2134
    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
  2135
    (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
  2136
    ^ 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
  2137
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2138
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2139
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
  2140
    "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
  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
    |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
  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
    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
  2145
    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
  2146
    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
  2147
    (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
  2148
    ^ 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
  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
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2151
listLineIsVisible:listLineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2152
    "return true,  if a particular line is visible"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2153
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2154
    |visibleLineNr "{ Class: SmallInteger }"|
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2155
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2156
    shown ifFalse:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2157
    listLineNr isNil ifTrue:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2158
    visibleLineNr := listLineNr + 1 - firstLineShown.
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2159
    ^ (visibleLineNr between:1 and:nLinesShown)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2160
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2161
    "Created: / 26.7.1998 / 13:24:16 / cg"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2162
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2163
249
75b8fb924904 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
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
  2165
    "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
  2166
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2167
    |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
  2168
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2169
    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
  2170
    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
  2171
    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
  2172
    (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
  2173
    ^ 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
  2174
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2175
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2176
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
  2177
    "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
  2178
     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
  2179
     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
  2180
75b8fb924904 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
    |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
  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
    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
  2184
    (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
  2185
    (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
  2186
	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
  2187
    ] 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
  2188
	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
  2189
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2190
    (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
  2191
    ^ ''
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2192
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2193
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2194
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
  2195
    "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
  2196
     - 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
  2197
1448
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2198
    ^ (((y - textStartTop) // fontHeight) + 1) max:1
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2199
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  2200
    "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
  2201
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2202
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2203
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
  2204
    "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
  2205
75b8fb924904 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
    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
  2207
    ^ 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
  2208
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2209
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2210
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
  2211
    "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
  2212
     (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
  2213
     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
  2214
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2215
    |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
  2216
     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
  2217
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2218
    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
  2219
    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
  2220
    (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
  2221
    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
  2222
    (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
  2223
    ^ 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
  2224
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2225
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2226
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
  2227
    "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
  2228
     - 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
  2229
     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
  2230
     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
  2231
75b8fb924904 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
    |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
  2233
957
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2234
    ^ innerWidth
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2235
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2236
"/    "for small width, its not worth searching for
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2237
"/     longest line ...
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2238
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2239
"/    (width < 300) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2240
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2241
"/    "for large lists, search may take longer than scrolling full
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2242
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2243
"/    self size > 2000 ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2244
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2245
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2246
"/     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
  2247
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2248
"/    (viewBackground isColor not
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2249
"/     or:[viewBackground isDithered]) ifTrue:[
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2250
"/        ^ width
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2251
"/    ].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2252
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2253
"/    w := self widthOfWidestLineBetween:firstLine and:lastLine.
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2254
"/    (w > innerWidth) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2255
"/    ^ w
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2256
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  2257
    "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
  2258
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2259
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2260
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
  2261
    "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
  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
    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
  2264
    entry isString ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2265
	^ 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
  2266
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2267
    ^ entry widthOn:self
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2268
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2269
    "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
  2270
!
75b8fb924904 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
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
  2273
    "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
  2274
     - 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
  2275
75b8fb924904 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
    |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
  2277
     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
  2278
     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
  2279
     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
  2280
     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
  2281
75b8fb924904 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
    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
  2283
	^ 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
  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
75b8fb924904 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
    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
  2287
	^ (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
  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
    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
  2290
    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
  2291
    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
  2292
    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
  2293
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2294
    (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
  2295
    (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
  2296
	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
  2297
    ].
75b8fb924904 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
    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
  2300
	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
  2301
	    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
  2302
	    (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
  2303
		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
  2304
	    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2305
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2306
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2307
    ^ 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
  2308
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2309
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2310
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
  2311
    "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
  2312
75b8fb924904 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
    |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
  2314
75b8fb924904 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
    tcol := col - 1.
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2316
    line := self visibleAt:visLineNr.
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2317
    (fontIsFixedWidth 
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2318
    and:[line isNil
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2319
	 or:[line isMemberOf:String]]) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2320
	^ (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
  2321
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2322
    line notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2323
	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
  2324
    ] ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2325
	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
  2326
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2327
    (lineSize == 0) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2328
	^ (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
  2329
    ].
798
9ab00cb0d9d3 handle Text items in xOfCol...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  2330
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2331
    (lineSize < col) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2332
	^ (line widthOn:self) 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2333
	  + (fontWidth * (tcol - lineSize)) 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2334
	  + 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
  2335
    ].
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2336
    (line isMemberOf:String) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2337
	^ (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
  2338
    ].
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2339
    ^ ((line copyTo:tcol) widthOn:self) + textStartLeft
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2340
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2341
    "Modified: / 3.9.1998 / 21:56:33 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2342
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2343
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2344
yOfLine:lineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2345
    "given a physical lineNr, return y-coordinate in view
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2346
     - works for fix-height fonts only"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2347
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2348
    ^ self yOfVisibleLine:(self listLineToVisibleLine:lineNr)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2349
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2350
    "Created: / 26.7.1998 / 13:23:16 / cg"
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2351
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  2352
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2353
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
  2354
    "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
  2355
     - 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
  2356
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2357
    ^ ((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
  2358
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2359
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2360
!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
  2361
1525
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2362
currentLine
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2363
    "the current line (for relative gotos); 
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2364
     since listViews have no cursor, the first shown line is returned here.
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2365
     Redefined in editTextView, to return the cursors line."
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2366
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2367
    ^ firstLineShown
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2368
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2369
    "Created: / 17.5.1998 / 20:07:36 / cg"
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2370
!
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  2371
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2372
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
  2373
    "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
  2374
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2375
    ^ 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
  2376
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2377
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2378
heightForLines:numberOfLines
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2379
    "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
  2380
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2381
    "need a device font for query"
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2382
    font := font on:device.
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2383
    ^ 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
  2384
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2385
    "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
  2386
!
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  2387
249
75b8fb924904 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
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
  2389
    "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
  2390
     - 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
  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
    | 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
  2393
75b8fb924904 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
    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
  2395
    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
  2396
75b8fb924904 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
    "/ 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
  2399
    "/
75b8fb924904 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
"/    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
  2401
"/        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
  2402
"/    ].
75b8fb924904 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
     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
  2405
    "
75b8fb924904 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
    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
  2407
    ^ 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
  2408
"/                            + textStartTop
1773
1e941ac6f4cb add some to heightOfContents,
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
  2409
                            - (lineSpacing // 2)
1e941ac6f4cb add some to heightOfContents,
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
  2410
                            + (font descent)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2411
"/                            + (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
  2412
"/                            + (font descent * 2) "makes it look better"
1773
1e941ac6f4cb add some to heightOfContents,
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
  2413
                                .
249
75b8fb924904 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
"/    "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
  2416
"/    (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
  2417
"/        ^ 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
  2418
"/    ].
75b8fb924904 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
"/    "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
  2420
"/     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
  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
"/    ^ (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
  2423
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2424
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2425
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
  2426
    "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
  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
    ^ 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
  2429
!
75b8fb924904 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
75b8fb924904 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
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
  2432
    "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
  2433
     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
  2434
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2435
    |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
  2436
75b8fb924904 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
    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
  2438
    lineString notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2439
	indent := lineString leftIndent.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2440
	indent == lineString size ifTrue:[^ 0].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  2441
	^ 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
  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
    ^ 0
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2444
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  2445
    "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
  2446
!
75b8fb924904 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
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
  2449
    "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
  2450
75b8fb924904 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
    ^ 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
  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
75b8fb924904 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
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
  2455
    "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
  2456
75b8fb924904 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
    |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
  2458
     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
  2459
     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
  2460
     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
  2461
     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
  2462
75b8fb924904 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
    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
  2464
75b8fb924904 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
    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
  2466
    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
  2467
    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
  2468
    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
  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
    (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
  2471
    (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
  2472
	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
  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
    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
  2475
	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
  2476
	    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
  2477
	    (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
  2478
		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
  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
    ^ 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
  2483
75b8fb924904 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
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2486
lineIsFullyVisible:line
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2487
    "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
  2488
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2489
    (line >= firstLineShown
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2490
     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
  2491
    ^ false.
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2492
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2493
    "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
  2494
!
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2495
249
75b8fb924904 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
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
  2497
    "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
  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
    (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
  2500
    ^ 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
  2501
!
75b8fb924904 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
75b8fb924904 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
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
  2504
    "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
  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
    ^ 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
  2507
!
75b8fb924904 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
678
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2509
preferredExtentForLines:numLines cols:numCols
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2510
    ^ (((font widthOf:'x') * numCols + margin + margin) 
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2511
      @ 
688
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2512
      (fontHeight * numLines + margin + margin + font descent + lineSpacing + topMargin)).
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2513
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  2514
    "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
  2515
!
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  2516
249
75b8fb924904 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
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
  2518
    "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
  2519
     - 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
  2520
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2521
    |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
  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
    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
  2524
    widthOfWidestLine notNil ifTrue:[^ widthOfWidestLine + (leftMargin * 2)].
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2525
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2526
    device isNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2527
	"/ mhmh - really dont know yet
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2528
	f := font on:Screen current
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2529
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2530
	f := font := font on:device.
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2531
    ].
249
75b8fb924904 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
75b8fb924904 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
    includesNonStrings ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2534
	max := list 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2535
		   inject:0 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2536
		   into:[:maxSoFar :entry |
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2537
			     (
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2538
				 entry isNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2539
				     0
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2540
				 ] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2541
				    entry isString ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2542
					f widthOf:entry
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2543
				    ] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2544
					entry widthOn:self
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2545
				    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2546
				 ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2547
			     ) max:maxSoFar.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2548
			]
249
75b8fb924904 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
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2550
	false "fontIsFixedWidth" ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2551
	    max := self lengthOfLongestLine * fontWidth
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2552
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2553
	    max := 0.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2554
	    list notNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2555
		list do:[:line |
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2556
		    line notNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2557
			max := max max:(line widthOn:self)
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2558
		    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2559
		].
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  2560
"/                max := max max:(f widthOf:list)
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2561
	    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2562
	].
249
75b8fb924904 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
    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
  2565
    ^ max + (leftMargin * 2)
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  2566
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  2567
    "Modified: / 24.9.1998 / 18:21:08 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2568
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2569
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2570
widthOfLine:lineNr
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2571
    "return the width of a line in pixels"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2572
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2573
    |line f|
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2574
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2575
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2576
    lineNr > list size ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2577
    line := list at:lineNr.
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2578
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2579
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2580
    device isNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2581
	"/ mhmh - really dont know yet
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2582
	f := font on:Screen current
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2583
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2584
	f := font := font on:device.
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2585
    ].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2586
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2587
    line isString ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2588
	^ f widthOf:line
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2589
    ].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2590
    ^ line widthOn:self
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2591
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2592
    "Created: / 10.11.1998 / 23:59:20 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2593
    "Modified: / 11.11.1998 / 15:25:07 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2594
!
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  2595
249
75b8fb924904 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
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
  2597
    "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
  2598
     - 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
  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
    ^ 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
  2601
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2602
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2603
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
  2604
    "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
  2605
     - 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
  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
    ^ (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
  2608
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2609
75b8fb924904 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
!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
  2611
75b8fb924904 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
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
  2613
    "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
  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
    self redrawInverted.
292
f46dea5bdd51 use new Delay wait
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
  2616
    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
  2617
    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
  2618
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2619
    "
75b8fb924904 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
     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
  2621
     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
  2622
     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
  2623
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2624
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2625
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2626
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
  2627
    "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
  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
    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
  2630
	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
  2631
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2632
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2633
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2634
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
  2635
    "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
  2636
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2637
    |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
  2638
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2639
    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
  2640
	"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
  2641
	 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
  2642
	(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
  2643
	    first := firstLineShown
125
claus
parents: 121
diff changeset
  2644
	] 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
  2645
	    first := lineNr
125
claus
parents: 121
diff changeset
  2646
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2647
	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
  2648
	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
  2649
	    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
  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
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2652
!
75b8fb924904 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
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
  2655
    "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
  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
    |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
  2658
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2659
    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
  2660
	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
  2661
	(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
  2662
	    (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
  2663
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2664
		"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
  2665
		 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
  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
		(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
  2668
		    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
  2669
		] 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
  2670
		    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
  2671
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2672
		(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
  2673
		    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
  2674
		] 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
  2675
		    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
  2676
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2677
		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
  2678
		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
  2679
		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
  2680
	    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2681
	]
75b8fb924904 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
!
75b8fb924904 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
75b8fb924904 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
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
  2686
    "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
  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
    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
  2689
	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
  2690
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2691
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2692
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2693
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
  2694
    "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
  2695
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2696
    |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
  2697
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2698
    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
  2699
    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
  2700
    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
  2701
    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
  2702
    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
  2703
    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
  2704
    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
  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
75b8fb924904 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
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
  2708
    "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
  2709
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2710
    |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
  2711
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2712
    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
  2713
    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
  2714
	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
  2715
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2716
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2717
75b8fb924904 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
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
  2719
    "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
  2720
75b8fb924904 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
    |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
  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
    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
  2724
    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
  2725
	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
  2726
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2727
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2728
75b8fb924904 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
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
  2730
    "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
  2731
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2732
    |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
  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
    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
  2735
    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
  2736
	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
  2737
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2738
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2739
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2740
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
  2741
    "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
  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
    |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
  2744
75b8fb924904 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
    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
  2746
    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
  2747
	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
  2748
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2749
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2750
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2751
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
  2752
    "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
  2753
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2754
    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
  2755
	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
  2756
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2757
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2758
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2759
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
  2760
    "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
  2761
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2762
    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
  2763
	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
  2764
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2765
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2766
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2767
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
  2768
    "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
  2769
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2770
    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
  2771
	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
  2772
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2773
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2774
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2775
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
  2776
    "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
  2777
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2778
    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
  2779
	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
  2780
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2781
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2782
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2783
!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
  2784
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2785
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
  2786
    "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
  2787
     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
  2788
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2789
    ^ 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
  2790
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2791
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2792
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
  2793
    "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
  2794
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2795
    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
  2796
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2797
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2798
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
  2799
    "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
  2800
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2801
    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
  2802
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2803
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2804
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
  2805
    "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
  2806
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2807
    |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
  2808
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2809
    (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
  2810
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2811
    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
  2812
    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
  2813
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2814
    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
  2815
    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
  2816
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2817
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2818
     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
  2819
     (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
  2820
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2821
"/    ((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
  2822
"/        ^ 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
  2823
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2824
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2825
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2826
     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
  2827
     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
  2828
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2829
    (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
  2830
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2831
    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
  2832
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2833
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2834
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
  2835
    "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
  2836
     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
  2837
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2838
    |bott newTopLine|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2839
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2840
    (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
  2841
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2842
"/  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
  2843
"/      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
  2844
"/      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
  2845
"/
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2846
"/    shown ifFalse:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2847
"/        firstLineShown := (aListLineNr - 1) max:1.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2848
"/        firstLineShown > (list size - nFullLinesShown) ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2849
"/            firstLineShown := list size - nFullLinesShown
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2850
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2851
"/        list size <= nFullLinesShown ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2852
"/            firstLineShown := 1
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2853
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2854
"/        ^ self
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  2855
"/    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2856
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2857
    (self needScrollToMakeLine:aListLineNr) ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2858
	^ self
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2859
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2860
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2861
    (aListLineNr < nFullLinesShown) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2862
	"/ at the very top of the list - show from top
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2863
	newTopLine := 1
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2864
    ] ifFalse:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2865
	(nFullLinesShown < 3) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2866
	    "/ a small view - show from that line
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2867
	    newTopLine := aListLineNr
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2868
	] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2869
	    bott := self numberOfLines - (nFullLinesShown - 1).
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2870
	    (aListLineNr > bott) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2871
		"/ at the end of the list - show the bottom of the list
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2872
		newTopLine := bott
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2873
	    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2874
		"/ somewhere else - place selected line into the middle of
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2875
		"/ the view
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2876
		newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1)
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2877
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2878
	]
249
75b8fb924904 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
    ].
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2880
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2881
    self scrollToLine:newTopLine.
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2882
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2883
    "Modified: / 18.12.1996 / 17:48:22 / stefan"
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2884
    "Modified: / 7.8.1998 / 15:14:12 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2885
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2886
75b8fb924904 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
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
  2888
    "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
  2889
     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
  2890
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2891
    |line index list|
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2892
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2893
    (list := self list) notNil ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2894
	index := list indexOf:someString.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2895
	index ~~ 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2896
	    self makeLineVisible:index
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2897
	]
249
75b8fb924904 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
    ]
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2899
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  2900
    "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
  2901
!
75b8fb924904 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
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2903
needScrollToMakeLine:aListLineNr
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2904
    "return true, if a scroll is needd to make a line visible.
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2905
     Numbering starts with 1 for the very first line of the text."
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2906
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2907
    (aListLineNr >= firstLineShown) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2908
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2909
	    ^ false
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2910
	]
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2911
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2912
    ^ true
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2913
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2914
    "Created: / 7.8.1998 / 15:13:51 / cg"
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2915
    "Modified: / 7.8.1998 / 15:14:44 / cg"
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2916
!
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  2917
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2918
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
  2919
    "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
  2920
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2921
    self scrollTo:(viewOrigin + (0 @ height))
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2922
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2923
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2924
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2925
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2926
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
  2927
    "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
  2928
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2929
    self scrollTo:(viewOrigin - (0 @ height))
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2930
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2931
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2932
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2933
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2934
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2935
scrollDown
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2936
    "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
  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
    self scrollDown:1
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2939
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2940
    "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
  2941
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2942
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2943
scrollDown:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2944
    "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
  2945
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2946
    nLines > 0 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2947
	self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2948
	       redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2949
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2950
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2951
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2952
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2953
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2954
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2955
scrollDownPixels:pix
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2956
    "change origin to scroll down some pixels 
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2957
     (towards the bottom of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2958
     THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2959
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2960
    pix > 0 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2961
	self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2962
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2963
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2964
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2965
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  2966
249
75b8fb924904 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
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
  2968
    "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
  2969
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2970
    |nPixel|
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2971
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2972
    nPixel := aPixelOffset - leftOffset.
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2973
    nPixel ~~ 0 ifTrue:[
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2974
        self scrollTo:(viewOrigin + (nPixel @ 0)) redraw:true
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2975
    ]
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2976
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  2977
    "Modified: / 3.3.1999 / 22:55:20 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2978
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2979
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2980
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
  2981
    "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
  2982
      - 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
  2983
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2984
    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
  2985
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2986
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2987
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
  2988
    "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
  2989
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2990
    nPixel > 0 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2991
	self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2992
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2993
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  2994
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2995
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2996
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2997
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
  2998
    "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
  2999
      - 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
  3000
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3001
    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
  3002
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3003
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3004
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
  3005
    "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
  3006
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3007
    nPixel > 0 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3008
	self scrollTo:(viewOrigin + (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3009
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3010
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3011
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3012
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3013
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3014
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
  3015
    "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
  3016
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3017
    ^ 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
  3018
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3019
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3020
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
  3021
    "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
  3022
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3023
    ^ 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
  3024
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3025
75b8fb924904 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
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
  3027
    "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
  3028
75b8fb924904 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
    "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
  3030
     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
  3031
75b8fb924904 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
    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
  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
75b8fb924904 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
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
  3036
    "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
  3037
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3038
    |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
  3039
75b8fb924904 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
    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
  3041
	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
  3042
	    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
  3043
	].
75b8fb924904 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
	^ 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
  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
75b8fb924904 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
    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
  3048
75b8fb924904 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
    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
  3050
	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
  3051
    ] 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
  3052
	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
  3053
	    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
  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
75b8fb924904 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
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
  3059
    "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
  3060
75b8fb924904 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
    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
  3062
	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
  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
75b8fb924904 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
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
  3067
    "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
  3068
75b8fb924904 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
    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
  3070
	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
  3071
    ] 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
  3072
	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
  3073
	    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
  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
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3077
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3078
scrollToPercent:percentOrigin
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3079
    "scroll to a position given in percent of total"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3080
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3081
    "kludge - ListView thinks in lines"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3082
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3083
    self scrollHorizontalToPercent:percentOrigin x.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3084
    self scrollVerticalToPercent:percentOrigin y.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3085
!
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3086
249
75b8fb924904 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
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
  3088
    "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
  3089
75b8fb924904 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
    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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3093
scrollUp
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3094
    "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
  3095
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3096
    self scrollUp:1
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3097
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3098
    "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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3101
scrollUp:nLines
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3102
    "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
  3103
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3104
    nLines > 0 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3105
	self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3106
	       redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3107
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3108
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3109
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3110
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3111
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3112
scrollUpPixels:pix
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3113
    "change origin to scroll up some pixels 
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3114
     (towards the top of the text)
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3115
    THIS WILL VANISH!!"
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3116
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3117
    pix > 0 ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3118
	self scrollTo:(viewOrigin - (0 @ pix)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3119
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3120
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3121
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3122
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  3123
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3124
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
  3125
    "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
  3126
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3127
    |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
  3128
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3129
    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
  3130
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3131
    "/ 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
  3132
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3133
    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
  3134
	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
  3135
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3136
    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
  3137
    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
  3138
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3139
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3140
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
  3141
    "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
  3142
     - 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
  3143
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3144
    |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
  3145
75b8fb924904 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
    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
  3147
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3148
    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
  3149
    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
  3150
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3151
    (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
  3152
	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
  3153
	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
  3154
	    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
  3155
	    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
  3156
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3157
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3158
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3159
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3160
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
  3161
    "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
  3162
     - 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
  3163
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3164
    |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
  3165
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3166
    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
  3167
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3168
    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
  3169
    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
  3170
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3171
    (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
  3172
	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
  3173
	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
  3174
	    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
  3175
	    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
  3176
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3177
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3178
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3179
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3180
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
  3181
    "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
  3182
     - 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
  3183
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3184
    |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
  3185
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3186
    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
  3187
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3188
    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
  3189
    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
  3190
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3191
    (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
  3192
	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
  3193
	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
  3194
	    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
  3195
	    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
  3196
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3197
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3198
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3199
75b8fb924904 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
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
  3201
    "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
  3202
     - 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
  3203
75b8fb924904 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
    |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
  3205
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3206
    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
  3207
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3208
    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
  3209
    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
  3210
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3211
    (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
  3212
	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
  3213
	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
  3214
	    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
  3215
	    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
  3216
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3217
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3218
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3219
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3220
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
  3221
    "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
  3222
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3223
    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
  3224
	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
  3225
	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
  3226
	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
  3227
	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
  3228
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3229
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3230
75b8fb924904 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
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
  3232
    "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
  3233
     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
  3234
     (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
  3235
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3236
    ^ 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
  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
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3239
!ListView methodsFor:'scrolling basic'!
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3240
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3241
scrollTo:anOrigin redraw:doRedraw
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3242
    "change origin to have newOrigin be visible at the top-left.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3243
     The argument defines the integer device coordinates of the new top-left 
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3244
     point.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3245
    "
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3246
    |dltOrg
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3247
     noLn "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3248
     max  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3249
     tmp  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3250
     h    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3251
     w    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3252
     y0   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3253
     y1   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3254
     y    "{ Class:SmallInteger }"
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3255
     x    "{ Class:SmallInteger }"
1712
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  3256
     delta newFirstLine newViewOrigin newLeftOffset
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3257
     hBefore wBefore inv wg|
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3258
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3259
    dltOrg := anOrigin - viewOrigin.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3260
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3261
"/  compute valid horizontal offset x
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3262
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3263
    (x := dltOrg x) ~~ 0 ifTrue:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3264
        tmp := leftOffset + x.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3265
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3266
        x < 0 ifTrue:[                                          "/ scrolling left
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3267
            tmp < 0 ifTrue:[x := 1 - leftOffset]
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3268
        ] ifFalse:[                                             "/ scrolling right
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3269
         "/ allows scrolling to the right of widest line
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3270
            max := self widthOfContents + 10.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3271
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3272
            tmp + width > max ifTrue:[
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3273
                x := (max - leftOffset - width) max:0
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3274
            ]
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3275
        ]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3276
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3277
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3278
"/  compute valid vertical offset measured in lines
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3279
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3280
    (y := dltOrg y // fontHeight) ~~ 0 ifTrue:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3281
        tmp := firstLineShown + y.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3282
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3283
        y < 0 ifTrue:[                                          "/ scrolling up
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3284
            tmp < 1 ifTrue:[y := 1 - firstLineShown]
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3285
        ] ifFalse:[                                             "/ scrolling down
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3286
            max := self size.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3287
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3288
            tmp + nFullLinesShown > max ifTrue:[
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3289
                y := (max - firstLineShown - nFullLinesShown + 1) max:0
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3290
            ]
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3291
        ]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3292
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3293
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3294
    (x == 0 and:[y == 0]) ifTrue:[                              "/ has viewOrigin changed ?
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3295
        ^ self
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3296
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3297
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3298
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3299
    (noLn := y) ~~ 0 ifTrue:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3300
        y := y * fontHeight
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3301
    ].
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3302
    delta := (x @ y).
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3303
1582
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3304
    newFirstLine := firstLineShown + noLn.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3305
    newViewOrigin := viewOrigin + delta.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3306
    newLeftOffset := newViewOrigin x.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3307
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3308
    (shown and:[doRedraw]) ifFalse:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3309
        self originWillChange.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3310
        firstLineShown := newFirstLine.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3311
        viewOrigin := newViewOrigin.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3312
        leftOffset := newLeftOffset.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3313
        ^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3314
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3315
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3316
"/    (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[               "/ outstanding expose events
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3317
"/        self invalidate.                                        "/ redraw all
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3318
"/        self originWillChange.
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3319
"/        ^ self originChanged:(x @ y )
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3320
"/    ].
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3321
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3322
    (     (y ~~ 0 and:[x ~~ 0])                                 "/ both x and y changed
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3323
      or:[(noLn abs) >= nLinesShown                             "/ at least one area is
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3324
      or:[(x abs) > (width // 4 * 3)]]                          "/ big enough to redraw all
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3325
    ) ifTrue:[
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3326
        self originWillChange.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3327
        firstLineShown := newFirstLine.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3328
        viewOrigin := newViewOrigin.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3329
        leftOffset := newLeftOffset.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3330
        self invalidate.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3331
        ^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3332
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3333
1712
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  3334
    hBefore := height.
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  3335
    wBefore := width.
1713
33c996d5acd4 removed repairDamage completely in scroll.
Claus Gittinger <cg@exept.de>
parents: 1712
diff changeset
  3336
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3337
    "/ OLD:
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3338
    "/ self repairDamage.
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3339
    (wg := self windowGroup) notNil ifTrue:[
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3340
        wg processRealExposeEventsFor:self.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3341
    ].
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3342
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3343
    self originWillChange.
1582
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3344
    firstLineShown := newFirstLine.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3345
    viewOrigin := newViewOrigin.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  3346
    leftOffset := newLeftOffset.
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  3347
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3348
    self catchExpose.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3349
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3350
    x == 0 ifTrue:[                                             "/ scrolling vertical
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3351
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3352
        y0 := textStartTop + (y abs).
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3353
        h  := hBefore - margin - y0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3354
        w  := wBefore - margin.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3355
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3356
        y > 0 ifTrue:[                                          "/ copy down
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3357
            self copyFrom:self
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3358
                        x:0 y:y0 toX:0 y:textStartTop
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3359
                    width:w height:h async:true.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3360
            y1 := h.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3361
        ] ifFalse:[                                             "/ copy up
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3362
            self copyFrom:self
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3363
                        x:margin y:textStartTop toX:margin y:y0
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3364
                    width:w height:h async:true.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3365
            y1 := 0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3366
        ].
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3367
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3368
        inv := (margin@y1) extent:(w@y0).      
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3369
    ] ifFalse:[                                                 "/ scrolling horizontal
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3370
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3371
        x > 0 ifTrue:[                                          "/ scrolling right
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3372
            y0 := margin + x.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3373
            y1 := wBefore - y0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3374
        ] ifFalse:[                                             "/ scrolling left
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3375
            y0 := margin - x.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3376
            y1 := 0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3377
        ].
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3378
        h := hBefore - margin - margin.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3379
        w := wBefore - margin - y0.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3380
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3381
        x > 0 ifTrue:[                                          "/ copy right
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3382
            self copyFrom:self x:y0 y:margin toX:margin y:margin
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3383
                    width:w height:h async:true.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3384
        ] ifFalse:[                                             "/ copy left
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3385
            "/self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3386
            self copyFrom:self x:margin y:margin toX:y0 y:margin
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3387
                    width:w height:h async:true.
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3388
        ].
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3389
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3390
        inv := (y1@margin) extent:(y0@h).      
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3391
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3392
1727
48c3cb92e8e2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1726
diff changeset
  3393
    self invalidateDeviceRectangle:inv repairNow:true.
1712
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  3394
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3395
    self originChanged:delta.
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3396
    self waitForExpose.
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  3397
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3398
    "Modified: / 9.1.1999 / 01:48:22 / cg"
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3399
! !
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  3400
249
75b8fb924904 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
!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
  3402
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3403
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
  3404
    "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
  3405
     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
  3406
     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
  3407
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3408
    |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
  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
    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
  3411
    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
  3412
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3413
    "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
  3414
    (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
  3415
	[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
  3416
	    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
  3417
	    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
  3418
		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
  3419
	    ] 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
  3420
		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
  3421
	    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3422
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3423
	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
  3424
    ] 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
  3425
	"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
  3426
	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
  3427
	    [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
  3428
		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
  3429
		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
  3430
	    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3431
	    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
  3432
		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
  3433
	    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3434
	] 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
  3435
	    "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
  3436
	]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3437
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3438
    ^ 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
  3439
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3440
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3441
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
  3442
    "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
  3443
     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
  3444
     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
  3445
     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
  3446
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3447
    |endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3448
     len    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3449
     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
  3450
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3451
    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
  3452
    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
  3453
    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
  3454
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3455
    "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
  3456
    (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
  3457
	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
  3458
	[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
  3459
	    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
  3460
	    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
  3461
	].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3462
	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
  3463
    ] 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
  3464
	"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
  3465
	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
  3466
	    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
  3467
	    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
  3468
		"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
  3469
		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
  3470
	    ] 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
  3471
		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
  3472
		[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
  3473
		    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
  3474
		    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
  3475
		].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3476
		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
  3477
	    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3478
	] 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
  3479
	    "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
  3480
	]
125
claus
parents: 121
diff changeset
  3481
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3482
    ^ 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
  3483
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3484
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3485
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
  3486
    "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
  3487
     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
  3488
     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
  3489
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3490
    |lineString 
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3491
     found firstChar1 firstChar2 c pc
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3492
     col         "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3493
     cc          "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3494
     patternSize "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3495
     line1       "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  3496
     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
  3497
75b8fb924904 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
    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
  3499
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3500
	self withCursor:Cursor questionMark do:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3501
	    col := startCol - 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3502
	    firstChar1 := pattern at:1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3503
	    ignCase ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3504
		firstChar1 := firstChar1 asLowercase.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3505
		firstChar2 := firstChar1 asUppercase.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3506
	    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3507
		firstChar2 := firstChar1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3508
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3509
	    col > (list at:startLine) size ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3510
		col := -999
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3511
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3512
	    line1 := startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3513
	    line1 to:1 by:-1 do:[:lnr |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3514
		lineString := list at:lnr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3515
		lineString notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3516
		    lineSize := lineString size.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3517
		    col == -999 ifTrue:[col := lineSize - patternSize + 1].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3518
		    [(col > 0) 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3519
		     and:[(c := lineString at:col) ~= firstChar1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3520
		     and:[c ~= firstChar2]]] whileTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3521
			col := col - 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3522
		    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3523
		    [col > 0] whileTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3524
			cc := col.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3525
			found := true.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3526
			1 to:patternSize do:[:cnr |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3527
			    cc > lineSize ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3528
				found := false
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3529
			    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3530
				pc := pattern at:cnr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3531
				c := lineString at:cc.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3532
				pc ~= c ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3533
				    (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3534
					found := false
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3535
				    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3536
				]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3537
			    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3538
			    cc := cc + 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3539
			].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3540
			found ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3541
			    ^ block1 value:lnr value:col.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3542
			].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3543
			col := col - 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3544
			[(col > 0) 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3545
			and:[(c := lineString at:col) ~= firstChar1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3546
			and:[c ~= firstChar2]]] whileTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3547
			    col := col - 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3548
			]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3549
		    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3550
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3551
		col := -999.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3552
	    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3553
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3554
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3555
    "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
  3556
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3557
    ^ block2 value
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3558
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3559
    "Created: 13.9.1997 / 01:06:19 / cg"
1338
9d59c19b9328 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1325
diff changeset
  3560
    "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
  3561
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3562
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3563
searchBackwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3564
    "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
  3565
     found evaluate block2.
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3566
     Sorry, but pattern is no regular expression pattern (yet)"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3567
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3568
    ^ self
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3569
	searchBackwardFor:pattern 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3570
	ignoreCase:false 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3571
	startingAtLine:startLine col:startCol 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3572
	ifFound:block1 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3573
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3574
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3575
    "Modified: 13.9.1997 / 01:07:36 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3576
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3577
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3578
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
  3579
    "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
  3580
     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
  3581
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  3582
    |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
  3583
     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
  3584
     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
  3585
     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
  3586
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3587
    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
  3588
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3589
	self withCursor:Cursor questionMark do:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3590
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3591
	    col := startCol + 1.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3592
	    line1 := startLine.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3593
	    line2 := list size.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3594
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3595
	    pattern includesUnescapedMatchCharacters ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3596
		p := pattern species new:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3597
		(pattern startsWith:$*) ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3598
		    p := p , '*'
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3599
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3600
		p := p , pattern.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3601
		(pattern endsWith:$*) ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3602
		    p := p , '*'
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3603
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3604
		realPattern := pattern.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3605
		(realPattern startsWith:$*) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3606
		    realPattern := realPattern copyFrom:2
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3607
		].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3608
		line1 to:line2 do:[:lnr |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3609
		    lineString := list at:lnr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3610
		    lineString notNil ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3611
			"/ first a crude check ...
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3612
			(p match:lineString ignoreCase:ignCase) ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3613
			    "/ ok, there it is; look at which position
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3614
			    col := lineString 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3615
					findMatchString:realPattern 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3616
					startingAt:col 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3617
					ignoreCase:ignCase 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3618
					ifAbsent:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3619
			    col ~~ 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3620
				^ block1 value:lnr value:col.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3621
			    ]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3622
			].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3623
		    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3624
		    col := 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3625
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3626
	    ] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3627
		p := pattern withoutMatchEscapes.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3628
		line1 to:line2 do:[:lnr |
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3629
		    lineString := list at:lnr.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3630
		    lineString isString ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3631
			ignCase ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3632
			    col := lineString 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3633
					findMatchString:p 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3634
					startingAt:col 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3635
					ignoreCase:ignCase 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3636
					ifAbsent:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3637
			] ifFalse:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3638
			    col := lineString 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3639
					findString:p 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3640
					startingAt:col 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3641
					ifAbsent:0.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3642
			].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3643
			col ~~ 0 ifTrue:[
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3644
			    ^ block1 value:lnr value:col.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3645
			]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3646
		    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3647
		    col := 1
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3648
		]
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3649
	    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3650
	]
249
75b8fb924904 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
    "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
  3653
75b8fb924904 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
    ^ block2 value
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  3655
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3656
    "Created: 13.9.1997 / 01:06:31 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3657
    "Modified: 13.9.1997 / 01:11:28 / cg"
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3658
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3659
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3660
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3661
    "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
  3662
     found evaluate block2."
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3663
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3664
    ^ self
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3665
	searchForwardFor:pattern 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3666
	ignoreCase:false 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3667
	startingAtLine:startLine col:startCol 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3668
	ifFound:block1 
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  3669
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3670
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  3671
    "Modified: 13.9.1997 / 01:07:11 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  3672
! !
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3673
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3674
!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
  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
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
  3677
    "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
  3678
     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
  3679
     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
  3680
75b8fb924904 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
    |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
  3682
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3683
    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
  3684
    list notNil ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3685
	nLines := self size.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3686
	1 to:nLines do:[:index |
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3687
	    line := self at:index.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3688
	    line notNil ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3689
		line isString ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3690
		    newLine := line withTabsExpanded.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3691
		    newLine ~~ line ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3692
			self withoutRedrawAt:index put:newLine
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3693
		    ].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3694
		] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3695
		    includesNonStrings := true.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3696
		]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3697
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3698
	]
249
75b8fb924904 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
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3700
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3701
    "Modified: 30.8.1995 / 19:06:37 / claus"
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  3702
    "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
  3703
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3704
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3705
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
  3706
    "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
  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
    ^ 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
  3709
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3710
75b8fb924904 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
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
  3712
    "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
  3713
     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
  3714
75b8fb924904 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
    |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
  3716
     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
  3717
     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
  3718
     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
  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
    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
  3721
    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
  3722
    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
  3723
    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
  3724
    [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
  3725
	(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
  3726
	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
  3727
	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
  3728
    ].
75b8fb924904 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
    ^ 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
  3730
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3731
75b8fb924904 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
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
  3733
    "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
  3734
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3735
    |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
  3736
     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
  3737
     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
  3738
     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
  3739
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3740
    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
  3741
    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
  3742
    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
  3743
    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
  3744
    [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
  3745
	(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
  3746
	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
  3747
	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
  3748
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3749
    (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
  3750
	^ 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
  3751
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3752
    ^ 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
  3753
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3754
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3755
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
  3756
    "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
  3757
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3758
    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
  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
75b8fb924904 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
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
  3762
    "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
  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
    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
  3765
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3766
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3767
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
  3768
    "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
  3769
     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
  3770
     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
  3771
     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
  3772
     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
  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
    |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
  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
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3777
     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
  3778
     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
  3779
     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
  3780
    "
75b8fb924904 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
    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
  3782
    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
  3783
    (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
  3784
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3785
    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
  3786
    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
  3787
    [newLine startsWith:eightSpaces] whileTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3788
	newLine := newLine copyFrom:9.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3789
	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
  3790
    ].
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3791
    ^ (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
  3792
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3793
    "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
  3794
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3795
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3796
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
  3797
    "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
  3798
     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
  3799
     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
  3800
     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
  3801
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3802
    |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
  3803
     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
  3804
     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
  3805
     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
  3806
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3807
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3808
     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
  3809
     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
  3810
     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
  3811
     (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
  3812
      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
  3813
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3814
    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
  3815
    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
  3816
    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
  3817
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3818
    currentMax := line size + (nTabs * 7).
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3819
    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
  3820
    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
  3821
    line do:[:character |
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3822
	(character == (Character tab)) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3823
	    nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3824
	    [dstIndex < nextTab] whileTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3825
		tmpString at:dstIndex put:(Character space).
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3826
		dstIndex := dstIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3827
	    ]
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3828
	] ifFalse:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3829
	    tmpString at:dstIndex put:character.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3830
	    dstIndex := dstIndex + 1
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3831
	].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3832
	(dstIndex > currentMax) ifTrue:[
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3833
	    "
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3834
	     this cannot happen with <= 8 tabs
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3835
	    "
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3836
	    currentMax := currentMax + currentMax.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3837
	    nString := line species new:currentMax.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3838
	    nString replaceFrom:1 to:(dstIndex - 1) 
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3839
			   with:tmpString startingAt:1.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3840
	    tmpString := nString.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3841
	    nString := nil
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3842
	].
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3843
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3844
	"make stc-optimizer happy
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3845
	 - no need to return value of ifTrue:/ifFalse above"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3846
	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
  3847
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3848
    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
  3849
    dstIndex == currentMax ifTrue:[
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  3850
	^ 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
  3851
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3852
    ^ tmpString copyTo:dstIndex
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3853
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  3854
    "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
  3855
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3856
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3857
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
  3858
    "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
  3859
     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
  3860
     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
  3861
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3862
    ^ 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
  3863
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3864
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  3865
!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
  3866
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3867
version
1773
1e941ac6f4cb add some to heightOfContents,
Claus Gittinger <cg@exept.de>
parents: 1756
diff changeset
  3868
    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.186 1999-03-07 15:07:10 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
  3869
! !