ListView.st
author Claus Gittinger <cg@exept.de>
Tue, 19 Feb 2019 22:38:28 +0100
changeset 6529 04bde4803d96
parent 6522 6136bb31f689
child 6554 f65b459a7d91
permissions -rw-r--r--
#DOCUMENTATION by cg class: TextCollector comment/format in: #entryStream #isStream
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    12
"{ Package: 'stx:libwidg' }"
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    13
5369
6bddfe83bab9 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5217
diff changeset
    14
"{ NameSpace: Smalltalk }"
6bddfe83bab9 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5217
diff changeset
    15
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    16
View subclass:#ListView
3563
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    17
	instanceVariableNames:'list firstLineShown nFullLinesShown nLinesShown fgColor bgColor
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    18
		partialLines leftMargin topMargin textStartLeft textStartTop
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    19
		innerWidth tabPositions lineSpacing fontHeight fontAscent
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    20
		fontIsFixedWidth fontWidth autoScroll autoScrollBlock
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    21
		autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    22
		listMsg viewOrigin listChannel backgroundAlreadyClearedColor
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
    23
		scrollWhenUpdating scrollLocked lineEndCRLF highlightAreas
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
    24
		compareModelOnUpdate expandTabsWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
    25
		checkLineEndConventionWhenUpdating
6398
4be7a447d091 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
    26
		checkedLinesForWidthOfContentsComputation showLineEndIndicators
4be7a447d091 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
    27
		showControlCharacters'
3563
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    28
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    29
		UserDefaultTabPositions DefaultLeftMargin DefaultTopMargin'
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    30
	poolDictionaries:''
f80861c7fbea wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3562
diff changeset
    31
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    32
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    33
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    34
Object subclass:#HighlightArea
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    35
	instanceVariableNames:'startLine startCol endLine endCol fgColor bgColor'
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    36
	classVariableNames:''
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    37
	poolDictionaries:''
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    38
	privateIn:ListView
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    39
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    40
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
    41
Object subclass:#SearchSpec
5076
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
    42
	instanceVariableNames:'pattern match ignoreCase variable fullWord forward
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
    43
		atBeginOfLineOnly atEndOfLineOnly ignoreDiacritics regexMatch
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
    44
		wrapAtEndOfText'
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
    45
	classVariableNames:''
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
    46
	poolDictionaries:''
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
    47
	privateIn:ListView
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
    48
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
    49
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
    50
!ListView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    51
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    52
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    53
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    54
 COPYRIGHT (c) 1989 by Claus Gittinger
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
    55
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    56
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    57
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    58
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    59
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    60
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    61
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    62
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    63
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    64
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    65
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    66
documentation
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    67
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    68
    a View for (string-)lists.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    69
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    70
    This class can only passively display collections of strings,
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    71
    text or display objects which behave line-like (i.e. all have constant height).
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    72
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    73
    Selections, editing, cursors etc. must be implemented in subclasses.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    74
    (see SelectionInListView, TextView etc.)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    75
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    76
    This code currently handles only fixed-height fonts correctly -
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    77
    it should be rewritten in some places to not compute the position/height from
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    78
    the view's font height, but by accumulating line heights...
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    79
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
    80
    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
    81
    which should be changed to have this behavior optionally for smooth scroll.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
    82
        
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    83
    The text is internally kept in the 'list' instance variable, and is supposed to consist
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
    84
    of a collection (Ordered-, String- or VirtualCollection) of line entries.
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    85
    Typically, individual entries are either strings/text or nil (for empty lines).
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    86
    However, ANY object which supports the displayOn: and widthIn: protocol can be
120
claus
parents: 118
diff changeset
    87
    used - see MultipleColumnListEntry as an example.
claus
parents: 118
diff changeset
    88
    Therefore, ListView (and all subclasses) are prepared to handle non-string entries
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    89
    (especially: attributed Text and labelAndIcon-like entities).
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    90
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
    91
    The internal version of the text has tabulators expanded to blanks. 
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
    92
    ListView is not prepared to deal with them. 
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
    93
    When text is exchanged with an external medium (i.e. reading/writing files),
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
    94
    these are expanded/compressed assuming a tab-setting of 8.
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    95
    This is done independent of the user's tab setting, which is used ONLY for positioning,
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
    96
    while the text is edited.
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
    97
    Thus, even if the tab setting is multiple of 4's, tabs are
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
    98
    written in multiples of 8 when the text is saved. 
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
    99
    Since this is the default on all ascii terminals and printers, 
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   100
    this assures that the text looks correctly indented when finally printed.
120
claus
parents: 118
diff changeset
   101
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   102
    Notice:
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   103
    -------
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   104
    ListView is one of the OLDEST widget classes in the system and definitely requires a major rewrite:
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   105
120
claus
parents: 118
diff changeset
   106
    Due to historic reasons (ListView implemented scrolling before the general
claus
parents: 118
diff changeset
   107
    scrolling code in View was added), this one does scrolling different from all other
4159
3032a5a9d8de comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents: 4070
diff changeset
   108
    views. The general scrolling code (in View) uses the transformation for transparent scrolling
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   109
    using the viewOrigin (transparent means, that the code does not need to know - it simply draws
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   110
    as if all of the text was visible).
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   111
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   112
    Here in ListView, the transformation is not used, instead it is done again, and different,
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   113
    by keeping the firstLineShown (i.e. vertical offset) and leftOffset (horizontal offset).
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   114
    Even worse: the firstLineShown is a line-index, the most annoying consequence of this is that
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   115
    scrolling is done by lines here, whereas it is done in pixels in the View class.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   116
    Thus, be very careful, when changing things (better: don't touch it ;-).
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   117
    Also, the viewOrigin variable is only valid for the x coordinate. The viewOrigin's y is always 0 !!
120
claus
parents: 118
diff changeset
   118
305
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   119
    Also, all controller functionality is completely performed by the listView
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   120
    (and subclasses) itself. It is still possible, to define and set a specialized
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   121
    controller, though. I.e. if you like to change the input behavior, define
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   122
    a corresponding controller class and intersect the keyXXX/buttonXXX messages
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   123
    there.
4aab887bf2ff commentary
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
   124
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   125
    This may be totally rewritten ... so don't depend on the internals; especially the scrolling
120
claus
parents: 118
diff changeset
   126
    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
   127
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   128
    Also Notice:
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   129
    ------------
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   130
    because ListView was written at a time when most of the graphics was done via remote connections
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   131
    (X-window network protocol), it is highly tuned to avoid redraw operations. Thus, it can be used
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   132
    happily over a slow WLAN (say: 64kBit connection).
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   133
    In that, it performed *much* better than other widgets, especialy Java and Qt, some of which are
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   134
    hardly usable via the network.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   135
    It may be questionable whether this is still a requirement these days, where network connections
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   136
    are usually pretty fast. 
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   137
    However, the author insists on this to remain as it is, because we do have customers
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   138
    and applications which rely on relatively good remote display performance!!
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   139
    Future underlying graphics may well become network dependent in the future, for example, when
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   140
    the display connection is implemented as an RPC into a web browser...
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   141
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   142
    Also Notice (Virtual line collections):
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   143
    ------------
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   144
    ListView shall be configurable to avoid accesses to its underlying list if required.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   145
    Currently, it can be customized to disable lineWidth computation, tab expansion and scanning for
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   146
    non-string entries. 
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   147
    All of which is required when huge texts which are not in memory are to be displayed
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   148
    (for example: a virtual array of 10million text lines). 
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   149
    Please be careful to not reintroduce such code when adding features 
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   150
    (as happened in the past). ListView shall always be configurable to only access
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   151
    a minimum subset of the line collection (i.e. only the currently visible page),
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   152
    by customizing the tab-expansion, line-end and widthOfContents behavior.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   153
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   154
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   155
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   156
      list                <aCollection>           the text strings, a collection of lines.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   157
                                                  Nils may be used for empty lines.
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   158
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   159
      firstLineShown      <Number>                the index of the 1st visible line (1 ..)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   160
      leftOffset          <Number>                left offset for horizontal scroll
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   161
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   162
      nFullLinesShown     <Number>                the number of unclipped lines in visible area
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   163
                                                  (internal; updated on size changes)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   164
      nLinesShown         <Number>                the number of lines in visible area, incl. partial
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   165
                                                  (internal; updated on size changes)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   166
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   167
      fgColor             <Color>                 color to draw characters
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   168
      bgColor             <Color>                 the background
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   169
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   170
      partialLines        <Boolean>               allow last line to be partial displayed
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   171
      leftMargin          <Number>                margin at left in pixels
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   172
      topMargin           <Number>                margin at top in pixels
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   173
      textStartLeft       <Number>                margin + leftMargin (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   174
      textStartTop        <Number>                margin + topMargin (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   175
      innerWidth          <Number>                width - margins (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   176
      tabPositions        <aCollection>           tab stops (cols)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   177
      fontHeight          <Number>                font height in pixels (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   178
      fontAscent          <Number>                font ascent in pixels (internal)
6098
62a103f41b17 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6065
diff changeset
   179
      fontIsFixed         <Boolean>               true if it's a fixed font (internal)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   180
      fontWidth           <Number>                width of space (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   181
      lineSpacing         <Number>                pixels between lines
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   182
      lastSearchPattern   <String>                last pattern for searching
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   183
                                                  (kept to provide a default for next search)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   184
      lastSearchIgnoredCase   <Boolean>           last search ignored case
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   185
                                                  (kept to provide a default for next search)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   186
      wordCheck           <Block>                 rule used for check for word boundaries in word select
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   187
                                                  The default rule is to return true for alphaNumeric characters.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   188
                                                  (can be changed to allow for underscore and other
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   189
                                                   characters to be treated as alphaCharacters)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   190
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   191
      autoScrollBlock     <Block>                 block installed as timeoutBlock when doing an
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   192
                                                  autoScroll (internal)
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   193
      autoScrollDeltaT                            computed scroll time delta in seconds (internal)
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   194
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   195
      includesNonStrings                          cached flag if any non-strings are in list
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   196
      widthOfWidestLine                           cached width of widest line
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   197
      listMsg                                     if view has a model and listMsg is non-nil,
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   198
                                                  this is sent to the model to acquired a new contents
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   199
                                                  whenever a change of the aspect  (aspectMsg) occurs.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   200
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   201
      viewOrigin                                  the current origin
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   202
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   203
      backgroundAlreadyClearedColor               internal; speedup by avoiding
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   204
                                                  multiple fills when drawing
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   205
                                                  internal lines
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   206
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
   207
      scrollWhenUpdating
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   208
                                <Symbol>        defines how the view is scrolled if the
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   209
                                                model changes its value by some outside activity
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   210
                                                (i.e. not by user input).
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   211
                                                Can be one of:
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   212
                                                    #keep / nil     -> stay unchanged
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   213
                                                    #endOfText      -> scroll to the end
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   214
                                                    #beginOfText    -> scroll to the top
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   215
                                                The default is #beginOfText (i.e. scroll to top).
120
claus
parents: 118
diff changeset
   216
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   217
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   218
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   219
      textForegroundColor                         defaults to Black
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   220
      textBackgroundColor                         defaults to White
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   221
      textFont                                    defaults to defaultFont
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
   222
      textTabPositions                            defaults to #(1 9 17 25 ...)
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   223
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   224
    [author:]
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   225
        Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   226
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   227
    [see also:]
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
   228
        TextView EditTextView
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   229
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   230
"
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   231
!
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   232
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   233
examples
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   234
"
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   235
    ListViews alone are rarely used - its mostly an abstract superclass
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   236
    for TextView, EditTextView and SelectionInListView.
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   237
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   238
    anyway, here are a few examples:
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   239
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   240
     basic simple setup:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   241
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   242
	|top l|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   243
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   244
	top := StandardSystemView new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   245
	top extent:100@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   246
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   247
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   248
	l list:#('one' 'two' 'three').
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   249
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   250
	top open
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   251
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   252
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   253
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   254
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   255
      specifying textMargins (these have NOTHING to do with the viewInset):
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   256
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   257
	|top l|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   258
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   259
	top := StandardSystemView new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   260
	top extent:100@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   261
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   262
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   263
	l list:#('one' 'two' 'three').
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   264
	l topMargin:10.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   265
	l leftMargin:20.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   266
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   267
	top open
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   268
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   269
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   270
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   271
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   272
      globally set the fg/bg colors:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   273
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   274
	|top l|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   275
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   276
	top := StandardSystemView new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   277
	top extent:100@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   278
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   279
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   280
	l list:#('one' 'two' 'three').
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   281
	l foregroundColor:(Color white).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   282
	l backgroundColor:(Color blue).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   283
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   284
	top open
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   285
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   286
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   287
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   288
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   289
      non-string (text) entries:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   290
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   291
	|top list l|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   292
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   293
	top := StandardSystemView new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   294
	top extent:100@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   295
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   296
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   297
	list := #('all' 'of' 'your' 'preferred' 'colors')
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   298
		with:#(red green blue 'orange' cyan)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   299
		collect:[:s :clr |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   300
			    Text string:s
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   301
				 emphasis:(Array with:#bold
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   302
						 with:(#color->(Color name:clr))) ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   303
	l list:list.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   304
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   305
	top open
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   306
									[exEnd]
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   307
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   308
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   309
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   310
      generic non-string entries:
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
   311
      (notice: ColoredListEntry is obsoleted by Text)
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   312
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   313
	|top list l|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   314
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   315
	top := StandardSystemView new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   316
	top extent:100@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   317
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   318
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   319
	list := #('all' 'of' 'your' 'preferred' 'colors')
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   320
		with:#(red green blue 'orange' cyan)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   321
		collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   322
	l list:list.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   323
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   324
	top open
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   325
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   326
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   327
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   328
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   329
      using a model (default listMessage is aspectMessage):
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   330
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   331
	|top model l theModelsText|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   332
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   333
	model := Plug new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   334
	model respondTo:#modelsAspect
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   335
		   with:[ theModelsText ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   336
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   337
	top := StandardSystemView new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   338
	top extent:100@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   339
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   340
	l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   341
	l model:model.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   342
	l aspect:#modelsAspect.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   343
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   344
	top open.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   345
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   346
	Delay waitForSeconds:3.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   347
	theModelsText := #('foo' 'bar' 'baz').
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   348
	model changed:#modelsAspect.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   349
									[exEnd]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   350
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   351
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   352
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   353
      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
   354
      for two listViews:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   355
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   356
	|top model l1 l2 plainText|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   357
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   358
	plainText := #('').
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   359
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   360
	model := Plug new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   361
	model respondTo:#modelsUppercaseText
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   362
		   with:[ plainText asStringCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   363
			      collect:[:l | l asUppercase]].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   364
	model respondTo:#modelsLowercaseText
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   365
		   with:[ plainText asStringCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   366
			      collect:[:l | l asLowercase]].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   367
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   368
	top := StandardSystemView extent:200@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   369
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   370
	l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   371
	l1 model:model.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   372
	l1 aspect:#modelsAspect.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   373
	l1 listMessage:#modelsUppercaseText.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   374
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   375
	l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   376
	l2 model:model.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   377
	l2 aspect:#modelsAspect.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   378
	l2 listMessage:#modelsLowercaseText.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   379
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   380
	top open.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   381
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   382
	Delay waitForSeconds:3.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   383
	plainText := #('foo' 'bar' 'baz').
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   384
	model changed:#modelsAspect.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   385
									[exEnd]
4536
c9d840b654b4 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
   386
c9d840b654b4 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
   387
      using a big list (100000 lines),
c9d840b654b4 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
   388
      wrapping in a ScrollableView:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   389
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   390
	|bigList top lv|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   391
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   392
	bigList := (1 to:100000) collect:[:lineNr | 'List line Nr. ' , lineNr printString].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   393
	bigList at:10 put:('Some Text ' asText , 'with Bold part' allBold).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   394
	bigList at:20 put:('Some Text ' asText , 'with Italic part' allItalic).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   395
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   396
	top := StandardSystemView extent:200@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   397
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   398
	lv := HVScrollableView for:ListView in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   399
	lv origin:0.0 @ 0.0 corner:1.0 @ 1.0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   400
	lv list:bigList expandTabs:false scanForNonStrings:false includesNonStrings:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   401
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   402
	top open.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   403
									[exEnd]
4536
c9d840b654b4 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
   404
c9d840b654b4 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
   405
      using a huge virtual list (1 mio simulated lines),
c9d840b654b4 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
   406
      wrapping in a ScrollableView:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   407
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   408
	|virtualList top lv|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   409
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   410
	virtualList := Plug new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   411
	virtualList inheritFrom:SequenceableCollection.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   412
	virtualList respondTo:#size with:[ 1000000 ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   413
	virtualList respondTo:#at:  with:[:lineNr | 'List line Nr. ' , lineNr printString ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   414
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   415
	top := StandardSystemView extent:200@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   416
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   417
	lv := ScrollableView for:ListView in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   418
	lv origin:0.0 @ 0.0 corner:1.0 @ 1.0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   419
	lv list:virtualList expandTabs:false scanForNonStrings:false includesNonStrings:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   420
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   421
	top open.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   422
									[exEnd]
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   423
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   424
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   425
      using a huge virtual array (1 mio simulated lines),
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   426
      wrapping in a ScrollableView.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   427
      To simulate an expensive computation, a delay is planted into the line generator;
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   428
      Startup and display of page full of lines should not take longer than the number of lines shown:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   429
									[exBegin]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   430
	|virtualList top lv|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   431
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   432
	virtualList := VirtualArray new.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   433
	virtualList
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   434
	    setSize:1000000;
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   435
	    generator:[:index | Transcript showCR:index.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   436
				Delay waitForSeconds:0.5.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   437
				'%1 -> %2' bindWith:index with:index squared].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   438
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   439
	top := StandardSystemView extent:200@200.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   440
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   441
	lv := ScrollableView for:ListView in:top.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   442
	lv origin:0.0 @ 0.0 corner:1.0 @ 1.0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   443
	lv expandTabsWhenUpdating:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   444
	lv checkLineEndConventionWhenUpdating:false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   445
	lv checkedLinesForWidthOfContentsComputation:-1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   446
	lv list:virtualList.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   447
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   448
	top open.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   449
									[exEnd]
451
d4bb4dcc033c examples
Claus Gittinger <cg@exept.de>
parents: 439
diff changeset
   450
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   451
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   452
5756
8bf39c14ecda #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5721
diff changeset
   453
!ListView class methodsFor:'accessing private classes'!
8bf39c14ecda #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5721
diff changeset
   454
8bf39c14ecda #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5721
diff changeset
   455
searchSpec
8bf39c14ecda #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5721
diff changeset
   456
    ^ SearchSpec
8bf39c14ecda #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5721
diff changeset
   457
! !
8bf39c14ecda #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5721
diff changeset
   458
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   459
!ListView class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   460
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   461
defaultTabPositions
6213
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   462
    "return an array containing the styleSheet's default tab positions"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   463
3777
4a9854ac7ab0 default to 4-tabs
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
   464
    ^ DefaultTabPositions ? self tab4Positions
6213
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   465
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   466
    "Modified (comment): / 12-10-2017 / 13:15:41 / cg"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   467
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   468
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   469
defaultTabPositions:aVector
6213
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   470
    "set the array containing the styleSheet's tab positions"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   471
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   472
    DefaultTabPositions := aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   473
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   474
    "
3777
4a9854ac7ab0 default to 4-tabs
Claus Gittinger <cg@exept.de>
parents: 3624
diff changeset
   475
     ListView defaultTabPositions:(ListView tab4Positions)
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   476
    "
6213
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   477
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   478
    "Modified (comment): / 12-10-2017 / 13:15:32 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   479
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   480
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   481
tab4Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   482
    "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
   483
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   484
    ^ #(1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81
6458
297f87a2587b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6451
diff changeset
   485
        85 89 93 97 101 105 109 113 117 121 125 129 133 137 141 145)
120
claus
parents: 118
diff changeset
   486
!
claus
parents: 118
diff changeset
   487
claus
parents: 118
diff changeset
   488
tab8Positions
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
   489
    "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
   490
120
claus
parents: 118
diff changeset
   491
    ^ #(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
   492
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   493
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   494
updateStyleCache
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   495
    "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
   496
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   497
    <resource: #style (#'text.foregroundColor' #'text.backgroundColor'
6336
034ad643fe9a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
   498
                       #'text.tabPositions'
034ad643fe9a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
   499
                       #'text.font'
034ad643fe9a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
   500
                       #'text.topMargin'
034ad643fe9a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
   501
                       #'text.leftMargin')>
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   502
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   503
    DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Color black.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   504
    DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:Color white.
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1351
diff changeset
   505
    DefaultFont := StyleSheet fontAt:'text.font'.
5617
5d91923f148e #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5585
diff changeset
   506
    "/ that's not style, but a personal setting
5d91923f148e #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5585
diff changeset
   507
    "/ DefaultTabPositions := StyleSheet at:'text.tabPositions'.
5d91923f148e #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5585
diff changeset
   508
    "/ DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions].
6336
034ad643fe9a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
   509
    DefaultLeftMargin := StyleSheet at:'text.leftMargin' default:0.5.
034ad643fe9a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
   510
    DefaultTopMargin := StyleSheet at:'text.topMargin' default:0.5.
439
4c6799ace14b added style resource directive
Claus Gittinger <cg@exept.de>
parents: 427
diff changeset
   511
5617
5d91923f148e #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 5585
diff changeset
   512
    "Modified: / 31-03-2016 / 10:49:45 / cg"
6336
034ad643fe9a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6304
diff changeset
   513
    "Modified: / 12-06-2018 / 11:19:36 / Claus Gittinger"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   514
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   515
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   516
userDefaultTabPositions
6213
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   517
    "return an array containing the user's default tab positions"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   518
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   519
    ^ UserDefaultTabPositions
6213
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   520
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   521
    "Modified (comment): / 12-10-2017 / 13:15:19 / cg"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   522
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   523
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   524
userDefaultTabPositions:aVector
6213
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   525
    "set the array containing the user's tab positions"
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   526
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   527
    UserDefaultTabPositions := aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   528
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   529
    "
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   530
     self userDefaultTabPositions:(self tab4Positions)
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
   531
    "
6213
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   532
19e9bfd31785 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6186
diff changeset
   533
    "Modified (comment): / 12-10-2017 / 13:15: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
   534
! !
75b8fb924904 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
75b8fb924904 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
!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
   537
75b8fb924904 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
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
   539
    "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
   540
     - 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
   541
     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
   542
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   543
    ^ height - (2 * margin) - topMargin
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   544
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   545
2133
47a23fdfc83f comment
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
   546
!ListView methodsFor:'accessing-behavior'!
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   547
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   548
checkLineEndConventionWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   549
    "return the line-end convention check when updating behavior.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   550
     If true (the default), the first line of the list given is checked for having a
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   551
     cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   552
     If false, the lineEndCRLF remains as specified by the user.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   553
     You may want to disable this flag if it is very expensive to generate a line
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   554
     (although, only the very first line is checked, anyway)"
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   555
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   556
    ^ checkLineEndConventionWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   557
!
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   558
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   559
checkLineEndConventionWhenUpdating:aBoolean
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   560
    "define the line-end convention check when updating behavior.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   561
     If true (the default), the first line of the list given is checked for having a
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   562
     cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   563
     If false, the lineEndCRLF remains as specified by the user.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   564
     You may want to disable this flag if it is very expensive to generate a line
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   565
     (although, only the very first line is checked, anyway)"
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   566
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   567
    checkLineEndConventionWhenUpdating := aBoolean
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   568
!
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   569
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   570
checkedLinesForWidthOfContentsComputation
5861
fb4a87d71c31 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5843
diff changeset
   571
    "return how many and which lines to consider in the widthOfContents computation,
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   572
     which is needed by the scrollBar interface.
6229
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   573
     
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   574
     If nil (the default), all lines are processed and the width of the longest line is taken.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   575
     If positive, that number of lines is checked near the start of the text,
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   576
     if negative, from the end of the text.
6229
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   577
     If 0, the width is dynamically readjusted, as lines are drawn.
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   578
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   579
     You may want to change this to 1 if it is guaranteed that all linesa are of the same width,
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   580
     or -1, if all are shorter than the last line.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   581
     (useful, for example, when it is very expensive to generate all lines, and a huge number
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   582
     of same-width lines is generated through a virtual array)"
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   583
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   584
    ^ checkedLinesForWidthOfContentsComputation
6229
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   585
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   586
    "Modified (comment): / 19-11-2017 / 14:09:19 / cg"
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   587
!
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   588
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   589
checkedLinesForWidthOfContentsComputation:aNumberOrNil
5861
fb4a87d71c31 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5843
diff changeset
   590
    "set how many and which lines to consider in the widthOfContents computation,
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   591
     which is needed by the scrollBar interface.
6229
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   592
     
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   593
     If nil (the default), all lines are processed and the width of the longest line is taken.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   594
     If positive, that number of lines is checked near the start of the text,
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   595
     if negative, from the end of the text.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   596
     If 0, the width is dynamically re adjusted, as lines are drawn.
6229
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   597
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   598
     You may want to change this to 1 if it is guaranteed that all linesa are of the same width,
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   599
     or -1, if all are shorter than the last line.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   600
     (useful, for example, when it is very expensive to generate all lines, and a huge number
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   601
     of same-width lines is generated through a virtual array)"
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   602
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   603
    checkedLinesForWidthOfContentsComputation := aNumberOrNil
6229
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   604
cf5f0b56bee3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6214
diff changeset
   605
    "Modified (comment): / 19-11-2017 / 14:09:13 / cg"
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   606
!
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
   607
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   608
compareModelWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   609
    "return the compare when updating behavior.
6231
6f595d553519 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6229
diff changeset
   610
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   611
     If true (the default), the list of lines as given due to a model update
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   612
     is processed and compared against the currently shown text.
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   613
     If they are the same, no action is taken.
6231
6f595d553519 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6229
diff changeset
   614
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   615
     This behavior is ok in 99.99% of all applications.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   616
     However, you may turn this off iff:
6231
6f595d553519 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6229
diff changeset
   617
        - it is very expensive to process the list (for example, because the list
6f595d553519 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6229
diff changeset
   618
          is defined by a virtual array, which computes the lines dynamically, on
6f595d553519 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6229
diff changeset
   619
          the fly).
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   620
     One use where this flag should be turned off is in the hex-memory display,
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   621
     which is able to simulate texts with millions of lines, but they are actually
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   622
     simulated by generating the presented lines dynamically, as they are displayed."
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   623
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   624
    ^ compareModelOnUpdate
6231
6f595d553519 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6229
diff changeset
   625
6f595d553519 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6229
diff changeset
   626
    "Modified (comment): / 19-11-2017 / 14:14:04 / cg"
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   627
!
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   628
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   629
compareModelWhenUpdating:aBoolean
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   630
    "define the compare when updating behavior.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   631
     If true (the default), the list of lines as given due to a model update
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   632
     is processed and compared against the currently shown text.
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   633
     If they are the same, no action is taken.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   634
     This behavior is ok in 99.99% of all applications.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   635
     However, you may turn this off iff:
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   636
	- it is very expensive to process the list (for example, because the list
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   637
	  is defined by a virtual array, which computes the lines dynamically, on
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   638
	  the fly).
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   639
     One use where this flag should be turned off is in the hex-memory display,
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   640
     which is able to simulate texts with millions of lines, but they are actually
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   641
     simulated by generating the presented lines dynamically, as they are displayed."
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   642
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   643
    compareModelOnUpdate := aBoolean
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   644
!
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   645
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   646
expandTabsWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   647
    "return the tab expansion behavior.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   648
     If true (the default), the list of lines as given via #list: or
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   649
     due to a model update is processed and lines are replaced by lines with
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   650
     tabs expanded.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   651
     This behavior is ok in 99.99% of all applications.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   652
     However, you may turn this off iff:
5843
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   653
        - you are certain, that no tabs are in the passed in list
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   654
        - it is very expensive to process the list (for example, because the list
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   655
          is defined by a virtual array, which computes the lines dynamically, on the fly).
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   656
     One use where this flag should be turned off is in the hex-memory display,
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   657
     which is able to simulate texts with millions of lines, but they are actually
5843
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   658
     simulated by generating the presented lines dynamically, as they are displayed.
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   659
     Notice, that to totally prevent scanning og the whole text, you may have to turn off
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   660
     other flags, such as checkineEndConventionWhenUpdating"
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   661
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   662
    ^ expandTabsWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   663
!
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   664
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   665
expandTabsWhenUpdating:aBoolean
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   666
    "define the tab expansion behavior.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   667
     If true (the default), the list of lines as given via #list: or
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   668
     due to a model update is processed and lines are replaced by lines with
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   669
     tabs expanded.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   670
     This behavior is ok in 99.99% of all applications.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   671
     However, you may turn this off iff:
5843
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   672
        - you are certain, that no tabs are in the passed in list
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   673
        - it is very expensive to process the list (for example, because the list
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   674
          is defined by a virtual array, which computes the lines dynamically, on the fly).
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   675
     One use where this flag should be turned off is in the hex-memory display,
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   676
     which is able to simulate texts with millions of lines, but they are actually
5843
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   677
     simulated by generating the presented lines dynamically, as they are displayed.
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   678
     Notice, that to totally prevent scanning og the whole text, you may have to turn off
9424b22fcb80 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5818
diff changeset
   679
     other flags, such as checkineEndConventionWhenUpdating"
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   680
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   681
    expandTabsWhenUpdating := aBoolean
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   682
!
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
   683
6179
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   684
isReadOnly
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   685
    "return true, if the text is readonly."
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   686
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   687
    ^ true
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   688
!
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   689
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   690
lineEndCRLF
4610
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   691
    "answer true, if CRLF is used for the line end.
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   692
     This is true for DOS/Windows files.
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   693
     Otherwise 'Character cr' is the line end (which is LF in unix)"
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   694
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   695
    ^ lineEndCRLF ? false
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   696
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   697
    "Created: / 04-07-2006 / 19:05:01 / fm"
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   698
!
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   699
6179
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   700
readOnly:aBoolean
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   701
    "for protocol compatibility with editTextViews,
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   702
     but actually ignored"
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   703
!
85ed7184791d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6164
diff changeset
   704
2325
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   705
scrollWhenUpdating
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   706
    "return the scroll behavior, when I get a new text
2325
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   707
     (via the model or the #contents/#list)
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   708
     Possible returnValues are:
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   709
	#keep / nil     -> no change
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   710
	#endOfText      -> scroll to the end
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   711
	#beginOfText    -> scroll to the top
3116
2df69a526f06 default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
   712
     The default is #keep.
2325
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   713
     This may be useful for fields which get new values assigned from
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   714
     the program (i.e. not from the user)"
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   715
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   716
    ^ scrollWhenUpdating
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   717
!
3d0f2d7f69d9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2322
diff changeset
   718
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   719
scrollWhenUpdating:aSymbolOrNil
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   720
    "define how to scroll, when I get a new text
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   721
     (via the model or the #contents/#list)
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   722
     Allowed arguments are:
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   723
	#keep / nil     -> no change
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   724
	#endOfText      -> scroll to the end
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   725
	#beginOfText    -> scroll to the top
3116
2df69a526f06 default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
   726
     The default is #keep.
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   727
     This may be useful for fields which get new values assigned from
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   728
     the program (i.e. not from the user)"
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   729
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   730
    scrollWhenUpdating := aSymbolOrNil
4403
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   731
!
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   732
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   733
wordCheckBlock:aBlock
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   734
    "set the word-check block - this block is called with a character argument,
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   735
     when the end/beginning of a word is searched.
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   736
     It should return true, if the character belongs to the word.
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   737
     The default block is set in #initialize, and returns true for alphanumeric
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   738
     (national) characters.
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   739
     Applications may change it to include underlines, dollars or other characters.
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   740
     (a C/C++ editor would include underlines ...)"
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   741
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   742
    wordCheck := aBlock.
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   743
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
   744
    "Modified: 22.5.1996 / 12:26:55 / cg"
2132
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   745
! !
5d91bceb675f comment
Claus Gittinger <cg@exept.de>
parents: 2128
diff changeset
   746
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   747
!ListView methodsFor:'accessing-contents'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   748
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   749
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
   750
    "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
   751
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   752
    |fontHeightBefore|
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   753
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   754
    list isNil ifTrue:[list := StringCollection 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
   755
    list add:aString.
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   756
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   757
    includesNonStrings ifFalse:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   758
        includesNonStrings := (aString notNil and:[(aString isSingleByteString) not]).
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   759
        includesNonStrings ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   760
            fontHeightBefore := fontHeight.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   761
            self getFontParameters.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   762
            fontHeightBefore ~~ fontHeight ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   763
                self invalidate
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   764
            ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   765
        ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   766
    ].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   767
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   768
    widthOfWidestLine notNil ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   769
        self recomputeWidthOfWidestLineFor:aString old:nil.
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   770
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   771
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   772
    shown ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   773
        self redrawLine:(self size).
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   774
    ].
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   775
    self enqueueDelayedContentsChangedNotification.             "recompute scrollbars"
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   776
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   777
    "Modified: / 25-07-2012 / 12:00: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
   778
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   779
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   780
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
   781
    "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
   782
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   783
    |lastShown|
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   784
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   785
    list isNil ifTrue:[list := StringCollection 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
   786
    list add:aString beforeIndex:index.
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   787
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   788
    widthOfWidestLine notNil ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   789
        self recomputeWidthOfWidestLineFor:aString old:nil.
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   790
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   791
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   792
    includesNonStrings ifFalse:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   793
        includesNonStrings := (aString notNil and:[(aString isSingleByteString) not]).
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
   794
"/        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
   795
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   796
    shown ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   797
        lastShown := self lastLineShown.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   798
        index <= 2 ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   799
            self invalidate
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   800
        ] ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   801
            index to:lastShown do:[:eachLine |
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   802
                self invalidateLine:eachLine
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   803
            ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   804
        ].
2182
fb9bc638123a mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents: 2181
diff changeset
   805
    ].
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   806
    self enqueueDelayedContentsChangedNotification.  "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
   807
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   808
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   809
        "/ self selection isNil ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   810
            self scrollToBottom.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   811
        "/ ]
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   812
    ].
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   813
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   814
    "Modified: / 25-07-2012 / 12:00:42 / cg"
65
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   815
!
b33e4f3a264e *** empty log message ***
claus
parents: 63
diff changeset
   816
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   817
addAll:aCollectionOfLines beforeIndex:index
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   818
    "add a bunch of lines and redisplay"
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   819
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   820
    |lastShown|
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   821
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   822
    list isNil ifTrue:[list := StringCollection new].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   823
    aCollectionOfLines do:[:eachLine |
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   824
        list addAll:aCollectionOfLines beforeIndex:index.
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   825
    ].
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   826
    includesNonStrings ifFalse:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   827
        includesNonStrings :=
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   828
            aCollectionOfLines
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   829
                contains:[:someLine |
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   830
                    someLine notNil and:[(someLine isSingleByteString) not].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   831
                ]
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   832
    ].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   833
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   834
    widthOfWidestLine notNil ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   835
        aCollectionOfLines do:[:eachLine |
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   836
            self recomputeWidthOfWidestLineFor:eachLine old:nil.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   837
        ].
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   838
    ].
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   839
"/    widthOfWidestLine := nil. "/ i.e. unknown
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   840
    self textChanged.
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   841
2348
630ad2e7092e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
   842
    shown ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   843
        lastShown := self lastLineShown.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   844
        ((index-1) <= lastShown) ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   845
            index <= 2 ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   846
                self invalidate
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   847
            ] ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   848
                index-1 to:lastShown do:[:eachLine |
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   849
                    self invalidateLine:eachLine
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   850
                ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   851
                "/  self redrawFromLine:index-1.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   852
            ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   853
        ].
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   854
    ].
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   855
    self enqueueDelayedContentsChangedNotification.  "recompute scrollbars"
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   856
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   857
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   858
        "/ self selection isNil ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   859
            self scrollToBottom.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   860
        "/ ]
2257
d095d1e0779e care for scrollWhenUpdating when adding individual lines
src
parents: 2249
diff changeset
   861
    ].
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   862
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   863
    "Modified: / 25-07-2012 / 12:00:54 / cg"
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   864
!
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2237
diff changeset
   865
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   866
at:lineNr
6186
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
   867
    "retrieve a line's item; 
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
   868
     return nil if beyond end-of-text.
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
   869
     this allows textViews to be used like collections in some places.
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
   870
     Notice: for text lists, this returns strings (same as listAt:);
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
   871
     for non-text lists, the item is returned."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   872
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   873
    list isNil ifTrue:[^ nil].
6248
74cd4f46a0d8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6239
diff changeset
   874
    (lineNr between:1 and:list size) ifFalse:[^ nil].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   875
    ^ list at:lineNr
6186
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
   876
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
   877
    "Modified (comment): / 18-07-2017 / 13:35:26 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   878
!
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   879
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   880
at:index put:aString
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   881
    "change a line and redisplay"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   882
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
   883
    |fontHeightBefore widthBefore|
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   884
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
   885
    fontHeightBefore := fontHeight.
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   886
    widthBefore := widthOfWidestLine.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   887
    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
   888
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   889
    shown ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   890
        fontHeightBefore ~= fontHeight ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   891
            "/ must redraw everything
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   892
            self invalidate.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   893
            ^ self
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   894
        ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   895
        self redrawLine:index.
2219
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   896
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   897
"/ the code below is wrong - we really have to redraw everything, if the
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   898
"/ fontHeight changes (due to a labelAndIcon in the list).
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   899
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   900
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   901
"/        "/ this could have changed the font height;
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   902
"/        "/ must clear all below last line, if it became smaller
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   903
"/        fontHeightBefore > fontHeight ifTrue:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   904
"/            (self listLineIsVisible:(self size)) ifTrue:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   905
"/                self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1))
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   906
"/                                    corner:(width-margin) @ (height-margin).
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   907
"/            ].
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   908
"/            self redrawFromLine:index
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   909
"/        ] ifFalse:[
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   910
"/            self redrawLine:index
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   911
"/        ].
9ffca3757666 fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents: 2216
diff changeset
   912
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   913
        "/ asynchronous:
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   914
"/        visibleLine := self listLineToVisibleLine:index.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   915
"/        visibleLine notNil ifTrue:[
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   916
"/            y := self yOfVisibleLine:visibleLine.
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   917
"/            self invalidate:((margin @ y) extent:(width@fontHeight))
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   918
"/        ].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
   919
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   920
        widthBefore ~~ widthOfWidestLine ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   921
            self enqueueDelayedContentsChangedNotification
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
   922
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   923
    ]
1194
4707499d3308 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
   924
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
   925
    "Modified: / 25-07-2012 / 12:01:46 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   926
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   927
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   928
characterAtCharacterPosition:charPos
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   929
    "return the character at a 1-based character position.
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   930
     Return a space character if nothing is there
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2687
diff changeset
   931
     (i.e. beyond the end of the line or below the last line)"
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   932
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   933
    |line col|
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   934
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   935
    line := self lineOfCharacterPosition:charPos.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   936
    col := charPos - (self characterPositionOfLine:line col:1) + 1.
2443
9a1258c6dcbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2431
diff changeset
   937
    col == 0 ifTrue:[^ Character cr].
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   938
    ^ self characterAtLine:line col:col
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   939
!
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
   940
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   941
characterAtLine:lineNr col:colNr
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   942
    "return the character at physical line/col.
6155
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   943
     The lineNr and colNr arguments start at 1, for the top-left character.
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   944
     Return a space character if nothing is there
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2687
diff changeset
   945
     (i.e. beyond the end of the line or below the last line)"
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   946
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   947
    |line|
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   948
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   949
    list notNil ifTrue:[
6155
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   950
        line := self listAt:lineNr.
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   951
        line notNil ifTrue:[
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   952
            (line size >= colNr) ifTrue:[
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   953
                ^ line at:colNr
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   954
            ]
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   955
        ]
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   956
    ].
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   957
    ^ Character space
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   958
6155
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   959
    "Created: / 29-04-1996 / 12:11:00 / cg"
ed122bb2a18a #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 6098
diff changeset
   960
    "Modified (comment): / 11-05-2017 / 17:11:16 / stefan"
598
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   961
!
5d5194703de8 characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   962
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   963
contents
4610
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   964
    "return the contents as a string, terminated by the line end character (sequence)"
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   965
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   966
    |stringCollection lineEnd|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   967
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
   968
    list isNil ifTrue:[^ ''].
4610
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   969
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   970
    self lineEndCRLF ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   971
	lineEnd := String crlf.
4610
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   972
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   973
	lineEnd := Character cr.
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   974
    ].
4610
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   975
dcf585ff2309 class: ListView
Stefan Vogel <sv@exept.de>
parents: 4607
diff changeset
   976
    stringCollection := list asStringCollection.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   977
    ^ stringCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   978
	asStringWith:lineEnd
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   979
	from:1 to:stringCollection size
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   980
	compressTabs:false
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
   981
	final:lineEnd
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   982
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
   983
    "Modified: / 04-07-2006 / 19:18:47 / fm"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   984
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   985
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   986
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
   987
    "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
   988
     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
   989
     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
   990
     to a collection of line-strings here."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   991
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   992
    |l|
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   993
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   994
    l := something.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   995
    l notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   996
	l isString ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   997
	    l := l asStringCollection
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
   998
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
   999
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1000
    self list:l
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1001
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1002
    "Modified: 5.6.1997 / 11:11:54 / cg"
51
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
  1003
!
e895ac4cc7c8 support non-string entries
claus
parents: 38
diff changeset
  1004
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1005
from:from to:to do:aBlock
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1006
    "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
  1007
3256
0e978bc1d5fd examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents: 3253
diff changeset
  1008
    list from:from to:to do:aBlock.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1011
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
  1012
    "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
  1013
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1014
    ^ 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
  1015
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1016
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1017
lineAtY:y
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1018
    "return the lineNr for a given y-(view-)coordinate"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1019
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1020
    |visibleLine|
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1021
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1022
    visibleLine := self visibleLineOfY:y.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1023
    visibleLine isNil ifTrue:[^ nil].
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1024
    ^ self visibleLineToListLine:visibleLine.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1025
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1026
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1027
list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1028
    "return the contents as a collection of strings.
5978
3b0995190969 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5947
diff changeset
  1029
     This returns the view's internal list - modifying it may confuse
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1030
     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
  1031
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1032
    ^ list
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1033
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1034
    "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
  1035
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1036
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1037
list:aCollection
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1038
    "set the contents (a collection of strings or list entries)
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1039
     and scroll as specified in scrollWhenUpdating (default:top-left).
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1040
     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
  1041
     Tabs are expanded (to spaces).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1042
     The passed list is scanned for nonStrings
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1043
     (remembered to optimize later redraws)."
128
claus
parents: 127
diff changeset
  1044
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  1045
    self list:aCollection expandTabs:expandTabsWhenUpdating
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  1046
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1047
    "Modified: 5.6.1997 / 11:10:45 / cg"
128
claus
parents: 127
diff changeset
  1048
!
claus
parents: 127
diff changeset
  1049
claus
parents: 127
diff changeset
  1050
list:aCollection expandTabs:expand
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1051
    "set the contents (a collection of strings)
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1052
     and scroll as specified in scrollWhenUpdating (default:top-left).
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1053
     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
  1054
     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
  1055
     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
  1056
4765
d6396c5510dd class: ListView
Claus Gittinger <cg@exept.de>
parents: 4759
diff changeset
  1057
    self list:aCollection expandTabs:expand scanForNonStrings:true
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1058
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1059
    "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
  1060
!
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1061
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1062
list:aCollection expandTabs:expand scanForNonStrings:scan
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1063
    "set the contents (a collection of strings)
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1064
     and scroll as specified in scrollWhenUpdating (default:top-left).
1240
1b3611a8e972 added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents: 1234
diff changeset
  1065
     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
  1066
     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
  1067
     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
  1068
     (remembered to optimize later redraws)."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1069
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1070
    self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1071
	list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nil
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1072
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1073
    "Modified: 5.6.1997 / 12:40:35 / cg"
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1074
!
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1075
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1076
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1077
    "set the contents (a collection of strings)
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1078
     and scroll as specified in scrollWhenUpdating (default:top-left).
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1079
     If expand is true, tabs are expanded (to spaces).
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1080
     If scan is true, scan the passed list for nonStrings;
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1081
     otherwise, take the information from the nonStrings arg.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1082
     (the nonStrings information is remembered to optimize later redraws & height computations)."
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1083
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1084
    self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1085
	list:aCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1086
	expandTabs:expand
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1087
	scanForNonStrings:scan
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1088
	includesNonStrings:nonStringsIfNoScan
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1089
	redraw:true
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1090
!
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1091
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1092
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1093
    "set the contents (a collection of strings)
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1094
     and scroll as specified in scrollWhenUpdating (default:top-left).
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1095
     If expand is true, tabs are expanded (to spaces).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1096
     If scan is true, scan the passed list for nonStrings;
1241
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1097
     otherwise, take the information from the nonStrings arg.
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1098
     (the nonStrings information is remembered to optimize later redraws & height computations)."
3dfb8ea324ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  1099
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  1100
    |oldFirst oldLeft nonStringsBefore fontHeightBefore
3821
5cba956b774a cadsoft
Claus Gittinger <cg@exept.de>
parents: 3819
diff changeset
  1101
     scrollToEnd scrollToTop newLeftOffset wText same firstLine|
2891
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1102
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1103
    "/ cg: what is the point in comparing here?
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1104
    "/ I think, if there is something to optimize,
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1105
    "/ the caller should do so (moved to getListFromModel).
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1106
    "/ notice, that it may be very expensive to ask aCollection for each line
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1107
    "/ for example, iff the lines are generated on the fly by an algorithm
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1108
    false ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1109
        "/ see if there is a change at all.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1110
        "/ use to compare using =, but that's not enough in case of emphasis change.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1111
        aCollection size == list size ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1112
            same := true.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1113
            aCollection size > 0 ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1114
                aCollection with:list do:[:eachNewLine :eachOldLine |
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1115
                    (eachNewLine == eachOldLine)
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1116
                    ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1117
                        same := false.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1118
                    ]
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1119
                ]
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1120
            ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1121
            same ifTrue:[^ self].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1122
        ].
2891
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1123
    ].
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  1124
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  1125
    scrollToTop := scrollWhenUpdating == #begin or:[scrollWhenUpdating == #beginOfText].
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  1126
    scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1127
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1128
    (aCollection isEmptyOrNil and:[list isEmptyOrNil]) ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1129
        "no contents change"
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1130
        list := aCollection.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1131
        scrollLocked ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1132
            scrollToTop ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1133
                self scrollToTop.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1134
            ] ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1135
                scrollToEnd ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1136
                    self scrollToBottom.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1137
                ]
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1138
            ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1139
            self scrollToLeft.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1140
        ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1141
        ^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1142
    ].
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  1143
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1144
    checkLineEndConventionWhenUpdating ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1145
        "Check if the we use DOS/Windows line end convention with CR LF.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1146
         The LF has already been consumed by the conversion to a StringCollection,
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1147
         now check for and remove the trailing left over CRs"
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1148
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1149
        lineEndCRLF := (aCollection size > 0
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1150
                        and:[(firstLine := aCollection at:1) isString
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1151
                        and:[firstLine notEmpty
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1152
                        and:[firstLine string endsWith:Character return]]]).
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1153
    ].
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  1154
    lineEndCRLF ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1155
        list := aCollection
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1156
                    collect:[:eachLineWithCROrNil |
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1157
                        eachLineWithCROrNil isNil
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1158
                            ifTrue:nil
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1159
                            ifFalse:[(eachLineWithCROrNil endsWith:Character return)
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1160
                                     ifTrue:[eachLineWithCROrNil copyButLast:1]
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1161
                                     ifFalse:[eachLineWithCROrNil]]].
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  1162
    ] ifFalse:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1163
        list := aCollection.
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  1164
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1165
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1166
    nonStringsBefore := includesNonStrings.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1167
    fontHeightBefore := fontHeight.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1168
    includesNonStrings := false.
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  1169
152
claus
parents: 148
diff changeset
  1170
    list notNil ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1171
        expand ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1172
            self expandTabs
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1173
        ] ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1174
            scan ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1175
                includesNonStrings := list contains:[:e | e isString not].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1176
            ] ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1177
                includesNonStrings := nonStringsIfNoScan ? nonStringsBefore
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1178
            ]
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1179
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1180
    ].
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1181
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1182
        self getFontParameters.
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1183
    ].
152
claus
parents: 148
diff changeset
  1184
125
claus
parents: 121
diff changeset
  1185
    widthOfWidestLine := nil.   "/ i.e. unknown
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1186
    oldFirst := firstLineShown.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  1187
    oldLeft := viewOrigin x.
2128
33830e4f998f added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents: 2090
diff changeset
  1188
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  1189
    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1190
        self computeNumberOfLinesShown.
2199
455cd1c65af1 auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents: 2188
diff changeset
  1191
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  1192
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1193
    scrollLocked ifFalse:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1194
        newLeftOffset := viewOrigin x.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1195
        scrollToTop ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1196
            firstLineShown := 1.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1197
            newLeftOffset := 0.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1198
        ] ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1199
            scrollToEnd ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1200
                firstLineShown := (list size - nFullLinesShown + 1) max:1.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1201
                newLeftOffset := 0.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1202
            ]
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1203
        ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1204
        newLeftOffset > 0 ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1205
            wText := self widthOfContents.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1206
            (viewOrigin x + self innerWidth) > wText ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1207
                newLeftOffset := (wText - self innerWidth) max:0.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1208
            ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1209
        ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1210
        newLeftOffset ~= oldLeft ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1211
            viewOrigin := newLeftOffset @ viewOrigin y.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1212
        ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  1213
    ].
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  1214
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 24
diff changeset
  1215
    realized ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1216
        self contentsChanged.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1217
        scrollLocked ifFalse:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1218
            "
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1219
             don't use scroll here to avoid double redraw
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1220
            "
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1221
            viewOrigin := viewOrigin isNil ifTrue:[0@0] ifFalse:[(viewOrigin x) @ 0].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1222
            gc transformation:nil.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1223
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1224
            oldFirst ~~ firstLineShown ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1225
                self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1226
            ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1227
        ].
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1228
        doRedraw ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1229
            shown ifTrue:[
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1230
                self invalidate.
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1231
            ]
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1232
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1233
    ]
153
claus
parents: 152
diff changeset
  1234
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  1235
    "Modified: / 30-08-1995 / 19:07:13 / claus"
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  1236
    "Created: / 05-06-1997 / 12:40:06 / cg"
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  1237
    "Modified: / 04-07-2006 / 19:12:39 / fm"
3339
ec4214f718df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3317
diff changeset
  1238
    "Modified: / 22-08-2006 / 11:59:56 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1239
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1240
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1241
listAt:lineNr
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1242
    "given a lineNumber, return the corresponding string
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1243
     This is used for accessing; i.e. for non-string entries, this
6186
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
  1244
     returns the corresponding string.
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
  1245
     Use #at: to get to the real item (if it is not a string)"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1246
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1247
    |l|
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1248
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1249
    l := self at:lineNr.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1250
    l isNil ifTrue:[^ l].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1251
    ^ self visibleStringFrom:l "/ l asString
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1252
6186
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
  1253
    "Modified: / 07-09-1995 / 15:54:59 / claus"
f0026b792a12 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6179
diff changeset
  1254
    "Modified: / 18-07-2017 / 13:35:54 / cg"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1255
!
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  1256
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1257
removeFromIndex:startLineNr toIndex:endLineNr
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1258
    "delete some lines"
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1259
3442
418b14cb6a78 do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  1260
    |nLines widestLineRemoved|
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1261
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1262
    list isNil ifTrue:[^ self].
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1263
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1264
    widestLineRemoved := self widthOfWidestLineBetween:startLineNr and:endLineNr.
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1265
    list removeFromIndex:startLineNr toIndex:(endLineNr min:list size).
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1266
3442
418b14cb6a78 do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  1267
    widthOfWidestLine == widestLineRemoved ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1268
	widthOfWidestLine := nil. "/ i.e. unknown
3442
418b14cb6a78 do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents: 3437
diff changeset
  1269
    ].
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1270
    self textChanged.
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1271
2237
43f0318a830e scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents: 2233
diff changeset
  1272
    ((startLineNr <= self lastLineShown)
43f0318a830e scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents: 2233
diff changeset
  1273
    and:[endLineNr >= firstLineShown]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1274
	startLineNr to:self lastLineShown do:[:eachLine |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1275
	    self invalidateLine:eachLine
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1276
	].
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1277
    ].
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1278
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1279
    nLines := list size.
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1280
    (firstLineShown >= nLines) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1281
	self makeLineVisible:nLines
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1282
    ].
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1283
    self enqueueDelayedContentsChangedNotification.
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1284
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1285
    "Modified: / 25-07-2012 / 12:01:59 / cg"
2233
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1286
!
ea4d220ac381 added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  1287
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1288
removeIndex:lineNr
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1289
    "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
  1290
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1291
    |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
  1292
     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
  1293
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1294
    (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
  1295
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1296
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1297
     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
  1298
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1299
    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
  1300
    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
  1301
    visLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1302
	w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
1433
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
  1303
"/        x := textStartLeft.
9aa43cddb83e leftOver selection pixels
ca
parents: 1429
diff changeset
  1304
"/ CLAUS fixes leftOver selection pixels
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1305
	w := w + leftMargin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1306
	x := margin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1307
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1308
	srcY := topMargin + (visLine * fontHeight).
1453
d07b4b418106 oops - that should do it
Claus Gittinger <cg@exept.de>
parents: 1452
diff changeset
  1309
"/        h := ((nLinesShown - visLine) * fontHeight).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1310
	h := (height - margin - srcY).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1311
	h > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1312
	    self catchExpose.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1313
	    self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1314
		copyFrom:self
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1315
		x:x y:srcY
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1316
		toX:x y:(srcY - fontHeight)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1317
		width:w height:h
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1318
		async:true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1319
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1320
	self redrawVisibleLine:nFullLinesShown.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1321
	"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1322
	 redraw last partial line - if any
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1323
	"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1324
	(nFullLinesShown ~~ nLinesShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1325
	    self redrawVisibleLine:nLinesShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1326
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1327
	h > 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1328
	    self waitForExpose
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1329
	].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1330
    ]
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1331
1460
b9929a029249 dont bitBlt if height is <= 0
Claus Gittinger <cg@exept.de>
parents: 1458
diff changeset
  1332
    "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
  1333
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1334
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1335
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
  1336
    "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
  1337
     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
  1338
     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
  1339
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1340
    (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
  1341
    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
  1342
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1343
    lineNr < firstLineShown ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1344
	firstLineShown := firstLineShown - 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1345
    ].
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1346
    self enqueueDelayedContentsChangedNotification.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1347
    ^ true
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1348
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1349
    "Modified: / 25-07-2012 / 12:02:09 / 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
  1350
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1351
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1352
replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1353
    "replace some lines"
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1354
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1355
    list isNil ifTrue:[ list := StringCollection new:endLineNr ].
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1356
    list replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex.
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1357
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1358
    widthOfWidestLine := nil. "/ i.e. unknown
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1359
    self textChanged.
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1360
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1361
    ((startLineNr <= self lastLineShown)
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1362
    and:[endLineNr >= firstLineShown]) ifTrue:[
6304
93a632d04f8c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6293
diff changeset
  1363
        self invalidate.
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1364
    ].
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1365
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1366
    self enqueueDelayedContentsChangedNotification.
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1367
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1368
    "Modified: / 25-07-2012 / 12:02:15 / cg"
2248
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1369
!
c6cb654bb807 added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents: 2246
diff changeset
  1370
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1371
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
  1372
    "set the contents (either a string or a Collection of strings)
5947
e20b025f658d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
  1373
     don't change position (i.e. do not scroll).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1374
     This can be used to update a self-changing list
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1375
     (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
  1376
     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
  1377
2891
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1378
    |l|
b80cded98b85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1379
249
75b8fb924904 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
    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
  1381
    l notNil ifTrue:[
5947
e20b025f658d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
  1382
        l isString ifTrue:[
e20b025f658d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
  1383
            l := l asStringCollection
e20b025f658d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
  1384
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1385
    ].
75b8fb924904 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
    self setList:l.
267
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1387
cc8e122f7dbe Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents: 249
diff changeset
  1388
    "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
  1389
!
75b8fb924904 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
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1391
setList:aCollection
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1392
    "set the contents (a collection of strings);
153
claus
parents: 152
diff changeset
  1393
     do not change position (i.e. do not scroll).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1394
     This can be used to update a self-changing list
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1395
     (for example: a file list being shown, without disturbing user too much)"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1396
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1397
    ^ self setList:aCollection expandTabs:true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1398
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1399
153
claus
parents: 152
diff changeset
  1400
setList:aCollection expandTabs:expandTabs
claus
parents: 152
diff changeset
  1401
    "set the contents (a collection of strings);
claus
parents: 152
diff changeset
  1402
     do not change position (i.e. do not scroll).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1403
     This can be used to update a self-changing list
153
claus
parents: 152
diff changeset
  1404
     (for example: a file list being shown, without disturbing the user too much)"
claus
parents: 152
diff changeset
  1405
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1406
    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
  1407
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1408
    "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
  1409
!
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1410
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1411
setList:aCollection expandTabs:expandTabs redraw:doRedraw
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1412
    "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
  1413
     do not change position (i.e. do not scroll).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1414
     This can be used to update a self-changing list
1497
5b55a84e2258 added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
  1415
     (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
  1416
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1417
    self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1418
	setList:aCollection expandTabs:expandTabs scanForNonStrings:true includesNonStrings:nil
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1419
	redraw:doRedraw
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1420
!
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1421
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1422
setList:aCollection expandTabs:expandTabs scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1423
    "set the contents (a collection of strings);
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1424
     do not change position (i.e. do not scroll).
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1425
     This can be used to update a self-changing list
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1426
     (for example: a file list being shown, without disturbing the user too much).
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1427
    TODO: this stinks: most of the code is the same as in #list:expandTabs:...
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1428
	  needs a refactoring"
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1429
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1430
    |prev|
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1431
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1432
    prev := scrollLocked.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1433
    [
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1434
	scrollLocked := false.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1435
	self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1436
	    list:aCollection
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1437
	    expandTabs:expandTabs
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1438
	    scanForNonStrings:scan
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1439
	    includesNonStrings:nonStringsIfNoScan
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1440
	    redraw:doRedraw
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1441
    ] ensure:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1442
	scrollLocked := prev
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1443
    ].
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1444
"/
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1445
"/
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1446
"/"/                scrollLocked ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1447
"/"/                    self setList:newText expandTabs:expandTabsWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1448
"/"/                ] ifFalse:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1449
"/                    self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1450
"/"/                ]
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1451
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1452
"/    |oldFirst nonStringsBefore|
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1453
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1454
"/    (aCollection isNil and:[list isNil]) ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1455
"/        "no change"
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1456
"/        ^ self
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1457
"/    ].
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1458
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1459
"/    list := aCollection.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1460
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1461
"/    nonStringsBefore := includesNonStrings.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1462
"/    includesNonStrings := false.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1463
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1464
"/    list notNil ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1465
"/        expandTabs ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1466
"/            self expandTabs
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1467
"/        ] ifFalse:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1468
"/            scan ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1469
"/                includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1470
"/            ] ifFalse:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1471
"/                includesNonStrings := nonStringsIfNoScan ? nonStringsBefore
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1472
"/            ]
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1473
"/        ].
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1474
"/    ].
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1475
"/    (includesNonStrings ~~ nonStringsBefore) ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1476
"/        self getFontParameters.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1477
"/        self computeNumberOfLinesShown.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1478
"/    ].
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1479
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1480
"/    "/ new: reposition horizontally if too big
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1481
"/    widthOfWidestLine := nil.   "/ i.e. unknown
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1482
"/    innerWidth >= self widthOfContents ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1483
"/        viewOrigin := 0 @ viewOrigin y.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1484
"/    ].
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1485
"/    self contentsChanged.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1486
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1487
"/    "/ new: reposition vertically if too big
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1488
"/    (firstLineShown + nFullLinesShown) > self size ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1489
"/        oldFirst := firstLineShown.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1490
"/        firstLineShown := self size - nFullLinesShown + 1.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1491
"/        firstLineShown < 1 ifTrue:[firstLineShown := 1].
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1492
"/        oldFirst ~= firstLineShown ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1493
"/            viewOrigin y:((firstLineShown - 1) * fontHeight).
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1494
"/            self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1495
"/            shown ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1496
"/                self clearView.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1497
"/            ]
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1498
"/        ]
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1499
"/    ].
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1500
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1501
"/    (shown and:[doRedraw]) ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1502
"/        self invalidate
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1503
"/        "/ self redrawFromVisibleLine:1 to:nLinesShown
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1504
"/    ]
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1505
"/
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1506
"/    "Modified: / 18.12.1995 / 23:27:54 / stefan"
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1507
"/    "Created: / 22.4.1998 / 11:11:51 / cg"
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  1508
"/    "Modified: / 26.7.1998 / 13:46:49 / cg"
153
claus
parents: 152
diff changeset
  1509
!
claus
parents: 152
diff changeset
  1510
249
75b8fb924904 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
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
  1512
    "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
  1513
     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
  1514
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1515
    ^ list size.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1516
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1517
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1518
stringAtLine:lineNr from:col1 to:col2
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1519
    "return the substring starting at physical line/col1, up-to and
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1520
     including col2.
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1521
     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
  1522
     Fills the string with space characters at the right.
2707
810c994db0b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2687
diff changeset
  1523
     (i.e. beyond the end of the line or below the last line)"
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1524
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1525
    |line len s|
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1526
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1527
    len := col2 - col1 + 1.
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1528
    list notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1529
	line := self listAt:lineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1530
	line notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1531
	    (line size >= col1) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1532
		s := line copyFrom:col1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1533
		s size < len ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1534
		    ^ s paddedTo:len
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1535
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1536
		^ s copyTo:len
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1537
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1538
	]
919
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1539
    ].
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1540
    ^ String new:len withAll:Character space
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1541
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1542
    "Created: 7.1.1997 / 19:58:43 / cg"
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1543
!
f74955edb307 added #stringAtLine:from:to:
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1544
2427
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1545
textFromCharacterPosition:charPos1 to:charPos2
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1546
    "return some text as a collection of (line-)strings."
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1547
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1548
    |line1 col1 line2 col2|
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1549
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1550
    line1 := self lineOfCharacterPosition:charPos1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1551
    col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1552
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1553
    line2 := self lineOfCharacterPosition:charPos2.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1554
    col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1555
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1556
    ^ self textFromLine:line1 col:col1 toLine:line2 col:col2.
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1557
!
43cc7ea39bac more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents: 2423
diff changeset
  1558
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1559
textFromLine:startLine col:startCol toLine:endLine col:endCol
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1560
    "return some text as a collection of (line-)strings."
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1561
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1562
    |text sz index last|
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1563
4422
9954fb1dc0a4 changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 4403
diff changeset
  1564
    startLine isNil ifTrue:[^ nil].
9954fb1dc0a4 changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 4403
diff changeset
  1565
    endLine isNil ifTrue:[^ nil].
9954fb1dc0a4 changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 4403
diff changeset
  1566
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1567
    (startLine == endLine) ifTrue:[
6019
a801624144ea #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5978
diff changeset
  1568
        "part of a line"
a801624144ea #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5978
diff changeset
  1569
        ^ StringCollection with:(self listAt:startLine from:startCol to:endCol)
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1570
    ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1571
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1572
    sz := endLine - startLine + 1.
6019
a801624144ea #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5978
diff changeset
  1573
    sz < 1 ifTrue:[^ StringCollection new].
2687
b6e87b6b88a1 checkin from browser
penk
parents: 2667
diff changeset
  1574
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1575
    text := StringCollection new:sz.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1576
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1577
    "get 1st and last (possibly) partial lines"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1578
    text at:1 put:(self listAt:startLine from:startCol).
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1579
    endCol == 0 ifTrue:[
6019
a801624144ea #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5978
diff changeset
  1580
        last := ''
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1581
    ] ifFalse:[
6019
a801624144ea #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5978
diff changeset
  1582
        last := self listAt:endLine to:endCol.
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1583
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1584
    text at:sz put:last.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1585
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1586
    "get bulk of text"
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1587
    index := 2.
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1588
    (startLine + 1) to:(endLine - 1) do:[:lineNr |
6019
a801624144ea #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5978
diff changeset
  1589
        text at:index put:(self listAt:lineNr).
a801624144ea #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5978
diff changeset
  1590
        index := index + 1
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1591
    ].
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1592
    ^ text
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1593
4422
9954fb1dc0a4 changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 4403
diff changeset
  1594
    "Created: / 22-02-2000 / 23:53:06 / cg"
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1595
!
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1596
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1597
withoutRedrawAt:index put:aString
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1598
    "change a line without redisplay and WITHOUT any sizeChange notifications.
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1599
     Somewhat dangerous, since scrollBars will not be informed about contents-changes.
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1600
     Use only if multiple lines are to be changed, and a sizeChanged is invoked by some other
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1601
     means at the end."
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1602
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  1603
    |didIncludeNonStrings oldLine|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1604
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1605
    self checkForExistingLine:index.
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1606
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1607
    oldLine := self listAt:index.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1608
    list at:index put:aString.
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1609
    oldLine ~= aString ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1610
	self textChanged
2180
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1611
    ].
d208b77444a7 must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1612
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1613
    didIncludeNonStrings := includesNonStrings.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1614
    includesNonStrings ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1615
	includesNonStrings := (aString notNil and:[(aString isSingleByteString) 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
  1616
    ] ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1617
	(aString isNil or:[(aString isSingleByteString)]) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1618
	    includesNonStrings := list contains:[:l | l notNil and:[(l isSingleByteString) not]].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1619
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1620
    ].
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  1621
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1622
    includesNonStrings ~~ didIncludeNonStrings ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1623
	self getFontParameters.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1624
	self computeNumberOfLinesShown
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1625
    ].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1626
249
75b8fb924904 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
    widthOfWidestLine notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1628
	self recomputeWidthOfWidestLineFor:aString old:oldLine.
1963
aa5d0f63db19 notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents: 1938
diff changeset
  1629
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  1630
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  1631
    "Modified: / 26.7.1998 / 13:00:14 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1632
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1633
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1634
!ListView methodsFor:'accessing-look'!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1635
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1636
backgroundColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1637
    "return the background color"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1638
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1639
    ^ bgColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1640
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1641
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1642
backgroundColor:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1643
    "set the background color of the contents"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1644
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1645
    bgColor ~~ aColor ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1646
	bgColor := aColor.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1647
	self viewBackground:bgColor.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1648
	self invalidate "/ clear; redraw
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1649
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1650
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1651
    "Modified: 3.5.1997 / 10:27:40 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1652
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1653
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1654
font:aFont
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1655
    "set the font for all shown text.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1656
     Redraws everything.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1657
     CAVEAT: with the addition of Text objects,
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1658
             this method is going to be obsoleted by a textStyle
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1659
             method, which allows specific control over
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1660
             normalFont/boldFont/italicFont parameters."
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1661
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1662
    aFont isNil ifTrue:[
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1663
        ^ self error:'nil font' mayProceed:true
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1664
    ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1665
    gc font ~~ aFont ifTrue:[
6497
2f8659f9ec75 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6471
diff changeset
  1666
        self flushCachedPreferredExtent.
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1667
        widthOfWidestLine := nil. "/ i.e. unknown
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1668
        super font:aFont.
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1669
        self getFontParameters.
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1670
        realized ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1671
            (gc font graphicsDevice == device) ifTrue:[
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1672
                self computeNumberOfLinesShown.
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1673
                shown ifTrue:[
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1674
                    self redrawFromVisibleLine:1 to:nLinesShown
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1675
                ]
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1676
            ].
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1677
            self enqueueDelayedContentsChangedNotification
6471
202a6dcf53d5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6458
diff changeset
  1678
        ].
202a6dcf53d5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6458
diff changeset
  1679
        self changed:#font.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1680
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1681
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  1682
    "Modified: / 25-07-2012 / 12:01:36 / cg"
6497
2f8659f9ec75 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6471
diff changeset
  1683
    "Modified: / 09-11-2018 / 20:16:05 / Claus Gittinger"
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1684
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1685
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1686
fontHeight:pixels
6510
aec3e789e521 #DOCUMENTATION by cgexept.de
Claus Gittinger <cg@exept.de>
parents: 6497
diff changeset
  1687
    "set the line height - that's the number of pixels,
aec3e789e521 #DOCUMENTATION by cgexept.de
Claus Gittinger <cg@exept.de>
parents: 6497
diff changeset
  1688
     by which lines are vertically separated (from top to top of next line)."
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1689
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1690
    fontHeight ~~ pixels ifTrue:[
6510
aec3e789e521 #DOCUMENTATION by cgexept.de
Claus Gittinger <cg@exept.de>
parents: 6497
diff changeset
  1691
        fontHeight := pixels.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1692
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1693
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1694
    "Created: 17.4.1997 / 01:41:33 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1695
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1696
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1697
foregroundColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1698
    "return the foreground color"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1699
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1700
    ^ fgColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1701
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1702
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1703
foregroundColor:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1704
    "set the foreground color"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1705
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1706
    fgColor ~~ aColor ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1707
	fgColor := aColor.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1708
	self invalidate
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1709
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1710
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1711
    "Modified: 29.5.1996 / 16:19:02 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1712
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1713
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1714
foregroundColor:color1 backgroundColor:color2
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1715
    "set both foreground and background colors"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1716
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1717
    ((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1718
	fgColor := color1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1719
	bgColor := color2.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1720
	self invalidate
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1721
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1722
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1723
    "Modified: 29.5.1996 / 16:19:05 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1724
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1725
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1726
innerHorizontalMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1727
    "return the margin between the left border and the 1st col"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1728
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1729
    ^ leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1730
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1731
    "Created: 16.1.1996 / 19:28:23 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1732
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1733
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1734
innerVerticalMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1735
    "return the margin between the top border and the 1st line"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1736
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1737
    ^ topMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1738
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1739
    "Created: 16.1.1996 / 19:28:00 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1740
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1741
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1742
leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1743
    "return the margin to left of 1st col"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1744
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1745
    ^ leftMargin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1746
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1747
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1748
leftMargin:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1749
    "set the margin between the left border and the 1st col"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1750
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1751
    leftMargin := aNumber.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1752
    textStartLeft := aNumber + margin.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1753
    innerWidth := width - aNumber - margin
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1754
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1755
    "Modified: 28.2.1996 / 19:32:55 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1756
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1757
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1758
level:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1759
    "set the 3D level - caught here to update text-position variables
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1760
     (which avoids many computations later)"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1761
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1762
    |newMargin|
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1763
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1764
    aNumber ~~ level ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1765
	newMargin := aNumber abs.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1766
	textStartLeft := leftMargin + newMargin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1767
	textStartTop := topMargin + newMargin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1768
	innerWidth := width - textStartLeft - newMargin.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1769
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1770
	super level:aNumber.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1771
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1772
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1773
    "Modified: 11.8.1997 / 02:59:15 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1774
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1775
4668
cced6c72d962 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4651
diff changeset
  1776
lineSpacing
cced6c72d962 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4651
diff changeset
  1777
    "get the lineSpacing - that's an additional number of pixels,
cced6c72d962 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4651
diff changeset
  1778
     by which lines are vertically separated."
cced6c72d962 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4651
diff changeset
  1779
cced6c72d962 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4651
diff changeset
  1780
    ^ lineSpacing
cced6c72d962 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4651
diff changeset
  1781
!
cced6c72d962 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4651
diff changeset
  1782
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1783
lineSpacing:pixels
4668
cced6c72d962 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4651
diff changeset
  1784
    "set the lineSpacing - that's an additional number of pixels,
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1785
     by which lines are vertically separated."
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1786
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1787
    lineSpacing ~~ pixels ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1788
	lineSpacing := pixels.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1789
	self getFontParameters.
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1790
    ]
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1791
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1792
    "Modified: 22.5.1996 / 12:22:29 / cg"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1793
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1794
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1795
partialLines:aBoolean
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1796
    "allow/disallow display of a last partial line"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1797
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1798
    partialLines := aBoolean.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1799
    self computeNumberOfLinesShown
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1800
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1801
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1802
topMargin:aNumber
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1803
    "set the margin between the top border and the 1st line"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1804
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1805
    topMargin := aNumber.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1806
    textStartTop := topMargin + margin.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1807
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1808
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1809
viewBackground:aColor
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1810
    super viewBackground:aColor.
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1811
    self isTextView ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1812
	self backgroundColor:aColor
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1813
    ].
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1814
! !
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
  1815
118
claus
parents: 116
diff changeset
  1816
!ListView methodsFor:'accessing-mvc'!
claus
parents: 116
diff changeset
  1817
249
75b8fb924904 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
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
  1819
    "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
  1820
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1821
    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
  1822
    aDictionary at:#listMessage put:listMsg
118
claus
parents: 116
diff changeset
  1823
!
claus
parents: 116
diff changeset
  1824
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1825
listMessage
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1826
    "return the listMsg selector;
5780
cf2d9f737b92 #OTHER by mawalch
mawalch
parents: 5759
diff changeset
  1827
     if non-nil, this is the message sent to the model (if any) to acquire
125
claus
parents: 121
diff changeset
  1828
     a new text upon change of the aspect.
120
claus
parents: 118
diff changeset
  1829
     This defaults to the aspect-selector."
118
claus
parents: 116
diff changeset
  1830
125
claus
parents: 121
diff changeset
  1831
    ^ listMsg
claus
parents: 121
diff changeset
  1832
!
claus
parents: 121
diff changeset
  1833
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1834
listMessage:aSymbol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1835
    "ST-80 compatibility: set the listMsg selector;
5780
cf2d9f737b92 #OTHER by mawalch
mawalch
parents: 5759
diff changeset
  1836
     if non-nil, this will be sent to the model (if any) to acquire a
125
claus
parents: 121
diff changeset
  1837
     new text upon change of the aspect.
claus
parents: 121
diff changeset
  1838
     This defaults to the aspect-selector."
claus
parents: 121
diff changeset
  1839
claus
parents: 121
diff changeset
  1840
    listMsg := aSymbol.
120
claus
parents: 118
diff changeset
  1841
!
claus
parents: 118
diff changeset
  1842
907
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1843
model:aModel
5029
a6854214b1f8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4987
diff changeset
  1844
    "define the receiver's model, from which the text is
5780
cf2d9f737b92 #OTHER by mawalch
mawalch
parents: 5759
diff changeset
  1845
     to be acquired via list- or aspect-messages, whenever its aspect
907
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1846
     changes."
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1847
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1848
    super model:aModel.
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1849
    self getListFromModel
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1850
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1851
    "Created: 31.12.1996 / 14:56:43 / stefan"
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
diff changeset
  1852
!
ea81777689f1 Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents: 903
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
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
  1855
    "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
  1856
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1857
    ^ self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:nil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1858
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1859
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1860
on:aModel aspect:aspectSymbol change:changeSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1861
    "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
  1862
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1863
    ^self on:aModel aspect:aspectSymbol change:changeSymbol list:aspectSymbol menu:nil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1864
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1865
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1866
on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol menu:menuSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1867
    "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
  1868
4015
8647dad37cb0 comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
  1869
    aspectSymbol notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1870
	aspectMsg := aspectSymbol.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1871
	listMsg isNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1872
	    listMsg := aspectSymbol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  1873
	]
4015
8647dad37cb0 comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
  1874
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1875
    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
  1876
    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
  1877
    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
  1878
    self model:aModel.
909
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1879
be8e88881f4d dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents: 907
diff changeset
  1880
    "Modified: 2.1.1997 / 16:11:16 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1881
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1882
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1883
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
  1884
    "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
  1885
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1886
    ^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1887
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1888
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1889
on:aModel aspect:aspectSymbol list:listSymbol menu:menuSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1890
    "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
  1891
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1892
    ^ self on:aModel aspect:aspectSymbol change:nil list:listSymbol menu:menuSymbol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1893
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1894
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1895
on:aModel aspect:aspectSymbol menu:menuSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1896
    "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
  1897
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1898
    ^self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:menuSymbol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1899
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1900
2227
58426f7611f2 category changes
Claus Gittinger <cg@exept.de>
parents: 2225
diff changeset
  1901
!ListView methodsFor:'change & update'!
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1902
75b8fb924904 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
update:something with:aParameter from:changedObject
2322
7d8f3c26a047 react to list-change messages
martin
parents: 2316
diff changeset
  1904
    |idx|
7d8f3c26a047 react to list-change messages
martin
parents: 2316
diff changeset
  1905
249
75b8fb924904 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
    changedObject == model ifTrue:[
5884
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1907
        model isList ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1908
            list ~~ model ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1909
                something == #at: ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1910
                    idx := aParameter isCollection ifTrue:[aParameter at:1]
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1911
                                                  ifFalse:[aParameter].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1912
                    ^ self at:aParameter put:(model at:idx).
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1913
                ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1914
                something == #insert: ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1915
                    (list size + 1) >= aParameter ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1916
                        ^ self add:(model at:aParameter) beforeIndex:aParameter
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1917
                    ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1918
                ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1919
                something == #remove: ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1920
                    list size >= aParameter ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1921
                        ^ self removeIndex:aParameter
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1922
                    ]
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1923
                ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1924
            ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1925
            self getListFromModel.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1926
            ^ self
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1927
        ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1928
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1929
        (aspectMsg notNil
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1930
        and:[something == aspectMsg]) ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1931
            self getListFromModel.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1932
            ^ self
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1933
        ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1934
        something isNil ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1935
            "/ model changed (not more information)
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1936
            self getListFromModel.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1937
            ^ self
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1938
        ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1939
        something == #size ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1940
            self getListFromModelScroll:false.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1941
            ^ self
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1942
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1943
    ].
3425
883607c8a0df care for listChannel changes
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  1944
    changedObject == listChannel ifTrue:[
5884
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1945
        self getListFromModel.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  1946
        ^ self
3425
883607c8a0df care for listChannel changes
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  1947
    ].
883607c8a0df care for listChannel changes
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  1948
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  1949
    ^ 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
  1950
3425
883607c8a0df care for listChannel changes
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  1951
    "Modified: / 08-11-2006 / 19:40:29 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1952
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1953
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1954
!ListView methodsFor:'drawing'!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  1955
6388
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1956
drawLine:line inVisible:visLineNr with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1957
    "draw a given string at visible lines position in fg/bg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1958
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1959
    self drawLine:line atX:(textStartLeft - viewOrigin x) inVisible:visLineNr with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1960
!
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1961
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1962
drawVisibleLine:visLineNr col:col with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1963
    "draw single character at col index of visible line in fg/bg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1964
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1965
    self
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1966
	drawLine:(self visibleAt:visLineNr)
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1967
	inVisible:visLineNr
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1968
	col:col
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1969
	with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1970
!
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1971
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1972
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1973
    "draw part of a visible line in fg/bg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1974
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1975
    self
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1976
	drawLine:(self visibleAt:visLineNr)
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1977
	inVisible:visLineNr
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1978
	from:startCol to:endCol
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1979
	with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1980
!
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1981
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1982
drawVisibleLine:visLineNr from:startCol with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1983
    "draw right part of a visible line from startCol to end of line in fg/bg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1984
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1985
    self
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1986
	drawLine:(self visibleAt:visLineNr)
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1987
	inVisible:visLineNr
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1988
	from:startCol
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1989
	with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1990
!
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1991
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1992
drawVisibleLine:visLineNr with:fg and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1993
    "draw a visible line in fg/bg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1994
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1995
    self
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1996
	drawLine:(self visibleAt:visLineNr)
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1997
	atX:(textStartLeft - viewOrigin x)
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1998
	inVisible:visLineNr
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  1999
	with:fg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2000
	and:bg
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2001
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2002
    "Modified: 28.2.1996 / 19:30:23 / cg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2003
!
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2004
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2005
fillRectangleX:x y:y width:w height:h
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2006
    "fill rectangle; checks whether the rectangle already is filled with
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2007
     the current paint (#redrawX:y:w:h)."
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2008
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2009
    backgroundAlreadyClearedColor ~~ self paint ifTrue:[
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2010
        super fillRectangleX:x y:y width:w height:h
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2011
    ]
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2012
!
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2013
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2014
invalidateLine:line
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2015
    "invalidate the area of a single line.
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2016
     This arranges for that line to be redrawn asynchronously (later).
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2017
     If multiple such invalidations arrive, those areas may be lumped
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2018
     together for a block update.
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2019
     The update takes place when the windowGroup process gets a chance to
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2020
     process expose events."
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2021
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2022
    |yTop visLineNr|
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2023
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2024
    visLineNr := self listLineToVisibleLine:line.
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2025
    visLineNr notNil ifTrue:[
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2026
	yTop := self yOfVisibleLine:visLineNr.
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2027
	yTop isNil ifTrue:[^ self]. "/ not visible
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2028
	(yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2029
	self
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2030
	    invalidateDeviceRectangle:(Rectangle
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2031
			    left:margin top:yTop-(lineSpacing//2)
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2032
			    width:(width - (2 * margin)) height:fontHeight)
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2033
	    repairNow:false.
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2034
    ]
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2035
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2036
    "Created: / 5.3.1998 / 01:24:19 / cg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2037
    "Modified: / 5.3.1998 / 13:41:31 / cg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2038
! !
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2039
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2040
!ListView methodsFor:'drawing-basic'!
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2041
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2042
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2043
    "draw a visible line range in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2044
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2045
    |y         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2046
     x         "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2047
     startLine "{ Class: SmallInteger }"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2048
     endLine   "{ Class: SmallInteger }"
2089
b774525a10b2 avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
  2049
     listSize e sH l|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2050
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2051
    y := self yOfVisibleLine:startVisLineNr.
394
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2052
    sH := lineSpacing // 2.
795f293f8520 fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2053
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  2054
    backgroundAlreadyClearedColor == bg ifFalse:[
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2055
        gc paint:bg.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2056
        gc fillRectangleX:margin y:y-sH
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2057
           width:(width - (margin * 2))
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2058
           height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  2059
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2060
    list isNil ifTrue:[^ self].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2061
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2062
    y := y + fontAscent.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2063
    listSize := self size.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2064
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2065
    startLine := startVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2066
    endLine := endVisLineNr + firstLineShown - 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2067
    (startLine == 0) ifTrue:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2068
        y := y + fontHeight.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2069
        startLine := startLine + 1
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2070
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2071
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2072
    (endLine > listSize) ifTrue:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2073
        e := listSize
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2074
    ] ifFalse:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2075
        e := endLine
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2076
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2077
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2078
    (startLine <= e) ifTrue:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2079
        x := textStartLeft - viewOrigin x.
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2080
        gc paint:fg on:bg.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2081
        "/ don't use list from:to:do:, to allow for subclasses to redefine the enumeration (TableView)
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2082
        self from:startLine to:e do:[:line |
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2083
            line notNil ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2084
                "/ remove line's color emphasis, to enforce color.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2085
                "/ otherwise blue text is not visible if selection-bg is blue
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2086
                l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2087
                gc displayOpaqueString:l x:x y:y.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2088
                
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2089
                checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2090
                    self updateWidthOfWidestLineFor:l
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2091
                ].    
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2092
            ].
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2093
            y := y + fontHeight
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2094
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2095
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2096
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2097
    "Modified: / 15.12.1999 / 23:19:39 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  2098
!
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
  2099
131
claus
parents: 128
diff changeset
  2100
drawLine:line atX:x inVisible:visLineNr with:fg and:bg
claus
parents: 128
diff changeset
  2101
    "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
  2102
     given x position in fg/bg. Clears the whole line before drawing the string.
5198
8aeb2f4089c9 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
  2103
     This is a low level entry; not meant for public use."
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  2104
5372
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  2105
    |y l halfSpacing extraBelow|
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  2106
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  2107
    y := self yOfVisibleLine:visLineNr.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  2108
    backgroundAlreadyClearedColor == bg ifFalse:[
6065
a8f521fbb02e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6053
diff changeset
  2109
        gc paint:bg.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2110
        halfSpacing := (lineSpacing//2).
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2111
        extraBelow := 0.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2112
        self highlightLineSpacing ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2113
            extraBelow := halfSpacing.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2114
        ].
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2115
        gc fillRectangleX:margin y:y - halfSpacing
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2116
           width:(width - (2 * margin))
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2117
           height:fontHeight+extraBelow.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  2118
    ].
6388
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2119
    
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  2120
    line notNil ifTrue:[
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2121
        gc paint:fg on:bg.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2122
6388
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2123
        "/ remove line's color emphasis, to enforce color.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2124
        "/ otherwise blue text is not visible if selection-bg is blue.
6388
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2125
        "/ This is only done in EditTextViews and subClasses.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2126
        self suppressEmphasisInSelection ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2127
            l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2128
        ] ifFalse:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2129
            l := line
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2130
        ].
6065
a8f521fbb02e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6053
diff changeset
  2131
a8f521fbb02e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6053
diff changeset
  2132
        "/ in the future, we may like to have a flag setting, which highlights non-ISO8859 characters;
a8f521fbb02e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6053
diff changeset
  2133
        "/ so we can tell, which chars make problems when saving as non-UTF8
a8f521fbb02e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6053
diff changeset
  2134
        
a8f521fbb02e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6053
diff changeset
  2135
        "/        l string bytesPerCharacter > 1 ifTrue:[
a8f521fbb02e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6053
diff changeset
  2136
        "/            l do:[:each | each bytesPerCharacter > 1 ifTrue:[ self halt ]].
a8f521fbb02e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6053
diff changeset
  2137
        "/        ].    
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2138
        gc displayOpaqueString:l x:x y:(y + fontAscent).
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2139
        
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2140
        checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2141
            self updateWidthOfWidestLineFor:l
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2142
        ].    
5372
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  2143
    ].
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  2144
6388
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2145
    "Modified: / 15-12-1999 / 23:19:46 / cg"
53127d6b215f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6387
diff changeset
  2146
    "Modified: / 04-08-2018 / 14:50:54 / Claus Gittinger"
422
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  2147
!
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  2148
12bfba6f62b5 redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  2149
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
  2150
    "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
  2151
     given x position in fg/bg. Clears partial line before drawing the string.
131
claus
parents: 128
diff changeset
  2152
     Low level entry; not meant for public use."
claus
parents: 128
diff changeset
  2153
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2154
    |y l|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2155
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2156
    y := self yOfVisibleLine:visLineNr.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2157
    line notNil ifTrue:[
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2158
        gc paint:fg on:bg.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2159
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2160
        "/ remove lines color emphasis, to enforce color.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2161
        "/ otherwise blue text is not visible if selection-bg is blue
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2162
        l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2163
        gc displayOpaqueString:l x:x y:(y + fontAscent).
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2164
        
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2165
        checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2166
            self updateWidthOfWidestLineFor:l
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2167
        ].    
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2168
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  2169
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2170
    "Modified: / 15.12.1999 / 23:19:55 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2171
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2172
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2173
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2174
    "draw single character at col index of visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2175
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2176
    |y yf x len lineString characterString w|
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2177
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2178
    lineString := lineStringArg.
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2179
    len := lineString size.
1927
d5e14e7bce6f fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents: 1911
diff changeset
  2180
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2181
    x := (self xOfCol:col inVisibleLine:visLineNr) - viewOrigin x.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2182
    y := self yOfVisibleLine:visLineNr.
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2183
    yf := y - (lineSpacing // 2).
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2184
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2185
    gc paint:bg.
2576
8af235849704 partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents: 2565
diff changeset
  2186
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2187
    (lineString notNil and:[lineString isString not]) ifTrue:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2188
        w := lineString widthFrom:col to:(col min:len) on:self.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2189
        w <= 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2190
            w := gc font width.
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2191
            gc fillRectangleX:x y:yf width:w height:fontHeight.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2192
            gc paint:fg
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2193
        ].
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2194
        self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2195
            self drawVisibleLine:visLineNr with:fg and:bg
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2196
        ].
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2197
        ^ self
2561
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2198
    ].
b4b64dd40018 drawing non-strings
Michael Beyl <mb@exept.de>
parents: 2559
diff changeset
  2199
2654
a183d27e53a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2649
diff changeset
  2200
    (lineString isNil or:[col > len]) ifTrue:[
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2201
        gc fillRectangleX:x y:yf width:(gc font width) height:fontHeight.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2202
        gc paint:fg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2203
    ] ifFalse:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2204
        characterString := lineString copyFrom:col to:col.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2205
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2206
        "/ remove lines color emphasis, to enforce color.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2207
        "/ otherwise blue text is not visible if selection-bg is blue
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2208
        characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2209
        w := characterString widthOn:self.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2210
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2211
        gc fillRectangleX:x y:yf width:w height:fontHeight.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2212
        gc paint:fg.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2213
        self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2214
            gc displayString:characterString x:x y:(y + fontAscent)
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2215
        ].
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2216
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2217
        checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2218
            self updateWidthOfWidestLineFor:characterString
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2219
        ].    
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2220
    ]
191
5ccbde40bb6b draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  2221
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2222
    "Modified: / 15.12.1999 / 23:21:12 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2223
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2224
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2225
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2226
    "draw part of a visible line in fg/bg"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2227
4637
ada9f49ba034 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4634
diff changeset
  2228
    |y yf x lineString len characterString w endCol sCol eCol numExtraCols|
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2229
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2230
    "/ hack - please rewrite
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2231
    endCol := endColOrNil ? lineStringArg size.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2232
    (endCol >= startCol) ifTrue:[
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2233
        sCol := startCol max:1.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2234
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2235
        lineString := lineStringArg.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2236
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2237
        x := (self xOfCol:sCol inVisibleLine:visLineNr) - viewOrigin x.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2238
        y := (self yOfVisibleLine:visLineNr).
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2239
        yf := y - (lineSpacing // 2).
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2240
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2241
        len := lineString size.
5111
6d3c864f0a03 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
  2242
        (lineString notNil and:[lineString isString not ])
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2243
        ifTrue:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2244
            w := lineString widthFrom:sCol to:(endCol min:len) on:self.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2245
            endCol > len ifTrue:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2246
                sCol > len ifTrue:[
4637
ada9f49ba034 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4634
diff changeset
  2247
                    numExtraCols := (endCol - sCol + 1).
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2248
                ] ifFalse:[
4637
ada9f49ba034 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4634
diff changeset
  2249
                    numExtraCols := (endCol - len" + 1").
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2250
                ].
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2251
                gc paint:bg.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2252
                gc fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight.
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2253
            ].
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2254
            w > 0 ifTrue:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2255
                self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
6387
5197892cbb8b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6345
diff changeset
  2256
                    self drawVisibleLine:visLineNr with:fg and:bg.
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2257
                ].
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2258
                checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2259
                    self updateWidthOfWidestLineFor:characterString
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2260
                ].    
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2261
            ].
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2262
            ^ self.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2263
        ].
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2264
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2265
        (sCol > len) ifTrue:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2266
            backgroundAlreadyClearedColor == bg ifFalse:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2267
                len := endCol - sCol + 1.
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2268
                gc paint:bg.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2269
                gc fillRectangleX:x y:yf
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2270
                               width:(fontWidth * len)
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2271
                              height:fontHeight
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2272
            ]
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2273
        ] ifFalse:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2274
            eCol := endCol.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2275
            (endCol > len) ifTrue:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2276
                backgroundAlreadyClearedColor == bg ifFalse:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2277
                    characterString := lineString string species new:endCol.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2278
                    characterString replaceFrom:1 to:len with:lineString startingAt:1.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2279
                    lineString := characterString.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2280
                ] ifTrue:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2281
                    eCol := len.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2282
                ].
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2283
            ].
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2284
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2285
            "/ remove any color emphasis, to enforce drawing in fg/bg
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2286
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2287
            lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2288
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2289
            backgroundAlreadyClearedColor == bg ifFalse:[
5111
6d3c864f0a03 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
  2290
                (lineString isSingleByteString) ifTrue:[
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2291
                    fontIsFixedWidth ifTrue:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2292
                        w := (eCol - sCol + 1) * fontWidth
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2293
                    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2294
                        w := gc font widthOf:lineString from:sCol to:eCol
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2295
                    ]
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2296
                ] ifFalse:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2297
                    w := lineString widthFrom:sCol to:endCol on:self
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2298
                ].
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2299
                gc paint:bg.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2300
                gc fillRectangleX:x y:yf width:w height:fontHeight.
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2301
            ].
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2302
            gc paint:fg on:bg.
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2303
            w notNil ifTrue:[
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2304
                "/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2305
                self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
4495
512fb0a0d8bd class: ListView
Claus Gittinger <cg@exept.de>
parents: 4468
diff changeset
  2306
                    "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2307
                    gc displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2308
                ]
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2309
            ] ifFalse:[
4495
512fb0a0d8bd class: ListView
Claus Gittinger <cg@exept.de>
parents: 4468
diff changeset
  2310
                "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2311
                gc displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2312
            ].
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2313
            checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2314
                self updateWidthOfWidestLineFor:lineString
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2315
            ].    
4049
f8d697f0a0f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  2316
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2317
    ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2318
6387
5197892cbb8b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6345
diff changeset
  2319
    "Modified: / 15-12-1999 / 23:21:43 / cg"
5197892cbb8b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6345
diff changeset
  2320
    "Modified: / 31-07-2018 / 23:54:51 / Claus Gittinger"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2321
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2322
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2323
drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2324
    "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
  2325
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  2326
    |y x index1 index2 lineWithoutColor|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2327
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2328
    (startCol < 1) ifTrue:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2329
        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
  2330
    ] ifFalse:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2331
        index1 := startCol
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2332
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2333
    y := self yOfVisibleLine:visLineNr.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2334
    x := (self xOfCol:index1 inVisibleLine:visLineNr) - viewOrigin x.
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  2335
    backgroundAlreadyClearedColor == bg ifFalse:[
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2336
        gc paint:bg.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2337
        gc fillRectangleX:x y:y - (lineSpacing // 2)
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2338
           width:(width + viewOrigin x - x) height:fontHeight.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2339
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2340
    lineString notNil ifTrue:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2341
        lineString isString ifFalse:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2342
            self drawLine:lineString inVisible:visLineNr from:startCol to:nil with:fg and:bg.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2343
        ] ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2344
            lineWithoutColor := self withoutColorEmphasis:lineString ifFg:fg andBg:bg.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2345
            index2 := lineWithoutColor size.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2346
            (index2 < index1) ifTrue:[^ self].
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2347
            (index1 <= index2) ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2348
                self paint:fg on:bg.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2349
                "/ self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent)
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2350
                gc displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent).
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2351
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2352
                checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2353
                    self updateWidthOfWidestLineFor:lineWithoutColor
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2354
                ].    
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2355
            ]
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  2356
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2357
    ]
249
75b8fb924904 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
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  2359
    "Modified: / 15.12.1999 / 23:24:40 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2360
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2361
2752
5650a9ab5935 method category rename
Claus Gittinger <cg@exept.de>
parents: 2731
diff changeset
  2362
!ListView methodsFor:'event handling'!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2363
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2364
contentsChanged
4634
663a43a31111 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4610
diff changeset
  2365
    "size of contents changed - move origin up if possible"
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2366
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2367
    |listSize newOrigin|
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2368
890
abd28e2f66ca stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  2369
    shown ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2370
	list notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2371
	    listSize := self numberOfLines.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2372
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2373
	    listSize == 0 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2374
		widthOfWidestLine := 0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2375
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2376
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2377
	    "
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2378
	     if we are beyond the end, scroll up a bit
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2379
	    "
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2380
	    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2381
		newOrigin := listSize - nFullLinesShown + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2382
		newOrigin < 1 ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2383
		    newOrigin := 1
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2384
		].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2385
		self scrollToLine: newOrigin.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2386
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2387
	].
887
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2388
    ].
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2389
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2390
    ^ super contentsChanged
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2391
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2392
    "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
  2393
    "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
  2394
!
9b25df4d193a Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents: 883
diff changeset
  2395
249
75b8fb924904 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
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
  2397
    "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
  2398
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2399
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
5790
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2400
                          #BeginOfText #EndOfText
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2401
                          #ScrollUp #ScrollDown 
5927
8e2bb4c8c26b #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5925
diff changeset
  2402
                          )>
2731
0f3c02f592d0 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2707
diff changeset
  2403
    |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
  2404
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2405
    (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
  2406
    (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
  2407
    (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
  2408
    (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
  2409
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2410
    (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
  2411
    (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
  2412
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2413
    (key == #ScrollUp) ifTrue:[
5790
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2414
        n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollUp).
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  2415
        ^ self scrollUpLines: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
  2416
    ].
75b8fb924904 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
    (key == #ScrollDown) ifTrue:[
5790
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2418
        n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollDown).
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  2419
        ^ self scrollDownLines: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
  2420
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2421
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2422
    super keyPress:key x:x y:y
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  2423
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  2424
    "Modified: / 13-06-2018 / 22:09:00 / Claus Gittinger"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2425
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2426
6252
65a7558ccddf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6248
diff changeset
  2427
keyboardZoom:largerBoolean
5790
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2428
    "CTRL+/- zoom action"
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2429
6252
65a7558ccddf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6248
diff changeset
  2430
    self fontLargerOrSmaller:largerBoolean
65a7558ccddf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6248
diff changeset
  2431
!
65a7558ccddf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6248
diff changeset
  2432
65a7558ccddf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6248
diff changeset
  2433
keyboardZoom:largerBoolean inAllViews:inAllViews
5924
6ad64956bfcd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5885
diff changeset
  2434
    "CTRL+/- zoom action"
6ad64956bfcd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5885
diff changeset
  2435
6ad64956bfcd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5885
diff changeset
  2436
    inAllViews ifTrue:[
5925
0e855f0eff6e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5924
diff changeset
  2437
        SimpleView allSubInstancesDo:[:each |
6252
65a7558ccddf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6248
diff changeset
  2438
            each keyboardZoom:largerBoolean 
5924
6ad64956bfcd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5885
diff changeset
  2439
        ].    
6ad64956bfcd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5885
diff changeset
  2440
    ] ifFalse:[
6252
65a7558ccddf #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6248
diff changeset
  2441
        self keyboardZoom:largerBoolean 
5924
6ad64956bfcd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5885
diff changeset
  2442
    ].
5790
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2443
!
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2444
2273
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2445
mapped
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2446
    self stopAutoScroll.
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2447
    super mapped
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2448
!
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2449
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2450
mouseWheelZoom:amount
4070
8225a547d6a7 comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 4049
diff changeset
  2451
    "CTRL-wheel action"
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2452
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2453
    |oldSize newSize delta mul font|
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2454
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2455
    amount > 0 ifTrue:[
4070
8225a547d6a7 comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 4049
diff changeset
  2456
        "/ delta := 1.  mul := 1.
5790
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2457
        delta := 0.  mul := 1.05.
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2458
    ] ifFalse:[
4070
8225a547d6a7 comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 4049
diff changeset
  2459
        "/ delta := -1. mul := 1.
5790
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2460
        delta := 0. mul := 0.95.
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2461
    ].
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2462
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2463
    font := gc font.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2464
    font sizeUnit ~~ #px ifTrue:[
4070
8225a547d6a7 comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 4049
diff changeset
  2465
        oldSize := font size.
5790
d9bc25103826 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  2466
        newSize := (((oldSize + delta)* mul) max:4) min:100.
4070
8225a547d6a7 comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 4049
diff changeset
  2467
        newSize ~= oldSize ifTrue:[
8225a547d6a7 comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 4049
diff changeset
  2468
            self font:(font asSize:newSize).
8225a547d6a7 comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 4049
diff changeset
  2469
        ]
3836
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2470
    ].
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2471
!
9c4e28fdc3b2 pushed up mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
  2472
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2473
redrawX:x y:y width:w height:h
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2474
    "a region must be redrawn"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2475
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2476
    |startCol endCol line saveClip
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2477
     startLine "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2478
     stopLine  "{ Class:SmallInteger }"
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2479
    |
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2480
127
claus
parents: 125
diff changeset
  2481
    shown ifFalse:[^ self].
claus
parents: 125
diff changeset
  2482
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2483
    startLine := self visibleLineOfY:y.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2484
    stopLine := self visibleLineOfY:(y + h).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2485
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2486
    saveClip := gc clippingBoundsOrNil.
6032
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2487
    self clippingBounds:(Rectangle left:x top:y width:w height:h).
6053
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2488
    gc paint:bgColor.
74dd0568082d #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2489
    gc fillRectangleX:x y:y width:w height:h.
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2490
    backgroundAlreadyClearedColor := bgColor.
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2491
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2492
    (includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[
6032
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2493
        "includes non strings or area is big enough: redraw whole lines"
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2494
        self redrawFromVisibleLine:startLine to:stopLine
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2495
    ] ifFalse:[
6032
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2496
        line := self visibleAt:startLine.
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2497
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2498
        (fontIsFixedWidth and:[line isSingleByteString]) ifFalse:[
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2499
            "start/end col has to be computed for each line"
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2500
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2501
            startLine to:stopLine do:[:i |
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2502
                startCol := self colOfX:x inVisibleLine:i.
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2503
                endCol := self colOfX:(x + w) inVisibleLine:i.
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2504
                startCol > 0 ifTrue:[
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2505
                    endCol > 0 ifTrue:[
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2506
                        self redrawVisibleLine:i from:startCol to:endCol
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2507
                    ]
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2508
                ]
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2509
            ]
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2510
        ] ifTrue:[
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2511
            "start/end col is the same for all lines"
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2512
            startCol := self colOfX:x inVisibleLine:startLine.
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2513
            endCol := self colOfX:(x + w) inVisibleLine:startLine.
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2514
            startCol > 0 ifTrue:[
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2515
                endCol > 0 ifTrue:[
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2516
                    startLine to:stopLine do:[:i |
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2517
                        line := self visibleAt:i.
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2518
                        (line isSingleByteString) ifTrue:[
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2519
                            self redrawVisibleLine:i from:startCol to:endCol
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2520
                        ] ifFalse:[
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2521
                            self redrawVisibleLine:i
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2522
                        ]
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2523
                    ]
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2524
                ]
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2525
            ]
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2526
        ]
1462
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2527
    ].
dc7d99a98511 redefine:
ca
parents: 1460
diff changeset
  2528
    backgroundAlreadyClearedColor := nil.
6032
3f1c88d62afd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6019
diff changeset
  2529
    self clippingBounds:saveClip.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2530
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2531
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2532
sizeChanged:how
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2533
    "size changed - move origin up if possible"
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2534
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2535
    super sizeChanged:how.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 716
diff changeset
  2536
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2537
    self computeNumberOfLinesShown.
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2538
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2539
    innerWidth := width - textStartLeft - margin.
1972
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2540
2577
a6584be928e8 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 2576
diff changeset
  2541
"/ Makes trouble when fighting with SelListViews sizeChanged-positioning ...
1972
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2542
"/
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2543
"/    shown ifFalse:[^ self].
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2544
"/    list isNil ifTrue:[^ self].
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2545
"/
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2546
"/    listSize := self numberOfLines.
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2547
"/    "
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2548
"/     if we are beyond the end, scroll up a bit
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2549
"/    "
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2550
"/    ((firstLineShown + nFullLinesShown) >= listSize) ifTrue:[
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2551
"/        self scrollToBottom.
2fa4f90efa2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1970
diff changeset
  2552
"/        ^ self
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  2553
"/    ].
643
89c06c80ff2a redraw in sizeChange
Claus Gittinger <cg@exept.de>
parents: 634
diff changeset
  2554
1429
b7b7f3477594 do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  2555
    "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
  2556
    "Modified: / 27.1.1998 / 14:10:04 / cg"
2273
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2557
!
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2558
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2559
unmap
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2560
    self stopAutoScroll.
e40b815ce3e2 stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents: 2258
diff changeset
  2561
    super unmap
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2562
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2563
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2564
!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
  2565
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2566
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
  2567
    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
  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
    "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
  2570
    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
  2571
    self computeNumberOfLinesShown.
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2572
    fgColor := fgColor onDevice:device.
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2573
    bgColor := bgColor onDevice:device
105
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2574
!
3d064ba4a0cc *** empty log message ***
claus
parents: 95
diff changeset
  2575
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2576
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
  2577
    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
  2578
    ^ 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
  2579
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2580
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2581
fetchDeviceResources
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2582
    "fetch device colors, to avoid reallocation at redraw time"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2583
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2584
    super fetchDeviceResources.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2585
1990
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2586
    fgColor notNil ifTrue:[fgColor := fgColor onDevice:device].
b0e6f2a8419e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
  2587
    bgColor notNil ifTrue:[bgColor := bgColor onDevice:device].
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2588
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2589
    "Created: 14.1.1997 / 00:12:12 / cg"
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2590
!
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2591
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2592
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  2593
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  2594
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2595
    |n|
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2596
249
75b8fb924904 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
    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
  2598
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2599
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2600
    n isInteger ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2601
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2602
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2603
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2604
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2605
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2606
    n isInteger ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2607
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2608
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2609
    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
  2610
4573
f181a93c3bc2 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4570
diff changeset
  2611
    lineSpacing := 2.
4577
3230a2dcbd49 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4573
diff changeset
  2612
    "/ q&d temporary hack.
3230a2dcbd49 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4573
diff changeset
  2613
    "/ X11 fonts are currently so ugly... add more spacing.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2614
    device isX11Platform ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2615
	lineSpacing := lineSpacing + 3.
4577
3230a2dcbd49 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4573
diff changeset
  2616
    ].
940
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2617
    fgColor := DefaultForegroundColor.
e53f681448f0 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
  2618
    bgColor := DefaultBackgroundColor.
4322
df5541649a5a comment/format in: #initStyle
az
parents: 4303
diff changeset
  2619
df5541649a5a comment/format in: #initStyle
az
parents: 4303
diff changeset
  2620
    "Modified (comment): / 05-10-2011 / 15:51:02 / az"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2621
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2622
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2623
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
  2624
    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
  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
    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
  2627
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2628
    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
  2629
75b8fb924904 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
    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
  2631
    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
  2632
    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
  2633
    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
  2634
    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
  2635
    partialLines := true.
5683
7027fccb78dd #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5661
diff changeset
  2636
    tabPositions := UserDefaultTabPositions ? self class defaultTabPositions.
864
577f43703ba1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
  2637
    includesNonStrings := false.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2638
    lineEndCRLF := false.
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  2639
    checkedLinesForWidthOfContentsComputation := nil."/ i.e. all
249
75b8fb924904 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
    self getFontParameters.
3312
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2641
    self initializeWordCheckAction.
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2642
3312
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2643
    scrollWhenUpdating := #keep. "/ #beginOfText.
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2644
    expandTabsWhenUpdating := true.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2645
    compareModelOnUpdate := true.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2646
    checkLineEndConventionWhenUpdating := true.
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  2647
    scrollLocked := false.
3312
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2648
    autoScroll := true.
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2649
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2650
    "Modified: / 03-07-2006 / 17:03:59 / cg"
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2651
!
99dd80bb9ba8 word check
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  2652
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2653
initializeWordCheckAction
4403
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2654
    "the wordCheck is a predicate block which returns true if the given character
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2655
     belongs to the (textual) word. Used with double click to select a word.
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2656
     When editing code, typically characters which are part of an identifier
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2657
     are part of a word (underline, dollar, but no other non-letters).
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2658
     The standardWordCheck aks the current userPreferences for details."
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  2659
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2660
    wordCheck := [:char | self standardWordCheck:char].
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2661
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2662
    "Created: / 03-07-2006 / 17:03:50 / cg"
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2663
!
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2664
249
75b8fb924904 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
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
  2666
    |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
  2667
2305
f2850e54b0ab only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 2273
diff changeset
  2668
    self extentChangedFlag ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2669
	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
  2670
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2671
249
75b8fb924904 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
    firstLineShown ~~ 1 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2673
	sz := self size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2674
	firstLineShown + nLinesShown > sz ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2675
	    self scrollToLine:sz - nLinesShown.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2676
	]
249
75b8fb924904 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
    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2678
249
75b8fb924904 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
    super realize.
837
fb2be41bef97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 833
diff changeset
  2680
1081
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2681
"/ old: fetch models value on realize;
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2682
"/ 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
  2683
"/
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2684
"/    model notNil ifTrue:[
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2685
"/        self getListFromModel.
0d3f4ad6e7e5 now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents: 1027
diff changeset
  2686
"/    ]
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  2687
825
d115a0923b7d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 820
diff changeset
  2688
    "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
  2689
    "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
  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
recreate
2258
806d3b8a6e97 comment
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2693
    "recreate after a snapin or a migration"
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2694
    |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
  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
    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
  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
    "
75b8fb924904 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
     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
  2700
     - 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
  2701
    "
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2702
"/    topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2703
"/    self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2704
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2705
    n := DefaultTopMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2706
    n isInteger ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2707
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2708
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2709
    self topMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2710
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2711
    n := DefaultLeftMargin.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2712
    n isInteger ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2713
	n := (self verticalPixelPerMillimeter:n) rounded.
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2714
    ].
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2715
    self leftMargin:n.
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2716
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2717
    self getFontParameters
1693
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2718
e76979454c2f more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents: 1656
diff changeset
  2719
    "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
  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
75b8fb924904 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
!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
  2723
75b8fb924904 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
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
  2725
    "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
  2726
2976
8da6c9b6bc3e Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2967
diff changeset
  2727
    <resource:#obsolete>
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2728
    self obsoleteMethodWarning:'use #listLineToVisibleLine:'.
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2729
    ^ self listLineToVisibleLine:absLineNr
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2730
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2731
"/    absLineNr isNil ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2732
"/    (absLineNr < firstLineShown) ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2733
"/    (absLineNr >= (firstLineShown + nLinesShown)) ifTrue:[^ nil].
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2734
"/    ^ absLineNr - firstLineShown + 1
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  2735
"/
249
75b8fb924904 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
!
75b8fb924904 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
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
  2739
    "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
  2740
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2741
    list isNil ifTrue: [
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2742
	list := StringCollection new:lineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2743
	self contentsChanged
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2744
    ] ifFalse: [
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2745
	lineNr > (list size) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2746
	    self grow:lineNr.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2747
	    self contentsChanged
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2748
	]
249
75b8fb924904 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
75b8fb924904 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
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
  2753
    "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
  2754
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2755
    |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
  2756
     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
  2757
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2758
    xRel := x - textStartLeft + viewOrigin x.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2759
    (xRel <= 0) ifTrue:[^ 1].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2760
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2761
    lineString := self visibleAt:visLineNr.
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  2762
249
75b8fb924904 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
    "
75b8fb924904 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
     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
  2765
    "
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2766
    (fontIsFixedWidth
5928
2bfec21329dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  2767
    and:[lineString isNil or:[lineString hasChangeOfEmphasis not]]) ifTrue:[
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2768
        ^ (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
  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
75b8fb924904 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
    "
75b8fb924904 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
     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
  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
    lineString notNil ifTrue:[
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2775
        lineString := self visibleStringFrom:lineString.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2776
        (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2777
            linePixelWidth := lineString widthOn:self
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2778
        ] ifFalse:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2779
            lineString := lineString string.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2780
            linePixelWidth := gc font widthOf:lineString.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2781
        ]
249
75b8fb924904 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
    ] ifFalse:[
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2783
        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
  2784
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2785
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2786
    (linePixelWidth <= xRel) ifTrue:[
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2787
        fontWidth == 0 ifTrue:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2788
            "
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2789
             although this 'cannot happen',
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2790
             it seems that X reports this width for some strange fonts ...
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2791
            "
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2792
            ^ lineString size
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2793
        ].
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2794
        ^ 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
  2795
    ].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2796
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2797
    "/ cannot simply count individual characters,
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2798
    "/ since kerning or other non-linear effects may be involved ...
4245
4c62eadf9898 changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2799
    "/ use a binary search, initialized with some guess.
4c62eadf9898 changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2800
4c62eadf9898 changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2801
    "/ a guess: take some 'average' character's width and compute an initial guess
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2802
    runCol := x // (gc font widthOf:'e').
4247
a2786871ebe7 changed: #colOfX:inVisibleLine:
sr
parents: 4245
diff changeset
  2803
    runCol := runCol min:lineString size.
4245
4c62eadf9898 changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2804
4c62eadf9898 changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2805
"/    runCol := lineString size // 2.
4c62eadf9898 changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2806
"/    (runCol == 0) ifTrue:[runCol := 1].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2807
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2808
    hasEmphasis ifTrue:[
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2809
        posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2810
        posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2811
    ] ifFalse:[
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2812
        posLeft := gc font widthOf:lineString from:1 to:(runCol - 1).
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2813
        posRight := gc font widthOf:lineString from:1 to:runCol.
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2814
    ].
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2815
249
75b8fb924904 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
    done := (posLeft <= xRel) and:[posRight > xRel].
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2817
249
75b8fb924904 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
    [done] whileFalse:[
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2819
        oPosRight := posRight.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2820
        oPosLeft := posLeft.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2821
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2822
        (posRight <= xRel) ifTrue:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2823
            runCol := runCol + 1.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2824
            posLeft := posRight.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2825
            hasEmphasis ifTrue:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2826
                posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2827
            ] ifFalse:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2828
                posRight := gc font widthOf:lineString from:1 to:runCol
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2829
            ]
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2830
        ] ifFalse:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2831
            (posLeft > xRel) ifTrue:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2832
                runCol := runCol - 1.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2833
                (runCol == 0) ifTrue:[^ 0].
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2834
                posRight := posLeft.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2835
                hasEmphasis ifTrue:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2836
                    posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2837
                ] ifFalse:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2838
                    posLeft := gc font widthOf:lineString from:1 to:(runCol - 1)
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2839
                ]
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2840
            ]
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2841
        ].
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2842
        done := (posLeft <= xRel) and:[posRight > xRel].
1775
8ef9fab69bf9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1773
diff changeset
  2843
"234567890123456789012345678901234567890"
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2844
        ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2845
            "/ paranoia: just in case there are unprintable characters
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2846
            "/ (avoid endless loop if the binary search does not make progress)
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2847
            done := true.
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2848
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2849
    ].
1777
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2850
"/self paint:Color red.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  2851
"/self displayRectangleX:posLeft+textStartLeft-viewOrigin x y:(self yOfVisibleLine:visLineNr)
1777
02cb89b249f1 oops - leftOver debugCode
Claus Gittinger <cg@exept.de>
parents: 1776
diff changeset
  2852
"/                       width:(posRight-posLeft) height:fontHeight.
5793
9e9a7d1a966e #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5790
diff changeset
  2853
"/self paint:self blackColor.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2854
    ^ runCol
650
563ea7f99aa8 handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
  2855
4245
4c62eadf9898 changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 4203
diff changeset
  2856
    "Modified: / 25-04-2011 / 11:26:58 / cg"
4247
a2786871ebe7 changed: #colOfX:inVisibleLine:
sr
parents: 4245
diff changeset
  2857
    "Modified: / 02-05-2011 / 14:08:54 / sr"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2858
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2859
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2860
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
  2861
    "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
  2862
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2863
    |innerHeight|
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2864
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2865
    innerHeight := self innerHeight.
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2866
    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
  2867
    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
  2868
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2869
    partialLines ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2870
	((nLinesShown * fontHeight) < innerHeight) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2871
	    nLinesShown := nLinesShown + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2872
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2873
    ]
716
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2874
366fca254239 fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents: 691
diff changeset
  2875
    "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
  2876
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2877
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2878
convertRTF:aList
3844
f7fba2703e0c Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3842
diff changeset
  2879
    <resource: #obsolete>
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2880
    "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
  2881
     - 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
  2882
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2883
    |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
  2884
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2885
    self obsoleteMethodWarning.
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2886
249
75b8fb924904 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
    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
  2888
    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
  2889
75b8fb924904 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
    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
  2891
    aList do:[:line |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2892
	((line size == 0) or:[line isBlank]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2893
	    newList add:newLine.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2894
	    newLine := ''
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2895
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2896
	    special := ((line at:1) == ${) or:[(line includes:$\)].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2897
	    special := special or:[(line at:1) == $}].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2898
	    special ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2899
		newList add:(newLine , line)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2900
	    ] ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2901
		charIndex := 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2902
		[charIndex <= line size] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2903
		    char := line at:charIndex.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2904
		    ((char == ${ ) or:[char == $} ]) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2905
			"left-brace: ignore rest of line"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2906
			charIndex := line size + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2907
		    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2908
			(char == $\) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2909
			    inEscape := true
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2910
			] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2911
			    inEscape ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2912
				(char == Character space) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2913
				    inEscape := false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2914
				]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2915
			    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2916
				newLine := newLine copyWith:char
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2917
			    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2918
			].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2919
			charIndex := charIndex + 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2920
		    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2921
		]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  2922
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
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
    ^ newList
652
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2926
bc99d03f7c19 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 650
diff changeset
  2927
    "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
  2928
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2929
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2930
enqueueDelayedContentsChangedNotification
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2931
    "because contentschanged may be slow (recomputing width of widest line),
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2932
     we delay its execution by pushing it onto the event queue.
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2933
     This has the effect of allowing for multiple add-lines before recomputing.
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2934
     Much speeding up inserting into long lists"
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2935
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2936
    |sensor|
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2937
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2938
    sensor := self sensor.
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2939
    (sensor hasUserEvent:#contentsChanged for:self) ifFalse:[
6158
86279357c196 #DOCUMENTATION by mawalch
mawalch
parents: 6155
diff changeset
  2940
        sensor pushUserEvent:#contentsChanged for:self
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2941
    ].
6158
86279357c196 #DOCUMENTATION by mawalch
mawalch
parents: 6155
diff changeset
  2942
    "/ used to be synchronous:
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2943
    "/ self contentsChanged.             "recompute scrollbars"
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2944
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2945
    "Created: / 25-07-2012 / 11:59:58 / cg"
6158
86279357c196 #DOCUMENTATION by mawalch
mawalch
parents: 6155
diff changeset
  2946
    "Modified (comment): / 22-05-2017 / 12:07:37 / mawalch"
4435
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2947
!
3cacb6eddf23 added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents: 4422
diff changeset
  2948
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2949
getFontParameters
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2950
    "get some info of the used font. They are cached since we use them often ..
5721
93b70f144978 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5718
diff changeset
  2951
     The code below uses the font's average height parameters - these
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
  2952
     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
  2953
     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
  2954
     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
  2955
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2956
    |hMax newDeviceFont|
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2957
5818
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2958
    newDeviceFont := gc deviceFont.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2959
    hMax := newDeviceFont height.
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2960
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2961
    includesNonStrings == true ifTrue:[
5818
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2962
        "/
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2963
        "/ find maximum height of lines
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2964
        "/
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2965
        hMax := list inject:hMax into:[:maxSoFar :thisLine |
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2966
                                        thisLine isNil ifTrue:[
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2967
                                            maxSoFar
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2968
                                        ] ifFalse:[
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2969
                                            (thisLine isSingleByteString) ifTrue:[
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2970
                                                maxSoFar
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2971
                                            ] ifFalse:[
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2972
                                                maxSoFar max:(thisLine heightOn:self)
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2973
                                            ]
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2974
                                        ]
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  2975
                              ].
1451
3598c65cd89d search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents: 1450
diff changeset
  2976
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2977
    ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2978
    fontHeight := newDeviceFont maxHeight.
4573
f181a93c3bc2 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4570
diff changeset
  2979
    "/ fontHeight := font height.
f181a93c3bc2 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4570
diff changeset
  2980
    fontHeight := fontHeight max:(hMax + lineSpacing).
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2981
    fontAscent := newDeviceFont ascent. "/ maxAscent. -- see SelectionInListViews selection in motif style
4573
f181a93c3bc2 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4570
diff changeset
  2982
    "/ fontAscent := font maxAscent "ascent". "/ maxAscent. -- see SelectionInListViews selection in motif style
f181a93c3bc2 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4570
diff changeset
  2983
    "/ fontAscent := (font maxAscent + font ascent) // 2. "/ maxAscent. -- see SelectionInListViews selection in motif style
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2984
    fontWidth := newDeviceFont width.
5928
2bfec21329dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  2985
    fontWidth == 0 ifTrue:[
2bfec21329dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  2986
        "/ should not happen, but some bad fonts seem to have it
2bfec21329dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  2987
        ('ListView [info]: font says, it has zero width: ', newDeviceFont printString) infoPrintCR.
2bfec21329dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  2988
        fontWidth := 1.
2bfec21329dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5927
diff changeset
  2989
    ].    
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  2990
    fontIsFixedWidth := newDeviceFont isFixedWidth.
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  2991
1260
5a548d4c6724 handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents: 1259
diff changeset
  2992
    "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
  2993
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  2994
75b8fb924904 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
getListFromModel
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2996
    "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
  2997
     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
  2998
5031
06227d6d978d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5030
diff changeset
  2999
    |newText msg doCompareIfUnchanged|
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3000
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3001
    model notNil ifTrue:[
5884
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3002
        msg := listMsg ? aspectMsg.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3003
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3004
        msg notNil ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3005
            doCompareIfUnchanged := compareModelOnUpdate.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3006
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3007
            newText := model perform:msg.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3008
            "/ cg: this makes many optimizations (virtualArray) useless;
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3009
            "/ I do not think that this is a good idea:
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3010
            "/     text notNil ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3011
            "/ so I changed it to:
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3012
            (newText notNil and:[newText isString]) ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3013
                newText := newText asStringCollection.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3014
            ] ifFalse:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3015
                newText == model ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3016
                    self isReadOnly ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3017
                        newText := model.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3018
                        self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3019
                        ^ self.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3020
                    ] .
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3021
                    "/ I must operate on a copy
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3022
                    newText := model asNewOrderedCollection.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3023
                    "/ doCompareIfUnchanged := false.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3024
                ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3025
            ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3026
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3027
            doCompareIfUnchanged ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3028
                "/ see if there is a change at all.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3029
                "/ use to compare using =, but that's not enough in case of emphasis change.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3030
                newText size == list size ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3031
                    |same|
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3032
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3033
                    same := true.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3034
                    newText size > 0 ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3035
                        newText ~~ list ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3036
                            newText with:list do:[:eachNewLine :eachOldLine |
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3037
                                (eachNewLine == eachOldLine) ifFalse:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3038
                                    same := false.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3039
                                ]
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3040
                            ]
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3041
                        ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3042
                    ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3043
                    same ifTrue:[^ self].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3044
                ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3045
            ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3046
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3047
            "/ SV: this compare does not work, if model uses (i.e. updates)
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3048
            "/ the same stringCollection as the view!!
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3049
            true "text ~= list" ifTrue:[
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3050
                "/ changed #list to care for scrollLocked
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  3051
"/                scrollLocked ifTrue:[
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  3052
"/                    self setList:newText expandTabs:expandTabsWhenUpdating
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  3053
"/                ] ifFalse:[
5884
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3054
                    self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  3055
"/                ]
5884
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3056
            ].
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3057
        ].
249
75b8fb924904 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
    ].
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3059
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3060
    "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
  3061
    "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
  3062
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3063
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  3064
getListFromModelScroll:aBoolean
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  3065
    "ask my model (if any) for the text via the listMsg.
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  3066
     If there is no listMessage, try aspect for backward compatibility.
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  3067
     If aBoolean is false, scrolling is suppressed here"
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  3068
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  3069
    |prev|
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  3070
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  3071
    prev := scrollLocked.
4747
3e369a9683d8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4734
diff changeset
  3072
    scrollLocked := aBoolean not.
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  3073
    [
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3074
	self getListFromModel
3249
a4beb76b3f59 code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  3075
    ] ensure:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3076
	scrollLocked := prev.
1099
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  3077
    ].
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  3078
!
eccab3759ddb in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  3079
5372
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  3080
highlightLineSpacing
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  3081
    "true if the spacing between lines is to be drawn with selected color,
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  3082
     false if it remains white.
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  3083
     false for selection in list views; true for edit/text views"
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  3084
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  3085
    ^ true
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  3086
!
4dd658134d1d class: ListView
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
  3087
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3088
line:line withoutEmphasis:emphasisToRemove
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3089
    (line notNil
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3090
    and:[line isString]) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3091
	^ line withoutEmphasis:emphasisToRemove.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3092
    ].
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  3093
    ^ line
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3094
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3095
249
75b8fb924904 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
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
  3097
    "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
  3098
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3099
    |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
  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
    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
  3102
    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
  3103
    (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
  3104
    ^ 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
  3105
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3106
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3107
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
  3108
    "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
  3109
4638
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3110
    |line lineLen nCols|
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3111
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3112
    nCols := (endCol - startCol + 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
  3113
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3114
    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
  3115
    lineLen := line size.
4638
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3116
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3117
    (line isNil or:[startCol > lineLen]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3118
	(nCols > 0) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3119
	    ^ (String new:nCols)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3120
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3121
	^ nil
4638
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3122
    ].
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3123
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3124
    (endCol > lineLen) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3125
	^ (line copyFrom:startCol to:lineLen) , (String new:(endCol-lineLen))
4638
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3126
    ].
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3127
    ^ line copyFrom:startCol to:endCol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  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
75b8fb924904 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
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
  3131
    "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
  3132
4639
53ad86d76a7e class: ListView
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  3133
    |line lineSize|
249
75b8fb924904 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
75b8fb924904 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
    line := self listAt:lineNr.
4638
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3136
    line isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3137
	(endCol > 0) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3138
	    ^ (String new:endCol)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3139
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3140
	^ nil
4638
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3141
    ].
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3142
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3143
    lineSize := line size.
4639
53ad86d76a7e class: ListView
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  3144
53ad86d76a7e class: ListView
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  3145
    (endCol > lineSize) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3146
	^ (line copyTo:lineSize) , (String new:(endCol - lineSize)).
4638
99ab02c595bb class: ListView
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
  3147
    ].
4639
53ad86d76a7e class: ListView
Claus Gittinger <cg@exept.de>
parents: 4638
diff changeset
  3148
    ^ line copyTo:endCol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3149
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3150
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3151
listLineIsVisible:listLineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3152
    "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
  3153
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3154
    |visibleLineNr "{ Class: SmallInteger }"|
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3155
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3156
    shown ifFalse:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3157
    listLineNr isNil ifTrue:[^ false].
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3158
    visibleLineNr := listLineNr + 1 - firstLineShown.
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3159
    ^ (visibleLineNr between:1 and:nLinesShown)
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3160
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3161
    "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
  3162
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3163
249
75b8fb924904 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
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
  3165
    "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
  3166
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3167
    |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
  3168
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3169
    shown 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
  3170
    listLineNr isNil ifTrue:[^ nil].
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3171
    visibleLineNr := listLineNr - firstLineShown + 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3172
    (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
  3173
    ^ 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
  3174
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3175
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  3176
recomputeWidthOfWidestLineFor:aString
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3177
    <resource: #obsolete>
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3178
    self recomputeWidthOfWidestLineFor:aString old:nil
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3179
!
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3180
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3181
recomputeWidthOfWidestLineFor:newEntry old:oldEntry
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3182
    "a new line was added (oldEntry == nil) or replaced oldEntry.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3183
     Update the widthOfWidestLine cache or flush it, if we cannot easily
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3184
     figure out the overall text width"
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3185
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3186
    |newW oldW|
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  3187
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  3188
    widthOfWidestLine notNil ifTrue:[
6293
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3189
        newEntry isNil ifTrue:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3190
            newW := 0
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3191
        ] ifFalse:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3192
            (newEntry isSingleByteString) ifTrue:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3193
                newW := gc font widthOf:newEntry
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3194
            ] ifFalse:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3195
                newW := newEntry widthOn:self
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3196
            ].
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3197
        ].
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3198
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3199
        newW >= widthOfWidestLine ifTrue:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3200
            widthOfWidestLine := newW.
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3201
        ] ifFalse:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3202
            oldEntry isNil ifTrue:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3203
                oldW := 0
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3204
            ] ifFalse:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3205
                (oldEntry isSingleByteString) ifTrue:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3206
                    oldW := gc font widthOf:oldEntry
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3207
                ] ifFalse:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3208
                    oldW := oldEntry widthOn:self
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3209
                ].
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3210
            ].
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3211
            newW > oldW ifTrue:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3212
                "/ no change; new entries width is between this width and amx width
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3213
            ] ifFalse:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3214
                "/ new entry is smaller than oldEntry; if the oldEntry was the previous max,
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3215
                "/ we don't know the new max
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3216
                oldW = widthOfWidestLine ifTrue:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3217
                    widthOfWidestLine := nil "/ means: unknown
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3218
                ] ifFalse:[
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3219
                    "/ old line was not the widest, and new line is shorter;
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3220
                    "/ no change
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3221
                ]
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3222
            ]
c7b0b569926d #DOCUMENTATION by mawalch
mawalch
parents: 6281
diff changeset
  3223
        ].
2224
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  3224
    ].
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  3225
    ^ widthOfWidestLine
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  3226
!
b060609f7c16 must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  3227
2225
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  3228
suppressEmphasisInSelection
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  3229
    "selection is shown with original emphasis"
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  3230
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  3231
    ^ false
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  3232
!
65ac7cbffc60 added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents: 2224
diff changeset
  3233
2181
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  3234
textChanged
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  3235
    "ignored here"
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  3236
!
2b2351d0c0c4 need dummy textChanged
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  3237
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3238
updateWidthOfWidestLineFor:aLine
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3239
    "when set to do this dynamically
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3240
     (eg when checkedLinesForWidthOfContentsComputation == 0)"
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3241
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3242
    |w|
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3243
5884
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3244
    w := self widthOfLineString:aLine.
6c412774e33a #OTHER by mawalch
mawalch
parents: 5877
diff changeset
  3245
    w > (widthOfWidestLine ? 0) ifTrue:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3246
        widthOfWidestLine := w.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3247
        self contentsChanged.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3248
    ].    
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3249
!
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3250
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3251
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
  3252
    "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
  3253
     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
  3254
     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
  3255
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3256
    |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
  3257
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3258
    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
  3259
    (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
  3260
    (list notNil) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3261
	listsize := self size
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3262
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3263
	listsize := 0
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3264
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3265
    (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
  3266
    ^ ''
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3267
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3268
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3269
visibleLineOfY:y
3818
cd51d5b4d162 comment
Claus Gittinger <cg@exept.de>
parents: 3777
diff changeset
  3270
    "given a y-coordinate, return the visible lineNr
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3271
     - 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
  3272
1448
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  3273
    ^ (((y - textStartTop) // fontHeight) + 1) max:1
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  3274
4220c80ab099 Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents: 1433
diff changeset
  3275
    "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
  3276
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3277
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3278
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
  3279
    "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
  3280
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3281
    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
  3282
    ^ 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
  3283
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3284
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3285
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
  3286
    "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
  3287
     (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
  3288
     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
  3289
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3290
    |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
  3291
     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
  3292
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3293
    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
  3294
    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
  3295
    (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
  3296
    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
  3297
    (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
  3298
    ^ 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
  3299
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3300
2559
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  3301
visibleStringFrom:aString
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  3302
    ^ aString asString
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  3303
!
a2c72ee75373 more for non-string items
Michael Beyl <mb@exept.de>
parents: 2558
diff changeset
  3304
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3305
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
  3306
    "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
  3307
     - 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
  3308
     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
  3309
     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
  3310
957
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3311
    ^ innerWidth
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3312
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3313
"/    "for small width, its not worth searching for
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3314
"/     longest line ...
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3315
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3316
"/    (width < 300) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3317
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3318
"/    "for large lists, search may take longer than scrolling full
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3319
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3320
"/    self size > 2000 ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3321
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3322
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3323
"/     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
  3324
"/    "
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3325
"/    (viewBackground isColor not
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3326
"/     or:[viewBackground isDithered]) ifTrue:[
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3327
"/        ^ width
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3328
"/    ].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3329
"/
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3330
"/    w := self widthOfWidestLineBetween:firstLine and:lastLine.
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3331
"/    (w > innerWidth) ifTrue:[^ innerWidth].
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3332
"/    ^ w
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3333
0d6a4d572aa2 oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents: 954
diff changeset
  3334
    "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
  3335
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3336
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3337
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
  3338
    "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
  3339
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3340
    entry isNil ifTrue:[^ 0].
5111
6d3c864f0a03 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
  3341
    (entry isSingleByteString) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3342
	^ gc 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
  3343
    ].
634
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  3344
    ^ entry widthOn:self
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  3345
1ca770b2c494 handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents: 627
diff changeset
  3346
    "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
  3347
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3348
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3349
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
  3350
    "return the width in pixels of the widest line in a range
5480
f883732537d6 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5392
diff changeset
  3351
     - used to optimize scrolling, by limiting the scrolled area;
f883732537d6 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5392
diff changeset
  3352
       not for scrollbar or other width related stuff which should be exact."
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3353
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3354
    |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
  3355
     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
  3356
     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
  3357
     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
  3358
     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
  3359
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3360
    includesNonStrings ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3361
	^ width
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3362
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3363
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3364
    fontIsFixedWidth ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3365
	^ (self lengthOfLongestLineBetween:firstLine and:lastLine) * fontWidth
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3366
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3367
    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
  3368
    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
  3369
    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
  3370
    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
  3371
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3372
    (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
  3373
    (last > listSize) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3374
	last := listSize
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3375
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3376
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3377
    self from:first to:last do:[:line |
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3378
	line notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3379
	    (line isSingleByteString) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3380
		thisLen := gc font widthOf:line
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3381
	    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3382
		thisLen := line widthOn:self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3383
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3384
	    (thisLen > max) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3385
		max := thisLen
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3386
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3387
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3388
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3389
    ^ 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
  3390
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3391
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3392
withoutAnyColorEmphasis:line
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3393
    (line notNil and:[line isText]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3394
	^ line withoutAnyColorEmphasis
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3395
    ].
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3396
    ^ line
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3397
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3398
    "
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3399
     'hello' asText colorizeAllWith:Color red.
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3400
     ('hello' asText colorizeAllWith:Color red) withoutForegroundColorEmphasis.
4392
e1159af210b2 changed:
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  3401
     ('hello' asText colorizeAllWith:Color red) withoutAnyColorEmphasis.
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3402
    "
4392
e1159af210b2 changed:
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  3403
e1159af210b2 changed:
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  3404
    "Modified (comment): / 06-03-2012 / 18:16:41 / cg"
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3405
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3406
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3407
withoutBackgroundColorEmphasis:line
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3408
    (line notNil and:[line isText]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3409
	^ line withoutBackgroundColorEmphasis
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3410
    ].
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3411
    ^ line
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3412
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3413
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3414
withoutColorEmphasis:line
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3415
    (line notNil and:[line isText]) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3416
	^ line withoutForegroundColorEmphasis
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3417
    ].
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3418
    ^ line
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3419
!
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3420
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3421
withoutColorEmphasis:line ifFg:fg andBg:bg
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3422
    "/ remove lines color emphasis, to enforce color.
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3423
    "/ otherwise blue text is not visible if selection-bg is blue
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3424
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3425
    (line notNil
4046
324228afadc4 changed:
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  3426
    and:[line isText
6471
202a6dcf53d5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6458
diff changeset
  3427
    and:[(fg ~= fgColor) or:[bg ~= bgColor]]]) ifTrue:[
202a6dcf53d5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6458
diff changeset
  3428
        ^ line withoutAnyColorEmphasis
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3429
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  3430
    ^ line
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3431
4392
e1159af210b2 changed:
Claus Gittinger <cg@exept.de>
parents: 4322
diff changeset
  3432
    "Created: / 15-12-1999 / 23:19:30 / cg"
6471
202a6dcf53d5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6458
diff changeset
  3433
    "Modified: / 26-10-2018 / 21:56:57 / Claus Gittinger"
2090
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3434
!
85c0dd8a4281 selection over colored text - again
Claus Gittinger <cg@exept.de>
parents: 2089
diff changeset
  3435
249
75b8fb924904 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
xOfCol:col inVisibleLine:visLineNr
2209
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  3437
    "given a visible line- and colNr, return the x-coordinate in view"
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  3438
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  3439
    |line lineSize tcol lText|
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  3440
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  3441
    col == 1 ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3442
	lText := 0
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3443
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3444
	tcol := col - 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3445
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3446
	line := self visibleAt:visLineNr.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3447
	(fontIsFixedWidth
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3448
	and:[line isNil or:[line isSingleByteString]])
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3449
	ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3450
	    lText := (tcol * fontWidth)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3451
	] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3452
	    line notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3453
		lineSize := line string size
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3454
	    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3455
		lineSize := 0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3456
	    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3457
	    (lineSize == 0) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3458
		lText := (tcol * fontWidth)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3459
	    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3460
		(lineSize < col) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3461
		    lText := (line widthOn:self) + (fontWidth * (tcol - lineSize))
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3462
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3463
		    (line isSingleByteString) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3464
			lText := (gc font widthOf:line from:1 to:tcol)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3465
		    ] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3466
			lText := line widthFrom:1 to:tcol on:self.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3467
		    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3468
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3469
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3470
	]
249
75b8fb924904 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
    ].
2209
70076d488bf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2208
diff changeset
  3472
    ^ lText + textStartLeft
670
8e381269591c more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents: 668
diff changeset
  3473
1656
1202fbc95970 some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents: 1637
diff changeset
  3474
    "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
  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
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3477
yOfLine:lineNr
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3478
    "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
  3479
     - 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
  3480
4641
febbcec12413 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4639
diff changeset
  3481
    |visLine|
febbcec12413 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4639
diff changeset
  3482
febbcec12413 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4639
diff changeset
  3483
    visLine := self listLineToVisibleLine:lineNr.
febbcec12413 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4639
diff changeset
  3484
    visLine isNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3485
	^ nil
4641
febbcec12413 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4639
diff changeset
  3486
    ].
febbcec12413 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4639
diff changeset
  3487
    ^ self yOfVisibleLine:visLine
1608
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3488
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3489
    "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
  3490
!
ce06a6553af1 fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents: 1582
diff changeset
  3491
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3492
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
  3493
    "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
  3494
     - 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
  3495
3819
23dc786223cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3818
diff changeset
  3496
    "/ care for visLineNr being nil during initialization
23dc786223cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3818
diff changeset
  3497
    ^ (((visLineNr ? 1) - 1) * fontHeight) + textStartTop
3398
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3498
!
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3499
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3500
yVisibleToLineNr:yVisible
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3501
    |vL|
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3502
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3503
    vL := self visibleLineOfY:yVisible.
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3504
    ^ self visibleLineToListLine:vL
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3505
d5c915fe3d92 oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents: 3339
diff changeset
  3506
    "Created: / 20-09-2006 / 15:29:12 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3507
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3508
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3509
!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
  3510
4303
dbd6a7f7c3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
  3511
characterPositionOfLine:lineNr col:colArg
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3512
    "given a line/col position, return the character index within the contents-string,
4468
6d711c19c529 comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents: 4463
diff changeset
  3513
     - used with compiler's error-positioning, which is based on character positions
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3514
     of the contents-string."
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3515
4468
6d711c19c529 comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents: 4463
diff changeset
  3516
    |lineString charPos lineEndCharSize col|
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3517
3854
4f0dbd8c4163 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
  3518
    lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1].
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3519
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3520
    self checkForExistingLine:lineNr.
4468
6d711c19c529 comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents: 4463
diff changeset
  3521
    charPos := 1.
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3522
    1 to:(lineNr - 1) do:[:lnr |
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3523
	lineString := self at:lnr.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3524
	lineString notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3525
	    charPos := charPos + (lineString string) size
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3526
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3527
	charPos := charPos + lineEndCharSize   "the return-character"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3528
    ].
4303
dbd6a7f7c3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
  3529
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3530
    "/ NEW: expand that line, so that characterAtCharacterPosition returns the correct character
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3531
"/ wrong: will modify!!
5691
bbe1d9a93740 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
  3532
"/    (lineString := self at:lineNr) size < colArg ifTrue:[
bbe1d9a93740 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
  3533
"/        "/ expand this line
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3534
"/        self at:lineNr put:((lineString ? ''),(String new:colArg-lineString size)).
5691
bbe1d9a93740 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
  3535
"/    ].
bbe1d9a93740 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
  3536
bbe1d9a93740 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
  3537
    "/ OLD: if beyond end of line, be careful to not advance into next line.
4759
c89c752d03f8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4757
diff changeset
  3538
    "/ otherwise, syntaxHighlighter (and others) walk into trouble,
c89c752d03f8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4757
diff changeset
  3539
    "/ if clicked on a space beyond a line's end.
c89c752d03f8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4757
diff changeset
  3540
    col := colArg min:((self at:lineNr) size + 1).
4468
6d711c19c529 comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents: 4463
diff changeset
  3541
    ^ charPos + col - 1
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3542
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3543
    "Modified: / 04-07-2006 / 19:14:25 / fm"
5691
bbe1d9a93740 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5683
diff changeset
  3544
    "Modified: / 01-05-2016 / 15:48:24 / cg"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3545
!
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3546
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3547
colOfCharacterPosition:charPos
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3548
    "given a character index within the contents-string,
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3549
     return the column number where the character is
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3550
     - used to find line to hilight from Compilers error-position"
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3551
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3552
    |line|
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3553
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3554
    line := self lineOfCharacterPosition:charPos.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3555
    ^ charPos - (self characterPositionOfLine:line col:1) + 1.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3556
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3557
!
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3558
1525
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3559
currentLine
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3560
    "the current line (for relative gotos);
1525
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3561
     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
  3562
     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
  3563
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3564
    ^ firstLineShown
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3565
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3566
    "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
  3567
!
6079f38d5e89 added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents: 1497
diff changeset
  3568
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3569
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
  3570
    "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
  3571
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3572
    ^ 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
  3573
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3574
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  3575
heightForLines:numberOfLines
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  3576
    "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
  3577
5818
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  3578
    ^ numberOfLines * fontHeight + topMargin + gc deviceFont descent + lineSpacing + (margin * 2)
311
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  3579
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  3580
    "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
  3581
!
cddf10b2207e added query for height with n lines
Claus Gittinger <cg@exept.de>
parents: 305
diff changeset
  3582
249
75b8fb924904 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
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
  3584
    "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
  3585
     - 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
  3586
5818
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  3587
    |numLines|
249
75b8fb924904 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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3589
    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
  3590
    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
  3591
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3592
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3593
    "/ 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
  3594
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3595
"/    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
  3596
"/        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
  3597
"/    ].
5947
e20b025f658d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
  3598
    ^ numLines * fontHeight "don't take font height here - think of LabelAndIcons"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3599
"/                            + textStartTop
5585
c14ee2bcedea #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5546
diff changeset
  3600
                            - (lineSpacing // 2)
5818
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  3601
                            + (gc deviceFont 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
  3602
"/                            + (font descent * 2) "makes it look better"
5585
c14ee2bcedea #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5546
diff changeset
  3603
                                .
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3604
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3605
"/    "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
  3606
"/    (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
  3607
"/        ^ 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
  3608
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3609
"/    "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
  3610
"/     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
  3611
"/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3612
"/    ^ (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
  3613
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3614
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3615
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
  3616
    "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
  3617
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3618
    ^ 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
  3619
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3620
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3621
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
  3622
    "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
  3623
     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
  3624
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  3625
    |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
  3626
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3627
    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
  3628
    lineString notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3629
	indent := lineString leftIndent.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3630
	indent == lineString size ifTrue:[^ 0].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3631
	^ 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
  3632
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3633
    ^ 0
566
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  3634
ba9b486ff769 use #leftIndent
Claus Gittinger <cg@exept.de>
parents: 529
diff changeset
  3635
    "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
  3636
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3637
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3638
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
  3639
    "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
  3640
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3641
    ^ 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
  3642
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3643
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3644
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
  3645
    "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
  3646
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3647
    |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
  3648
     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
  3649
     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
  3650
     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
  3651
     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
  3652
75b8fb924904 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
    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
  3654
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3655
    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
  3656
    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
  3657
    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
  3658
    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
  3659
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3660
    (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
  3661
    (last > listSize) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3662
	last := listSize
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3663
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3664
    self from:first to:last do:[:lineString |
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3665
	lineString notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3666
	    thisLen := lineString size.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3667
	    (thisLen > max) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3668
		max := thisLen
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3669
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3670
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3671
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3672
    ^ 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
  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
!
75b8fb924904 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
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3676
lineIsFullyVisible:line
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3677
    "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
  3678
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3679
    (line >= firstLineShown
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3680
     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
  3681
    ^ false.
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3682
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3683
    "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
  3684
!
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3685
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3686
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
  3687
    "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
  3688
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3689
    (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
  3690
    ^ 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
  3691
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3692
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3693
lineOfCharacterPosition:charPos
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3694
    "given a character index within the contents-string,
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3695
     return the lineNumber where the character is
4448
2e4bb12f298c changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  3696
     - used to find line to hilight from compiler's error-position"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3697
4303
dbd6a7f7c3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
  3698
    |lineNr sum lastLine lineEndCharSize l|
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3699
4280
61a16b0a99d5 changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4247
diff changeset
  3700
    lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1].
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3701
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3702
    lineNr := 1.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3703
    sum := 0.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3704
    lastLine := self size.
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3705
    [(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3706
	l := (self at:lineNr) ? ''.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3707
	sum := sum + (l string "withoutTrailingSeparators" size) + lineEndCharSize.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3708
	lineNr := lineNr + 1
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3709
    ].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3710
    sum == charPos ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3711
	^ lineNr
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3712
    ].
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3713
4448
2e4bb12f298c changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents: 4444
diff changeset
  3714
    ^ (lineNr - 1) max:1
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3715
3314
c486911eea21 CRLF management
fm
parents: 3312
diff changeset
  3716
    "Modified: / 04-07-2006 / 19:13:32 / fm"
4303
dbd6a7f7c3f9 changed:
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
  3717
    "Modified: / 21-08-2011 / 10:50:12 / cg"
2812
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3718
!
7bdc97bf18d9 categories
Claus Gittinger <cg@exept.de>
parents: 2810
diff changeset
  3719
249
75b8fb924904 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
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
  3721
    "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
  3722
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3723
    ^ 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
  3724
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3725
4607
c722d0035e3e class: ListView
Claus Gittinger <cg@exept.de>
parents: 4603
diff changeset
  3726
preferredExtentForContents
c722d0035e3e class: ListView
Claus Gittinger <cg@exept.de>
parents: 4603
diff changeset
  3727
    ^ (self widthOfContents @ self heightOfContents)
c722d0035e3e class: ListView
Claus Gittinger <cg@exept.de>
parents: 4603
diff changeset
  3728
!
c722d0035e3e class: ListView
Claus Gittinger <cg@exept.de>
parents: 4603
diff changeset
  3729
678
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3730
preferredExtentForLines:numLines cols:numCols
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3731
    ^ (((gc font widthOf:'x') * numCols + margin + margin)
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3732
      @
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3733
      (fontHeight * numLines + margin + margin + gc font descent + lineSpacing + topMargin)).
688
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  3734
569fd4799c3c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
  3735
    "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
  3736
!
c1967a46b2c1 added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents: 670
diff changeset
  3737
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  3738
supportsSyntaxElements
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  3739
    "see CodeView2::TextView"
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  3740
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  3741
    ^ false
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  3742
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  3743
249
75b8fb924904 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
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
  3745
    "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
  3746
     - 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
  3747
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3748
    |font start "{ Class: SmallInteger }"
4749
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3749
     stop  "{ Class: SmallInteger }"
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3750
     lengthOfLongestString  "{ Class: SmallInteger }"
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3751
     lengthOfLongestLine    "{ Class: SmallInteger }"
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3752
     max   "{ 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
  3753
4752
f4692b92c4f5 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4751
diff changeset
  3754
    list isEmptyOrNil ifTrue:[^ 0].
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3755
    widthOfWidestLine notNil ifTrue:[
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3756
        "/ already computed (cached); this cache is cleared when the contents is modified
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3757
        ^ widthOfWidestLine + (leftMargin * 2)
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3758
    ].
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  3759
5818
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  3760
    font := gc deviceFont.
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3761
    checkedLinesForWidthOfContentsComputation isNil ifTrue:[
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3762
        start := 1.
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3763
        stop := list size
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3764
    ] ifFalse:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3765
        checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3766
            start := firstLineShown.
5885
38ee27139eb1 #OTHER by mawalch
mawalch
parents: 5884
diff changeset
  3767
            stop := (start + nLinesShown - 1) min:list size.
38ee27139eb1 #OTHER by mawalch
mawalch
parents: 5884
diff changeset
  3768
        ] ifFalse:[
5862
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3769
            checkedLinesForWidthOfContentsComputation > 0 ifTrue:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3770
                start := 1.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3771
                stop := (checkedLinesForWidthOfContentsComputation min:list size)
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3772
            ] ifFalse:[
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3773
                stop := list size.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3774
                start := (list size + 1 + checkedLinesForWidthOfContentsComputation) max:1.
1f89188814b3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5861
diff changeset
  3775
            ]
4751
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3776
        ]
5d056eae9e06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4749
diff changeset
  3777
    ].
4749
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3778
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3779
    includesNonStrings ifTrue:[
4749
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3780
        max := 0.
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3781
        start to:stop do:[:lineNr |
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3782
            |entry w|
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3783
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3784
            entry := list at:lineNr.
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3785
            entry notNil ifTrue:[
5111
6d3c864f0a03 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
  3786
                (entry isSingleByteString) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  3787
                    w := font widthOf:entry
4749
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3788
                ] ifFalse:[
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3789
                    w := entry widthOn:self
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3790
                ].
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3791
                max := max max:w.
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3792
             ].
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3793
        ].
249
75b8fb924904 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
    ] ifFalse:[
4522
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3795
        fontIsFixedWidth ifTrue:[
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3796
            max := lengthOfLongestString := 0.
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3797
            list notNil ifTrue:[
4749
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3798
                start to:stop do:[:lineNr |
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3799
                    |line|
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3800
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3801
                    line := list at:lineNr.
4522
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3802
                    line notNil ifTrue:[
5111
6d3c864f0a03 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
  3803
                        (line isSingleByteString) ifTrue:[
4522
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3804
                            line size > lengthOfLongestString ifTrue:[
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3805
                                lengthOfLongestString := line size
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3806
                            ].
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3807
                        ] ifFalse:[
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3808
                            max := max max:(line widthOn:self)
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3809
                        ]
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3810
                    ]
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3811
                ].
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3812
                max := max max:(lengthOfLongestString * fontWidth)
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3813
            ].
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3814
        ] ifFalse:[
4732
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3815
            max := lengthOfLongestLine := 0.
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3816
            list notNil ifTrue:[
4749
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3817
                start to:stop do:[:lineNr |
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3818
                    |line len|
9f4dfdcf92b8 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4747
diff changeset
  3819
5090
ed3edaf6714f class: ListView
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
  3820
                    line := list at:lineNr ifAbsent:nil.
4732
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3821
                    line notNil ifTrue:[
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3822
                        len := line size.
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3823
                        "/ consider this a speed hack (not exact, but fast)
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3824
                        lengthOfLongestLine := lengthOfLongestLine max:len.
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3825
                        len > (lengthOfLongestLine // 3) ifTrue:[
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3826
                            max := max max:(line widthOn:self)
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3827
                        ].
a5421be068fc class: ListView
Claus Gittinger <cg@exept.de>
parents: 4712
diff changeset
  3828
                    ]
4522
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3829
                ].
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3830
            ].
4bd248c98c06 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4495
diff changeset
  3831
        ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3832
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3833
    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
  3834
    ^ max + (leftMargin * 2)
607
67462978fb20 fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
  3835
1700
3538310c2724 fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents: 1699
diff changeset
  3836
    "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
  3837
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3838
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3839
widthOfLine:lineNr
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3840
    "return the width of a line in pixels"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3841
5818
303a3073eb68 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5793
diff changeset
  3842
    |line|
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3843
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3844
    list isNil ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3845
    lineNr > list size ifTrue:[^ 0].
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3846
    line := list at:lineNr.
5863
65a6789689a3 #OTHER by mawalch
mawalch
parents: 5862
diff changeset
  3847
    line isNil ifTrue:[^ 0].
65a6789689a3 #OTHER by mawalch
mawalch
parents: 5862
diff changeset
  3848
    ^ self widthOfLineString:line
1716
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3849
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3850
    "Created: / 10.11.1998 / 23:59:20 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3851
    "Modified: / 11.11.1998 / 15:25:07 / cg"
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3852
!
c7a871383ef4 added #widthOfLine;
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
  3853
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3854
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
  3855
    "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
  3856
     - 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
  3857
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3858
    ^ viewOrigin x
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3859
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3860
75b8fb924904 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
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
  3862
    "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
  3863
     - 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
  3864
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3865
    ^ (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
  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
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3868
!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
  3869
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3870
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
  3871
    "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
  3872
4987
d94a6e4aadc0 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4859
diff changeset
  3873
    super flash.
d94a6e4aadc0 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4859
diff changeset
  3874
"/    self redrawInverted.
d94a6e4aadc0 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4859
diff changeset
  3875
"/    Delay waitForSeconds:0.1.
d94a6e4aadc0 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4859
diff changeset
  3876
"/    self redraw
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3877
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3878
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3879
     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
  3880
     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
  3881
     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
  3882
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3883
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3884
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3885
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
  3886
    "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
  3887
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3888
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3889
	self redrawFromVisibleLine:1 to:nLinesShown
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3890
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3891
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3892
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3893
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
  3894
    "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
  3895
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3896
    |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
  3897
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3898
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3899
	"if first line to redraw is above 1st visible line,
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3900
	 start redraw at 1st visible line"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3901
	(lineNr < firstLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3902
	    first := firstLineShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3903
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3904
	    first := lineNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3905
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3906
	visibleLine := self listLineToVisibleLine:first.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3907
	visibleLine notNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3908
	    self redrawFromVisibleLine:visibleLine to:nLinesShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3909
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3910
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3911
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3912
2605
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3913
redrawFromLine:startLine col:startCol toLine:endLine col:endCol
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3914
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3915
	self redrawLine:startLine from:startCol.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3916
	endLine > (startLine+1) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3917
	    self redrawFromLine:startLine+1 to:endLine-1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3918
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3919
	self redrawLine:endLine from:1 to:endCol.
2605
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3920
    ]
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3921
!
4f8c7e50f217 added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2577
diff changeset
  3922
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3923
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
  3924
    "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
  3925
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3926
    |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
  3927
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3928
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3929
	lastLineShown := firstLineShown + nLinesShown - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3930
	(start <= lastLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3931
	    (end >= firstLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3932
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3933
		"if first line to redraw is above 1st visible line,
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3934
		 start redraw at 1st visible line"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3935
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3936
		(start < firstLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3937
		    first := firstLineShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3938
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3939
		    first := start
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3940
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3941
		(end > lastLineShown) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3942
		    last := lastLineShown
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3943
		] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3944
		    last := end
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3945
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3946
		visibleFirst := self listLineToVisibleLine:first.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3947
		visibleLast := self listLineToVisibleLine:last.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3948
		self redrawFromVisibleLine:visibleFirst to:visibleLast
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3949
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3950
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3951
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3952
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3953
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3954
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
  3955
    "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
  3956
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3957
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3958
	self drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fgColor and:bgColor
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3959
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3960
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3961
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3962
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
  3963
    "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
  3964
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3965
    |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
  3966
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3967
    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
  3968
    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
  3969
    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
  3970
    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
  3971
    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
  3972
    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
  3973
    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
  3974
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3975
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3976
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
  3977
    "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
  3978
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3979
    |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
  3980
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3981
    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
  3982
    visibleLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3983
	self redrawVisibleLine:visibleLine
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3984
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3985
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3986
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3987
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
  3988
    "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
  3989
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3990
    |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
  3991
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3992
    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
  3993
    visibleLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  3994
	self redrawVisibleLine:visibleLine col:col
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3995
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3996
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3997
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  3998
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
  3999
    "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
  4000
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4001
    |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
  4002
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4003
    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
  4004
    visibleLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4005
	self redrawVisibleLine:visibleLine from:startCol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4006
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4007
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4008
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4009
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
  4010
    "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
  4011
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4012
    |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
  4013
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4014
    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
  4015
    visibleLine notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4016
	self redrawVisibleLine:visibleLine from:startCol to:endCol
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4017
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4018
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4019
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4020
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
  4021
    "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
  4022
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4023
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4024
	self drawVisibleLine:visLineNr with:fgColor and:bgColor
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4025
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4026
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4027
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4028
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
  4029
    "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
  4030
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4031
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4032
	self drawVisibleLine:visLineNr col:col with:fgColor and:bgColor
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4033
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4034
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4035
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4036
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
  4037
    "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
  4038
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4039
    shown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4040
	self drawVisibleLine:visLineNr from:startCol with:fgColor and:bgColor
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4041
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4042
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4043
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4044
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
  4045
    "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
  4046
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4047
    shown ifTrue:[
6451
fbed28a55482 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6429
diff changeset
  4048
        (startCol == endCol and:[startCol ~~ 0]) ifTrue:[
fbed28a55482 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6429
diff changeset
  4049
            self redrawVisibleLine:visLineNr col:startCol
fbed28a55482 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6429
diff changeset
  4050
        ] ifFalse:[
fbed28a55482 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6429
diff changeset
  4051
            "/ if 0, the left margin needs to be drawn    
fbed28a55482 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6429
diff changeset
  4052
            self drawVisibleLine:visLineNr from:startCol to:endCol with:fgColor and:bgColor
fbed28a55482 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6429
diff changeset
  4053
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4054
    ]
6451
fbed28a55482 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6429
diff changeset
  4055
fbed28a55482 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6429
diff changeset
  4056
    "Modified: / 10-10-2018 / 18:23:37 / Claus Gittinger"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4057
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4058
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4059
!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
  4060
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4061
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
  4062
    "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
  4063
     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
  4064
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4065
    ^ 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
  4066
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4067
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4068
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
  4069
    "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
  4070
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4071
    self scrollDownLines:(nFullLinesShown // 2)
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4072
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4073
    "Modified: / 13-06-2018 / 22:01:55 / Claus Gittinger"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4074
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4075
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4076
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
  4077
    "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
  4078
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4079
    self scrollUpLines:(nFullLinesShown // 2)
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4080
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4081
    "Modified: / 13-06-2018 / 22:02:21 / Claus Gittinger"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4082
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4083
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4084
horizontalScrollStep
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4085
    "return the amount to scroll when stepping up/down.
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4086
     Here, the scrolling unit is characters."
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4087
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4088
    ^ gc font width
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4089
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4090
    "Created: / 21.5.1999 / 15:55:06 / cg"
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4091
!
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4092
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4093
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
  4094
    "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
  4095
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4096
    |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
  4097
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4098
    (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
  4099
2423
8b9c2946a5a7 absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4100
    visLnr := self listLineToVisibleLine:aLineNr.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4101
    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
  4102
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4103
    xWant := self xOfCol:aCol inVisibleLine:visLnr.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  4104
    xVis := xWant - viewOrigin x.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4105
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4106
    "
5947
e20b025f658d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5928
diff changeset
  4107
     don't scroll, if already visible
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4108
     (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
  4109
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4110
"/    ((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
  4111
"/        ^ 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
  4112
"/    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4113
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4114
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4115
     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
  4116
     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
  4117
    "
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4118
    (xVis >= 0 and:[xVis < (width - gc font width)]) ifTrue:[^ self].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4119
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4120
    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
  4121
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4122
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4123
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
  4124
    "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
  4125
     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
  4126
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4127
    |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
  4128
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4129
    (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
  4130
895
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4131
"/  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
  4132
"/      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
  4133
"/      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
  4134
"/
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4135
"/    shown ifFalse:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4136
"/        firstLineShown := (aListLineNr - 1) max:1.
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4137
"/        firstLineShown > (list size - nFullLinesShown) ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4138
"/            firstLineShown := list size - nFullLinesShown
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4139
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4140
"/        list size <= nFullLinesShown ifTrue:[
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4141
"/            firstLineShown := 1
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4142
"/        ].
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4143
"/        ^ self
02d8e324dca5 Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents: 890
diff changeset
  4144
"/    ].
691
906e4d67b9cf fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents: 688
diff changeset
  4145
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4146
    (self needScrollToMakeLineVisible:aListLineNr) ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4147
	^ self
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4148
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4149
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4150
    (aListLineNr < nFullLinesShown) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4151
	"/ at the very top of the list - show from top
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4152
	newTopLine := 1
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4153
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4154
	(nFullLinesShown < 3) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4155
	    "/ a small view - show from that line
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4156
	    newTopLine := aListLineNr
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4157
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4158
	    bott := self numberOfLines - (nFullLinesShown - 1).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4159
	    (aListLineNr > bott) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4160
		"/ at the end of the list - show the bottom of the list
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4161
		newTopLine := bott
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4162
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4163
		"/ somewhere else - place selected line into the middle of
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4164
		"/ the view
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4165
		newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4166
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4167
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4168
    ].
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4169
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4170
    self scrollToLine:newTopLine.
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4171
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4172
    "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
  4173
    "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
  4174
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4175
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4176
makeVisible:someString
6164
4fa5c4c68b5e #OTHER by mawalch
mawalch
parents: 6158
diff changeset
  4177
    "if necessary, scroll to make the (first)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4178
     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
  4179
1808
097b86f1473e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  4180
    |index list|
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  4181
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  4182
    (list := self list) notNil ifTrue:[
6164
4fa5c4c68b5e #OTHER by mawalch
mawalch
parents: 6158
diff changeset
  4183
        index := list indexOf:someString.
4fa5c4c68b5e #OTHER by mawalch
mawalch
parents: 6158
diff changeset
  4184
        index ~~ 0 ifTrue:[
4fa5c4c68b5e #OTHER by mawalch
mawalch
parents: 6158
diff changeset
  4185
            self makeLineVisible:index
4fa5c4c68b5e #OTHER by mawalch
mawalch
parents: 6158
diff changeset
  4186
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4187
    ]
1319
2739903e7a80 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1309
diff changeset
  4188
6164
4fa5c4c68b5e #OTHER by mawalch
mawalch
parents: 6158
diff changeset
  4189
    "Modified: / 09-09-1997 / 10:10:13 / cg"
4fa5c4c68b5e #OTHER by mawalch
mawalch
parents: 6158
diff changeset
  4190
    "Modified (comment): / 30-05-2017 / 17:34:32 / mawalch"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4191
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4192
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4193
mouseWheelScrollDown:units
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4194
    self scrollDownLines:units
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4195
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4196
    "Created: / 13-06-2018 / 22:12:59 / Claus Gittinger"
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4197
!
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4198
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4199
mouseWheelScrollUp:units
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4200
    self scrollUpLines:units
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4201
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4202
    "Created: / 13-06-2018 / 22:12:53 / Claus Gittinger"
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4203
!
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4204
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4205
needScrollToMakeLine:aListLineNr
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4206
    "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
  4207
     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
  4208
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4209
    (aListLineNr >= firstLineShown) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4210
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4211
	    ^ false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4212
	]
1637
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4213
    ].
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4214
    ^ true
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4215
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4216
    "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
  4217
    "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
  4218
!
f40b75c349d7 allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
  4219
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4220
needScrollToMakeLineVisible:aListLineNr
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4221
    "return true, if a scroll is needd to make a line visible.
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4222
     Numbering starts with 1 for the very first line of the text."
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4223
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4224
    (aListLineNr >= firstLineShown) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4225
	(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4226
	    ^ false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4227
	]
2216
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4228
    ].
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4229
    ^ true
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4230
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4231
    "Created: / 7.8.1998 / 15:13:51 / cg"
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4232
    "Modified: / 7.8.1998 / 15:14:44 / cg"
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4233
!
3ee18867fade *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2214
diff changeset
  4234
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4235
pageDown
4203
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4236
    "change origin to display the next page"
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4237
4201
2e9d9ba4a215 changed:
Claus Gittinger <cg@exept.de>
parents: 4159
diff changeset
  4238
    "/ self scrollTo:(viewOrigin + (0 @ height))
4203
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4239
    self scrollToLine:(self firstLineShown + nFullLinesShown)
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4240
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4241
    "Modified: / 15-12-2010 / 10:12:37 / 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
  4242
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4243
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4244
pageUp
4203
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4245
    "change origin to display the previous page"
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4246
4201
2e9d9ba4a215 changed:
Claus Gittinger <cg@exept.de>
parents: 4159
diff changeset
  4247
    "/ self scrollTo:(viewOrigin - (0 @ height))
4203
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4248
    self scrollToLine:(self firstLineShown - nFullLinesShown)
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4249
102963c568a9 changed:
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4250
    "Modified: / 15-12-2010 / 10:12: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
  4251
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4252
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4253
scrollDown
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4254
    "scroll down by one line; 
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4255
     this is called (among other) when the scrollbar's
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4256
     scroll-step down button is pressed."
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4257
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4258
    self scrollDownLines:1
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4259
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4260
    "Created: / 13-06-2018 / 22:41:01 / Claus Gittinger"
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4261
!
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4262
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4263
scrollDown:nPixels
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4264
    "change origin to scroll down some pixels 
6345
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4265
     (towards the bottom of the text)
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4266
     Redefined, as this view only allows scrolling in multiples of the line height"
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4267
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4268
    self scrollDownLines:((nPixels + (fontHeight - 1)) // fontHeight)
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4269
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4270
    "Modified: / 21-05-1999 / 15:59:52 / cg"
6345
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4271
    "Modified: / 14-06-2018 / 11:27:12 / Claus Gittinger"
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4272
!
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4273
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4274
scrollDownLines:nLines
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4275
    "change origin to scroll down some lines 
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4276
     (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
  4277
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  4278
    nLines ~~ 0 ifTrue:[
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4279
        self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4280
               redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4281
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4282
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4283
    "Created: / 13-06-2018 / 21:55:56 / Claus Gittinger"
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  4284
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  4285
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4286
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
  4287
    "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
  4288
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  4289
    |nPixel|
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  4290
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  4291
    nPixel := aPixelOffset - viewOrigin x.
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  4292
    nPixel ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4293
	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
  4294
    ]
1756
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  4295
4feaf69d64f0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1730
diff changeset
  4296
    "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
  4297
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4298
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4299
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
  4300
    "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
  4301
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  4302
    nPixel ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4303
	self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4304
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4305
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  4306
    "Modified: / 21.5.1999 / 15:59:16 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4307
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4308
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4309
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
  4310
    "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
  4311
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  4312
    nPixel ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4313
	self scrollTo:(self viewOrigin + (nPixel @ 0)) redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4314
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4315
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  4316
    "Modified: / 21.5.1999 / 15:59:21 / cg"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4317
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4318
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4319
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
  4320
    "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
  4321
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4322
    ^ 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
  4323
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4324
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4325
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
  4326
    "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
  4327
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4328
    ^ 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
  4329
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4330
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4331
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
  4332
    "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
  4333
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4334
    "scrolling to the end is not really correct (i.e. should scroll to list size - nFullLinesShown),
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4335
     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
  4336
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4337
    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
  4338
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4339
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4340
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
  4341
    "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
  4342
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  4343
    |pxlOffset leftOffset|
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  4344
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  4345
    leftOffset := viewOrigin x.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4346
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4347
    aColNr == 1 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4348
	leftOffset ~~ 0 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4349
	    self scrollLeft:leftOffset.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4350
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4351
	^ self
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4352
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4353
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4354
    pxlOffset := gc font width * (aColNr - 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
  4355
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4356
    pxlOffset < leftOffset ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4357
	self scrollLeft:(leftOffset - pxlOffset)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4358
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4359
	pxlOffset > leftOffset ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4360
	    self scrollRight:(pxlOffset - leftOffset)
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4361
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4362
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4363
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4364
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4365
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
  4366
    "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
  4367
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2427
diff changeset
  4368
    viewOrigin x ~~ 0 ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4369
	self scrollToCol:1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4370
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4371
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4372
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4373
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
  4374
    "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
  4375
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4376
    aLineNr < firstLineShown ifTrue:[
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4377
        self scrollUpLines:(firstLineShown - aLineNr)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4378
    ] ifFalse:[
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4379
        aLineNr > firstLineShown ifTrue:[
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4380
            self scrollDownLines:(aLineNr - firstLineShown)
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4381
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4382
    ]
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4383
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4384
    "Modified: / 13-06-2018 / 21:59:44 / Claus Gittinger"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4385
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4386
833
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4387
scrollToPercent:percentOrigin
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4388
    "scroll to a position given in percent of total"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4389
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4390
    "kludge - ListView thinks in lines"
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4391
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4392
    self scrollHorizontalToPercent:percentOrigin x.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4393
    self scrollVerticalToPercent:percentOrigin y.
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4394
!
356ea2b5319d scrollToPercent fix
Claus Gittinger <cg@exept.de>
parents: 825
diff changeset
  4395
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4396
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
  4397
    "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
  4398
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4399
    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
  4400
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4401
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4402
scrollUp
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4403
    "scroll up by one line; 
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4404
     this is called (among other) when the scrollbar's
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4405
     scroll-step up button is pressed."
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4406
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4407
    self scrollUpLines:1
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4408
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4409
    "Created: / 13-06-2018 / 22:41:07 / Claus Gittinger"
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4410
!
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4411
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4412
scrollUp:nPixels
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4413
    "change origin to scroll up some pixels 
6345
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4414
     (towards the top of the text).
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4415
     Redefined, as this view only allows scrolling in multiples of the line height"
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4416
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4417
    self scrollUpLines:((nPixels + (fontHeight - 1)) // fontHeight)
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4418
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4419
    "Modified: / 21-05-1999 / 15:59:45 / cg"
6345
af2ea5fc2540 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6342
diff changeset
  4420
    "Modified (comment): / 14-06-2018 / 11:26:55 / Claus Gittinger"
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4421
!
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4422
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4423
scrollUpLines:nLines
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4424
    "change origin to scroll up some lines 
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4425
     (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
  4426
1911
b8d51c9ca998 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1910
diff changeset
  4427
    nLines ~~ 0 ifTrue:[
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4428
        self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4429
               redraw:true
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4430
    ]
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4431
6342
fda4ec431379 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6336
diff changeset
  4432
    "Created: / 13-06-2018 / 21:57:42 / Claus Gittinger"
808
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  4433
!
0fb219efdfa2 Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents: 798
diff changeset
  4434
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4435
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
  4436
    "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
  4437
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4438
    |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
  4439
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4440
    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
  4441
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4442
    "/ 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
  4443
    "/
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4444
    nFullLinesShown ~~ nLinesShown ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4445
	nL := nL + 1
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4446
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4447
    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
  4448
    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
  4449
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4450
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4451
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
  4452
    "setup for auto-scroll down (when button-press-moving below view)
5096
2c222bef8f8e class: ListView
Claus Gittinger <cg@exept.de>
parents: 5090
diff changeset
  4453
     - timeDelta for scroll is computed from distance.
2c222bef8f8e class: ListView
Claus Gittinger <cg@exept.de>
parents: 5090
diff changeset
  4454
     Return true, to tell caller that scrolling is allowed (redefined in editField)"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4455
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4456
    self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4457
	startAutoScrollVertical:yDistance
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4458
	scrollSelector:#scrollSelectDown.
5096
2c222bef8f8e class: ListView
Claus Gittinger <cg@exept.de>
parents: 5090
diff changeset
  4459
    ^ 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
  4460
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4461
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4462
startAutoScrollHorizontal:xDistance scrollSelector:scrollSelector
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4463
    "setup for auto-scroll left/right (when button-press-moving to the right of the view)
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4464
     - 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
  4465
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4466
    |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
  4467
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4468
    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
  4469
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4470
    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
  4471
    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
  4472
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4473
    (deltaT = autoScrollDeltaT) ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4474
	autoScrollDeltaT := deltaT.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4475
	autoScrollBlock isNil ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4476
	    autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4477
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4478
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4479
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4480
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4481
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4482
startAutoScrollLeft:xDistance
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4483
    "setup for auto-scroll up (when button-press-moving to the left of the view)
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4484
     - timeDelta for scroll is computed from distance"
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4485
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4486
    self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4487
	startAutoScrollHorizontal:xDistance negated
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4488
	scrollSelector:#scrollSelectLeft.
5096
2c222bef8f8e class: ListView
Claus Gittinger <cg@exept.de>
parents: 5090
diff changeset
  4489
    ^ true
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4490
!
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4491
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4492
startAutoScrollRight:xDistance
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4493
    "setup for auto-scroll down (when button-press-moving to the right of the view)
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4494
     - timeDelta for scroll is computed from distance"
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4495
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4496
    self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4497
	startAutoScrollHorizontal:xDistance
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4498
	scrollSelector:#scrollSelectRight.
5096
2c222bef8f8e class: ListView
Claus Gittinger <cg@exept.de>
parents: 5090
diff changeset
  4499
    ^ true
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4500
!
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4501
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4502
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
  4503
    "setup for auto-scroll up (when button-press-moving below view)
5096
2c222bef8f8e class: ListView
Claus Gittinger <cg@exept.de>
parents: 5090
diff changeset
  4504
     - timeDelta for scroll is computed from distance.
2c222bef8f8e class: ListView
Claus Gittinger <cg@exept.de>
parents: 5090
diff changeset
  4505
     Return true, to tell caller that scrolling is allowed (redefined in editField)"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4506
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4507
    self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4508
	startAutoScrollVertical:yDistance negated
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4509
	scrollSelector:#scrollSelectUp.
5096
2c222bef8f8e class: ListView
Claus Gittinger <cg@exept.de>
parents: 5090
diff changeset
  4510
    ^ true
2765
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4511
!
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4512
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4513
startAutoScrollVertical:yDistance scrollSelector:scrollSelector
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4514
    "setup for auto-scroll up (when button-press-moving below view)
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4515
     - timeDelta for scroll is computed from distance"
9ff34c678848 scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
  4516
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4517
    |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
  4518
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4519
    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
  4520
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4521
    mm := (yDistance abs // self verticalIntegerPixelPerMillimeter) + 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4522
    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
  4523
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4524
    (deltaT = autoScrollDeltaT) ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4525
	autoScrollDeltaT := deltaT.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4526
	autoScrollBlock isNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4527
	    autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4528
	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4529
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4530
    ]
4159
3032a5a9d8de comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents: 4070
diff changeset
  4531
3032a5a9d8de comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents: 4070
diff changeset
  4532
    "Modified: / 08-08-2010 / 11:26:26 / 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
  4533
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4534
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4535
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
  4536
    "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
  4537
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4538
    autoScrollBlock notNil ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4539
	self compressMotionEvents:true.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4540
	Processor removeTimedBlock:autoScrollBlock.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4541
	autoScrollBlock := nil.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4542
	autoScrollDeltaT := nil
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4543
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4544
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4545
1910
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4546
verticalScrollStep
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4547
    "return the amount to scroll when stepping up/down.
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4548
     Here, the scrolling unit is lines."
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4549
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4550
    ^ 1
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4551
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4552
    "Created: / 21.5.1999 / 14:00:12 / cg"
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4553
!
0d68937d088b removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  4554
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4555
viewOrigin
5877
66630dc71cfa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5863
diff changeset
  4556
    "return the viewOrigin; 
66630dc71cfa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5863
diff changeset
  4557
     that's the coordinate of the contents which is shown topLeft in the view
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4558
     (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
  4559
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4560
    ^ 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
  4561
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4562
2316
c259fe3a937b category change
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  4563
!ListView methodsFor:'scrolling-basic'!
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4564
2331
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4565
additionalMarginForHorizontalScroll
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4566
    "return the number of pixels by which we may scroll more than the actual
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4567
     width of the document would allow.
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4568
     This is redefined by editable textViews, to allo for the cursor
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4569
     to be visible if it is positioned right behind the longest line of text.
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4570
     The default returned here is the width of a blank (to beautify italic text)"
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4571
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4572
    ^ gc font width
2331
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4573
!
218a017dc1f3 additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents: 2325
diff changeset
  4574
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4575
scrollTo:anOrigin redraw:doRedraw
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4576
    "change origin to have newOrigin be visible at the top-left.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4577
     The argument defines the integer device coordinates of the new top-left
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4578
     point.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4579
    "
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4580
    |dltOrg
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4581
     noLn "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4582
     max  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4583
     tmp  "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4584
     h    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4585
     w    "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4586
     y0   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4587
     y1   "{ Class:SmallInteger }"
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4588
     y    "{ Class:SmallInteger }"
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  4589
     x    "{ Class:SmallInteger }"
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4590
     delta newFirstLine newViewOrigin
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4591
     hBefore wBefore inv wg|
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4592
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4593
    hBefore := height.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4594
    wBefore := width.
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4595
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4596
    dltOrg := anOrigin - viewOrigin.
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4597
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4598
"/  compute valid horizontal offset x
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4599
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4600
    (x := dltOrg x) ~~ 0 ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4601
	tmp := viewOrigin x + x.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4602
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4603
	x < 0 ifTrue:[                                          "/ scrolling left
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4604
	    tmp < 0 ifTrue:[x := 0 - viewOrigin x]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4605
	] ifFalse:[                                             "/ scrolling right
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4606
	 "/ allows scrolling to the right of widest line
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4607
	    max := self widthOfContents + (self additionalMarginForHorizontalScroll).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4608
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4609
	    tmp + width > max ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4610
		x := (max - viewOrigin x - width) max:0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4611
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4612
	]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4613
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4614
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4615
"/  compute valid vertical offset measured in lines
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4616
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4617
    (y := dltOrg y // fontHeight) ~~ 0 ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4618
	tmp := firstLineShown + y.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4619
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4620
	y < 0 ifTrue:[                                          "/ scrolling up
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4621
	    tmp < 1 ifTrue:[y := 1 - firstLineShown]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4622
	] ifFalse:[                                             "/ scrolling down
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4623
	    max := self size.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4624
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4625
	    tmp + nFullLinesShown > max ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4626
		y := (max - firstLineShown - nFullLinesShown + 1) max:0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4627
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4628
	]
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4629
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4630
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4631
    (x == 0 and:[y == 0]) ifTrue:[                              "/ has viewOrigin changed ?
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4632
	^ self
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4633
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4634
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4635
    (noLn := y) ~~ 0 ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4636
	y := y * fontHeight
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4637
    ].
1581
71fee652b652 oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  4638
    delta := (x @ y).
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4639
1582
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  4640
    newFirstLine := firstLineShown + noLn.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  4641
    newViewOrigin := viewOrigin + delta.
094d236c1baa checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1581
diff changeset
  4642
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4643
    (shown and:[doRedraw]) ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4644
	self originWillChange.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4645
	firstLineShown := newFirstLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4646
	viewOrigin := newViewOrigin.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4647
	self assert:(viewOrigin x >= 0).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4648
	^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4649
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4650
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4651
"/    (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[               "/ outstanding expose events
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4652
"/        self invalidate.                                        "/ redraw all
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4653
"/        self originWillChange.
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4654
"/        ^ self originChanged:(x @ y )
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4655
"/    ].
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4656
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4657
    (     (y ~~ 0 and:[x ~~ 0])         "/ both x and y changed
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4658
      or:[(noLn abs) >= nLinesShown     "/ at least one area is
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4659
      or:[(x abs) > (width // 4 * 3)]]  "/ big enough to redraw all
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4660
    ) ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4661
	self originWillChange.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4662
	firstLineShown := newFirstLine.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4663
	viewOrigin := newViewOrigin.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4664
	self invalidate.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4665
	^ self originChanged:delta
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4666
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4667
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  4668
    "/ OLD:
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  4669
    "/ self repairDamage.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  4670
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  4671
    (wg := self windowGroup) notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4672
	wg processRealExposeEventsFor:self.
1730
631a1d1a3dfb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  4673
    ].
1578
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4674
5799fd84f9a5 scrolling changed.
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4675
    self originWillChange.
1970
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  4676
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  4677
    "/ make certain, that all drawing is complete
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4678
    "/ device sync.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4679
1975
0eda51a6d48e uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents: 1972
diff changeset
  4680
    self catchExpose.
1970
b33eae81d696 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1969
diff changeset
  4681
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4682
    x == 0 ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4683
	"/ scrolling vertical
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4684
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4685
	y0 := textStartTop + (y abs).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4686
	h  := hBefore - margin - y0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4687
	w  := wBefore - margin.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4688
	y > 0 ifTrue:[                                          "/ copy down
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4689
	    "/ kludge: if the selection highlighting draws into the textStartTop area,
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4690
	    "/ the copy below leaves some selection depris in the top area.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4691
	    "/ Therefore, clear the top area.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4692
	    "/ (should avoid this, in case we know there cannot be anything
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4693
	    "/  there - selection is nil or >= firstLineShown).
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4694
	    self clearDeviceRectangleX:margin y:margin width:width-margin-margin height:(textStartTop-margin).
1983
3261af8573c6 scrolling redraw bug on w32
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
  4695
"/            self invalidateDeviceRectangle:((margin@margin) corner:(width-margin@textStartTop)) repairNow:false.
1977
dd1a0c2b407d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1976
diff changeset
  4696
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4697
	    self copyFrom:self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4698
			x:0 y:y0 toX:0 y:textStartTop
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4699
		    width:w height:h async:true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4700
	    y1 := h - 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4701
	    y0 := y0 + 1.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4702
	] ifFalse:[                                             "/ copy up
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4703
	    self copyFrom:self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4704
			x:margin y:textStartTop toX:margin y:y0
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4705
		    width:w height:h async:true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4706
	    y1 := 0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4707
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4708
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4709
	inv := (margin@y1) extent:(w@y0+margin).
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4710
    ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4711
	"/ scrolling horizontal
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4712
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4713
	x > 0 ifTrue:[                                          "/ scrolling right
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4714
	    y0 := margin + x.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4715
	    y1 := wBefore - y0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4716
	] ifFalse:[                                             "/ scrolling left
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4717
	    y0 := margin - x.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4718
	    y1 := 0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4719
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4720
	h := hBefore - margin - margin.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4721
	w := wBefore - margin - y0.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4722
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4723
	x > 0 ifTrue:[                                          "/ copy right
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4724
	    self copyFrom:self x:y0 y:margin toX:margin y:margin
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4725
		    width:w height:h async:true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4726
	] ifFalse:[                                             "/ copy left
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4727
	    "/ self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin
4603
7fbea08a4faf class: ListView
Claus Gittinger <cg@exept.de>
parents: 4583
diff changeset
  4728
"/            viewOrigin x > margin ifTrue:[
7fbea08a4faf class: ListView
Claus Gittinger <cg@exept.de>
parents: 4583
diff changeset
  4729
"/                self copyFrom:self x:0 y:margin toX:y0-margin y:margin
7fbea08a4faf class: ListView
Claus Gittinger <cg@exept.de>
parents: 4583
diff changeset
  4730
"/                        width:w height:h async:true.
7fbea08a4faf class: ListView
Claus Gittinger <cg@exept.de>
parents: 4583
diff changeset
  4731
"/            ] ifFalse:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4732
		self copyFrom:self x:margin y:margin toX:y0 y:margin
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4733
			width:w height:h async:true.
4603
7fbea08a4faf class: ListView
Claus Gittinger <cg@exept.de>
parents: 4583
diff changeset
  4734
"/            ].
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4735
	].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4736
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4737
	inv := (y1@margin) extent:(y0@h).
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4738
    ].
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4739
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4740
    firstLineShown := newFirstLine.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4741
    viewOrigin := newViewOrigin.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  4742
1885
Claus Gittinger <cg@exept.de>
parents: 1884
diff changeset
  4743
    self invalidateDeviceRectangle:inv repairNow:false.
4603
7fbea08a4faf class: ListView
Claus Gittinger <cg@exept.de>
parents: 4583
diff changeset
  4744
    viewOrigin x <= margin ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4745
	self invalidateDeviceRectangle:((0@margin) extent:(margin@h)) repairNow:false.
4603
7fbea08a4faf class: ListView
Claus Gittinger <cg@exept.de>
parents: 4583
diff changeset
  4746
    ].
1712
cb753ba02fb4 remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents: 1700
diff changeset
  4747
1975
0eda51a6d48e uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents: 1972
diff changeset
  4748
    self originChanged:delta.
1969
69d9c43db5e9 scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents: 1964
diff changeset
  4749
    self waitForExpose.
1726
c2d5164a60fe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1716
diff changeset
  4750
2202
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  4751
    (wg := self windowGroup) notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4752
	wg processRealExposeEventsFor:self.
2202
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  4753
    ].
edf8821d56a1 synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents: 2199
diff changeset
  4754
1984
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4755
"/    (hBefore ~= height or:[wBefore ~= width]) ifTrue:[
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4756
"/        self halt.
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4757
"/    ].
d807467cd161 scrolling again
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
  4758
4159
3032a5a9d8de comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents: 4070
diff changeset
  4759
    "Modified: / 08-08-2010 / 11:14:09 / cg"
1468
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4760
! !
b2809d296e0d scrolling horizontal/vertical
ca
parents: 1466
diff changeset
  4761
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4762
!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
  4763
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4764
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
  4765
    "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
  4766
     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
  4767
     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
  4768
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4769
    |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
  4770
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4771
    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
  4772
    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
  4773
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4774
    "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
  4775
    (wordCheck value:thisCharacter) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4776
	[wordCheck value:thisCharacter] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4777
	    beginCol := beginCol - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4778
	    beginCol < 1 ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4779
		^ 1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4780
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4781
	    thisCharacter := self characterAtLine:selectLine col:beginCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4782
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4783
	beginCol := beginCol + 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4784
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4785
	"nope - maybe its a space"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4786
	thisCharacter == Character space ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4787
	    [beginCol > 1 and:[thisCharacter == Character space]] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4788
		beginCol := beginCol - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4789
		thisCharacter := self characterAtLine:selectLine col:beginCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4790
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4791
	    thisCharacter ~~ Character space ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4792
		beginCol := beginCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4793
	    ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4794
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4795
	    "select single character"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4796
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4797
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4798
    ^ 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
  4799
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4800
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4801
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
  4802
    "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
  4803
     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
  4804
     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
  4805
     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
  4806
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4807
    |endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4808
     len    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4809
     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
  4810
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4811
    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
  4812
    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
  4813
    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
  4814
2900
0feab01d5b27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2891
diff changeset
  4815
    len := (self listAt:selectLine) size.
0feab01d5b27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2891
diff changeset
  4816
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4817
    "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
  4818
    (wordCheck value:thisCharacter) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4819
	[wordCheck value:thisCharacter] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4820
	    endCol := endCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4821
	    endCol > len ifTrue:[ ^ len ].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4822
	    thisCharacter := self characterAtLine:selectLine col:endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4823
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4824
	endCol := endCol - 1.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4825
    ] ifFalse:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4826
	"nope - maybe its a space"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4827
	thisCharacter == Character space ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4828
	    endCol > len ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4829
		"select rest to end"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4830
		endCol := 0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4831
	    ] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4832
		thisCharacter := self characterAtLine:selectLine col:endCol.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4833
		[endCol <= len and:[thisCharacter == Character space]] whileTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4834
		    endCol := endCol + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4835
		    thisCharacter := self characterAtLine:selectLine col:endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4836
		].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4837
		endCol := endCol - 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4838
	    ]
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4839
	] ifFalse:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4840
	    "select single character"
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4841
	]
125
claus
parents: 121
diff changeset
  4842
    ].
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4843
    ^ 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
  4844
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4845
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4846
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
  4847
    "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
  4848
     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
  4849
     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
  4850
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4851
    ^ self
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4852
	searchBackwardUsingSpec:(SearchSpec new
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4853
					pattern:pattern
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4854
					ignoreCase:ignCase
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4855
					match:false)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4856
	startingAtLine:startLine col:startCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4857
	ifFound:block1 ifAbsent:block2
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4858
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4859
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4860
searchBackwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4861
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4862
     found evaluate block2.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4863
     Sorry, but pattern is no regular expression pattern (yet)"
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4864
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4865
    ^ self
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4866
	searchBackwardFor:pattern
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4867
	ignoreCase:false
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4868
	startingAtLine:startLine col:startCol
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4869
	ifFound:block1
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4870
	ifAbsent:block2
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4871
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4872
    "Modified: 13.9.1997 / 01:07:36 / cg"
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4873
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4874
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4875
searchBackwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4876
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4877
     found evaluate block2.
5546
89bcf7a74c6e #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  4878
     Sorry, but pattern is no regular expression pattern (yet).
89bcf7a74c6e #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  4879
     Also, wraps are not done when searching backward."
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4880
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4881
    |lineString
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4882
     pattern ignCase match fullWord atBeginOfLineOnly atEndOfLineOnly
4444
3cffa8b45961 changed:
Claus Gittinger <cg@exept.de>
parents: 4435
diff changeset
  4883
     found firstChar1 firstChar2 c pc col1
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4884
     col         "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4885
     cc          "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4886
     patternSize "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4887
     line1       "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
  4888
     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
  4889
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4890
    pattern := searchSpec pattern.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4891
    ignCase := searchSpec ignoreCase.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4892
    match := searchSpec match.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4893
    match ifTrue:[ Transcript showCR:'backward matchsearch is (still) not implemented' ].
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4894
    fullWord := searchSpec fullWord.
5076
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  4895
    atBeginOfLineOnly := searchSpec atBeginOfLineOnly.
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4896
    atEndOfLineOnly := searchSpec atEndOfLineOnly.
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4897
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4898
    patternSize := pattern size.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4899
    (list notNil
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4900
    and:[startLine > 0
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  4901
    and:[patternSize ~~ 0]])
2508
5bf86df079c9 backward search without inital line
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  4902
    ifTrue:[
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4903
        self withCursor:Cursor questionMark do:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4904
            col := startCol - 1.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4905
            firstChar1 := pattern at:1.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4906
            ignCase ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4907
                firstChar1 := firstChar1 asLowercase.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4908
                firstChar2 := firstChar1 asUppercase.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4909
            ] ifFalse:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4910
                firstChar2 := firstChar1
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4911
            ].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4912
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4913
            line1 := startLine.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4914
            line1 > list size ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4915
                line1 := list size.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4916
                col := -999
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4917
            ] ifFalse:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4918
                col > (list at:line1) size ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4919
                    col := -999
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4920
                ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4921
            ].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4922
            line1 to:1 by:-1 do:[:lnr |
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4923
                lineString := list at:lnr.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4924
                lineString notNil ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4925
                    lineString := lineString asString.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4926
                    lineString isString ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4927
                        "/ quick check if pattern is present
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4928
                        col1 := lineString
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4929
                                findString:pattern startingAt:1
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4930
                                ifAbsent:0 caseSensitive: ignCase not.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4931
                        col1 ~~ 0 ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4932
                            lineSize := lineString size.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4933
                            col == -999 ifTrue:[col := lineSize - patternSize + 1].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4934
                            [(col > 0)
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4935
                             and:[(c := lineString at:col) ~= firstChar1
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4936
                             and:[c ~= firstChar2]]] whileTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4937
                                col := col - 1
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4938
                            ].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4939
                            [col > 0] whileTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4940
                                cc := col.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4941
                                found := true.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4942
                                1 to:patternSize do:[:cnr |
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4943
                                    cc > lineSize ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4944
                                        found := false
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4945
                                    ] ifFalse:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4946
                                        pc := pattern at:cnr.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4947
                                        c := lineString at:cc.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4948
                                        pc ~= c ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4949
                                            (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4950
                                                found := false
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4951
                                            ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4952
                                        ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4953
                                    ].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4954
                                    cc := cc + 1
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4955
                                ].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4956
                                found ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4957
                                    (fullWord not
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4958
                                        or:[ (self findBeginOfWordAtLine:lnr col:col) == col
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4959
                                              and:[ (self findEndOfWordAtLine:lnr col:col) == (col + patternSize - 1) ]]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4960
                                    ) ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4961
                                        (atBeginOfLineOnly not or:[col == 1]) ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4962
                                            (atEndOfLineOnly not or:[(col + patternSize - 1) >= lineSize]) ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4963
                                                ^ block1 value:lnr value:col optionalArgument:nil.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4964
                                            ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4965
                                        ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4966
                                    ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4967
                                ].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4968
                                col := col - 1.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4969
                                [(col > 0)
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4970
                                and:[(c := lineString at:col) ~= firstChar1
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4971
                                and:[c ~= firstChar2]]] whileTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4972
                                    col := col - 1
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4973
                                ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4974
                            ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4975
                        ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4976
                    ].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4977
                ].
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4978
                col := -999.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4979
            ]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4980
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4981
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4982
    "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
  4983
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4984
    ^ block2 value
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  4985
4444
3cffa8b45961 changed:
Claus Gittinger <cg@exept.de>
parents: 4435
diff changeset
  4986
    "Created: / 13-09-1997 / 01:06:19 / cg"
3cffa8b45961 changed:
Claus Gittinger <cg@exept.de>
parents: 4435
diff changeset
  4987
    "Modified: / 05-08-2012 / 12:16:31 / cg"
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  4988
    "Modified: / 13-09-2018 / 10:07:29 / Claus Gittinger"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4989
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  4990
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4991
searchForwardFor:pattern ignoreCase:ignCase match:match startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4992
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  4993
     found evaluate block2."
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4994
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  4995
    ^ self
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4996
	searchForwardUsingSpec:(SearchSpec new
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4997
				    pattern:pattern
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4998
				    ignoreCase:ignCase
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  4999
				    match:match)
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5000
	startingAtLine:startLine col:startCol
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5001
	ifFound:block1 ifAbsent:block2
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5002
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5003
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5004
searchForwardFor:pattern ignoreCase:ignCase startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5005
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5006
     found evaluate block2."
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5007
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5008
    ^ self searchForwardFor:pattern ignoreCase:ignCase match: true startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5009
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5010
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5011
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5012
    "search for a pattern, if found evaluate block1 with row/col as arguments, if not
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5013
     found evaluate block2."
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5014
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5015
    ^ self
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5016
	searchForwardFor:pattern
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5017
	ignoreCase:false
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5018
	startingAtLine:startLine col:startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5019
	ifFound:block1
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5020
	ifAbsent:block2
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  5021
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5022
    "Modified: 13.9.1997 / 01:07:11 / cg"
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5023
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5024
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5025
searchForwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5026
    "search for a pattern, if found evaluate block1 with row/col as arguments,
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5027
     if not found evaluate block2.
5715
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5028
     If the block is a three-arg block, it gets the end-col (or nil, if not known)"
5546
89bcf7a74c6e #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  5029
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5030
    |lineString col pattern match regexMatch ignCase fullWord atBeginOfLineOnly atEndOfLineOnly
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5031
     wrapAtEndOfText patternSize matcher lnr   "{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
  5032
     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
  5033
     line2 "{Class: SmallInteger}"
5546
89bcf7a74c6e #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  5034
     p realPattern runner foundCol endCol|
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5035
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5036
    pattern := searchSpec pattern.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5037
    match := searchSpec match.
5546
89bcf7a74c6e #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  5038
    regexMatch := searchSpec regexMatch.
5715
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5039
    (match and:[regexMatch not]) ifTrue:[
6214
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5040
        pattern := pattern globPatternAsRegexPattern.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5041
        regexMatch := true.
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5042
    ].
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5043
    ignCase := searchSpec ignoreCase.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5044
    fullWord := searchSpec fullWord.
5076
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5045
    atBeginOfLineOnly := searchSpec atBeginOfLineOnly.
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5046
    atEndOfLineOnly := searchSpec atEndOfLineOnly.
5546
89bcf7a74c6e #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  5047
    wrapAtEndOfText := searchSpec wrapAtEndOfText.
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5048
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5049
    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
  5050
    (list notNil and:[patternSize ~~ 0]) ifTrue:[
6214
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5051
        self withCursor:Cursor questionMark do:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5052
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5053
            col := startCol + 1.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5054
            line1 := startLine.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5055
            line2 := list size.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5056
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5057
            "/ call searchBlock with lnr, col, and line. Cares for wrap
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5058
            runner :=
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5059
                [:searchBlock |
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5060
                    |didWrap|
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5061
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5062
                    lnr := line1.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5063
                    didWrap := false.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5064
                    [lnr <= line2] whileTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5065
                        lineString := list at:lnr.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5066
                        lineString notNil ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5067
                            lineString := lineString asString string.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5068
                            lineString isString ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5069
                                searchBlock value:lnr value:col value:lineString
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5070
                            ]
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5071
                        ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5072
                        col := 1.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5073
                        lnr := lnr + 1.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5074
                        lnr > line2 ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5075
                            (wrapAtEndOfText and:[didWrap not]) ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5076
                                didWrap := true.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5077
                                lnr := 1.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5078
                                line2 := line1-1.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5079
                            ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5080
                        ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5081
                   ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5082
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5083
                ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5084
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5085
            (match and:[regexMatch]) ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5086
                "perform a findMatchString (regex matching)"
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5087
                Regex::RxParser isNil ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5088
                    Smalltalk loadPackage:'stx:goodies/regex'
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5089
                ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5090
                matcher := ignCase ifTrue:[pattern asRegexIgnoringCase] ifFalse:[pattern asRegex].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5091
                runner value:[:lnr :col :lineString |
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5092
                        |lineStream|
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5093
6397
36ba48bd7fd1 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6388
diff changeset
  5094
                        lineStream := lineString readStream.
36ba48bd7fd1 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6388
diff changeset
  5095
                        lineStream position:(col-1 min:lineString size).
6214
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5096
                        "/ find which match to show
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5097
                        (matcher searchStream:lineStream) ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5098
                            foundCol := matcher subBeginning:1.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5099
                            endCol := matcher subEnd:1.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5100
                            (foundCol notNil and: [endCol notNil]) ifTrue: [
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5101
                                foundCol := foundCol + 1. "/ regex uses 0-based indexes (sigh)
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5102
                                (atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5103
                                    (atEndOfLineOnly not or:[endCol >= lineString size]) ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5104
                                        ^ block1 value:lnr value:foundCol optionalArgument:endCol.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5105
                                    ]
6214
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5106
                                ]
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5107
                            ]
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5108
                        ]
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5109
                    ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5110
            ] ifFalse:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5111
                (match and:[pattern includesUnescapedMatchCharacters]) ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5112
                    "perform a findMatchString (glob matching)"
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5113
                    p := pattern species new:0.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5114
                    (pattern startsWith:$*) ifFalse:[p := p , '*'].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5115
                    p := p , pattern.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5116
                    (pattern endsWith:$*) ifFalse:[p := p , '*'].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5117
                    realPattern := pattern.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5118
                    (realPattern startsWith:$*) ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5119
                        realPattern := realPattern copyFrom:2
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5120
                    ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5121
                    runner value:[:lnr :col :lineString |
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5122
                            (p match:lineString caseSensitive:ignCase not) ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5123
                                "/ ok, there it is; look at which position
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5124
                                foundCol := lineString
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5125
                                        findMatchString:realPattern startingAt:col
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5126
                                        caseSensitive:ignCase not ifAbsent:0.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5127
                                foundCol ~~ 0 ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5128
                                    (atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5129
                                        (atEndOfLineOnly not or:[(foundCol+p size) >= lineString size]) ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5130
                                            ^ block1 value:lnr value:foundCol optionalArgument:nil.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5131
                                    ]]]]
6214
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5132
                            ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5133
                ] ifFalse:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5134
                    "perform a findString (no matching)"
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5135
                    p := pattern.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5136
                    (match and:[pattern includesMatchCharacters]) ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5137
                        p := pattern withoutMatchEscapes
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5138
                    ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5139
                    runner
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5140
                        value:[:lnr :col :lineString |
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5141
                            foundCol := lineString
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5142
                                    findString:p startingAt:col ifAbsent:0 caseSensitive: ignCase not.
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5143
                            foundCol ~~ 0 ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5144
                                (fullWord not
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5145
                                    or:[ (self findBeginOfWordAtLine:lnr col:foundCol) == foundCol
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5146
                                          and:[ (self findEndOfWordAtLine:lnr col:foundCol) == (foundCol + patternSize - 1) ]]
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5147
                                ) ifTrue:[
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5148
                                    (atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5149
                                        atEndOfLineOnly ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5150
                                            (lineString endsWith:p caseSensitive:ignCase not) ifTrue:[
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5151
                                                ^ block1 value:lnr value:(lineString size - p size + 1) optionalArgument:nil.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5152
                                            ].    
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5153
                                        ] ifFalse:[ 
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5154
                                            ^ block1 value:lnr value:foundCol optionalArgument:nil.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5155
                                        ]
6214
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5156
                                    ]
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5157
                                ]
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5158
                            ]
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5159
                        ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5160
                ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5161
            ].
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5162
        ]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5163
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5164
    "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
  5165
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5166
    ^ block2 value
403
ee8f6d080077 preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents: 394
diff changeset
  5167
4444
3cffa8b45961 changed:
Claus Gittinger <cg@exept.de>
parents: 4435
diff changeset
  5168
    "Created: / 13-09-1997 / 01:06:31 / cg"
3cffa8b45961 changed:
Claus Gittinger <cg@exept.de>
parents: 4435
diff changeset
  5169
    "Modified: / 05-08-2012 / 12:22:42 / cg"
6214
631877afef09 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6213
diff changeset
  5170
    "Modified (format): / 12-10-2017 / 18:35:55 / stefan"
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5171
    "Modified: / 13-09-2018 / 10:20:55 / Claus Gittinger"
1325
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  5172
!
05bbe657902c allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1319
diff changeset
  5173
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  5174
standardWordCheck:char
4403
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5175
    "the wordCheck is a predicate which returns true if the given character
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5176
     belongs to the (textual) word. Used with double click to select a word.
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5177
     When editing code, typically characters which are part of an identifier
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5178
     are part of a word (underline, dollar, but no other non-letters).
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5179
     The standardWordCheck aks the current userPreferences for details."
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5180
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5181
    |prefs|
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5182
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5183
    (prefs := UserPreferences current) whitespaceWordSelectMode ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5184
	"an extremely simple mode, where every non-space is treated as part of the word"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5185
	^ char isSeparator not
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  5186
    ].
4403
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5187
    prefs extendedWordSelectMode ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5188
	"the typical mode, useful for text and code"
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5189
	^ char isNationalAlphaNumeric or:[char == $_]
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  5190
    ].
4403
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5191
    "another typical mode, also useful for text and code"
3564
59aa55968987 wordCheck more flexible
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  5192
    ^ char isNationalAlphaNumeric
4403
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5193
8d32cc71fb3b comments
Claus Gittinger <cg@exept.de>
parents: 4392
diff changeset
  5194
    "Modified (comment): / 17-03-2012 / 19:04:13 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  5195
! !
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5196
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5197
!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
  5198
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5199
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
  5200
    "go through whole text expanding tabs into spaces.
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5201
     This is meant to be called for text being imported from a file.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5202
     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
  5203
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5204
    |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
  5205
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5206
    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
  5207
    list notNil ifTrue:[
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5208
	nLines := self size.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5209
	1 to:nLines do:[:index |
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5210
	    line := self at:index.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5211
	    line notNil ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5212
		(line isString) ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5213
		    newLine := line withTabsExpanded.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5214
		    newLine ~~ line ifTrue:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5215
			list at:index put:newLine
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5216
		    ].
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5217
		] ifFalse:[
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5218
		    includesNonStrings := true.
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5219
		]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5220
	    ]
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5221
	]
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5222
    ]
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5223
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5224
    "Modified: 30.8.1995 / 19:06:37 / claus"
627
257058092fbf handle Text
Claus Gittinger <cg@exept.de>
parents: 607
diff changeset
  5225
    "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
  5226
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5227
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5228
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
  5229
    "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
  5230
3151
fc183d8ff88c next-tab: fallback to mod-8 tabs if beyond tab-list
Claus Gittinger <cg@exept.de>
parents: 3150
diff changeset
  5231
    ^ self nextTabAfter:colNr in:tabPositions.
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5232
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5233
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5234
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
  5235
    "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
  5236
     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
  5237
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5238
    |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
  5239
     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
  5240
     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
  5241
     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
  5242
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5243
    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
  5244
    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
  5245
    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
  5246
    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
  5247
    [thisTab <= col] whileTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5248
	(tabIndex == nTabs) ifTrue:[
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5249
	    "/ fallback to mod-8 tabs if beyond tab-list.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5250
	    thisTab := col + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5251
	    thisTab := thisTab + (8 - (thisTab \\ 8)).
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5252
	    ^ thisTab
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5253
	].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5254
	tabIndex := tabIndex + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5255
	thisTab := tabPositions at:tabIndex
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5256
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5257
    ^ 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
  5258
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5259
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5260
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
  5261
    "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
  5262
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5263
    |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
  5264
     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
  5265
     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
  5266
     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
  5267
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5268
    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
  5269
    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
  5270
    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
  5271
    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
  5272
    [thisTab < col] whileTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5273
	(tabIndex == nTabs) ifTrue:[^ thisTab].
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5274
	tabIndex := tabIndex + 1.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5275
	thisTab := tabPositions at:tabIndex
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5276
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5277
    (tabIndex == 1) ifTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5278
	^ 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
  5279
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5280
    ^ 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
  5281
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5282
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5283
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
  5284
    "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
  5285
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5286
    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
  5287
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5288
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5289
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
  5290
    "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
  5291
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5292
    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
  5293
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5294
2378
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  5295
setTabPositions:aVector
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  5296
    "set tab stops"
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  5297
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  5298
    tabPositions := aVector.
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  5299
!
9af26ad294af tab stuff
Claus Gittinger <cg@exept.de>
parents: 2352
diff changeset
  5300
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5301
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
  5302
    "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
  5303
     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
  5304
     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
  5305
     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
  5306
     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
  5307
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5308
    |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
  5309
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5310
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5311
     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
  5312
     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
  5313
     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
  5314
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5315
    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
  5316
    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
  5317
    (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
  5318
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5319
    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
  5320
    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
  5321
    [newLine startsWith:eightSpaces] whileTrue:[
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5322
	newLine := newLine copyFrom:9.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5323
	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
  5324
    ].
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  5325
    ^ (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
  5326
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  5327
    "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
  5328
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5329
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5330
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
  5331
    "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
  5332
     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
  5333
     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
  5334
     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
  5335
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5336
    |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
  5337
     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
  5338
     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
  5339
     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
  5340
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5341
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5342
     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
  5343
     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
  5344
     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
  5345
     (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
  5346
      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
  5347
    "
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5348
    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
  5349
    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
  5350
    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
  5351
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5352
    currentMax := line size + (nTabs * 7).
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  5353
    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
  5354
    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
  5355
    line do:[:character |
6522
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5356
        (character == (Character tab)) ifTrue:[
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5357
            nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5358
            tmpString size < nextTab ifTrue:[
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5359
                currentMax := currentMax * 2.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5360
                nString := line species new:currentMax.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5361
                nString replaceFrom:1 to:(dstIndex - 1) with:tmpString startingAt:1.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5362
                tmpString := nString.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5363
                nString := nil
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5364
            ].        
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5365
            [dstIndex < nextTab] whileTrue:[
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5366
                tmpString at:dstIndex put:(Character space).
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5367
                dstIndex := dstIndex + 1
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5368
            ]
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5369
        ] ifFalse:[
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5370
            tmpString at:dstIndex put:character.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5371
            dstIndex := dstIndex + 1
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5372
        ].
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5373
        (dstIndex > currentMax) ifTrue:[
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5374
            "
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5375
             this cannot happen with <= 8 tabs
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5376
            "
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5377
            currentMax := currentMax * 2.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5378
            nString := line species new:currentMax.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5379
            nString replaceFrom:1 to:(dstIndex - 1) with:tmpString startingAt:1.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5380
            tmpString := nString.
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5381
            nString := nil
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5382
        ].
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5383
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5384
        "make stc-optimizer happy
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5385
         - no need to return value of ifTrue:/ifFalse above"
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5386
        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
  5387
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5388
    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
  5389
    dstIndex == currentMax ifTrue:[
6522
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5390
        ^ 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
  5391
    ].
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5392
    ^ tmpString copyTo:dstIndex
386
514f73e07c2d more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
  5393
6522
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5394
    "Modified: / 23-02-1996 / 19:11:01 / cg"
6136bb31f689 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6510
diff changeset
  5395
    "Modified: / 08-02-2019 / 15:25:49 / Claus Gittinger"
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5396
!
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5397
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5398
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
  5399
    "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
  5400
     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
  5401
     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
  5402
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5403
    ^ 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
  5404
! !
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5405
3869
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5406
!ListView::HighlightArea methodsFor:'accessing'!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5407
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5408
endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5409
    ^ endCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5410
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5411
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5412
endCol:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5413
    endCol := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5414
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5415
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5416
endLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5417
    ^ endLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5418
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5419
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5420
endLine:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5421
    endLine := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5422
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5423
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5424
startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5425
    ^ startCol
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5426
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5427
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5428
startCol:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5429
    startCol := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5430
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5431
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5432
startLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5433
    ^ startLine
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5434
!
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5435
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5436
startLine:something
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5437
    startLine := something.
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5438
! !
82b87c5ae995 preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  5439
6239
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5440
!ListView::HighlightArea methodsFor:'accessing-color & font'!
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5441
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5442
bgColor
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5443
    ^ bgColor
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5444
!
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5445
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5446
bgColor:something
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5447
    bgColor := something.
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5448
!
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5449
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5450
fgColor
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5451
    ^ fgColor
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5452
!
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5453
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5454
fgColor:something
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5455
    fgColor := something.
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5456
! !
f8540a4fde9e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6231
diff changeset
  5457
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5458
!ListView::SearchSpec class methodsFor:'documentation'!
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5459
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5460
documentation
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5461
"
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5462
    documentation to be added.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5463
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5464
    [author:]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5465
        Claus Gittinger
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5466
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5467
    [instance variables:]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5468
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5469
    [class variables:]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5470
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5471
    [see also:]
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5472
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5473
"
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5474
! !
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5475
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5476
!ListView::SearchSpec methodsFor:'accessing'!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5477
5076
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5478
atBeginOfLineOnly
5079
ba56b62102ec class: ListView
Claus Gittinger <cg@exept.de>
parents: 5076
diff changeset
  5479
    ^ atBeginOfLineOnly ? false
5076
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5480
!
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5481
5715
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5482
atBeginOfLineOnly:aBoolean
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5483
    atBeginOfLineOnly := aBoolean.
5076
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5484
!
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5485
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5486
atEndOfLineOnly
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5487
    ^ atEndOfLineOnly ? false
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5488
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5489
    "Created: / 13-09-2018 / 10:04:11 / Claus Gittinger"
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5490
!
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5491
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5492
atEndOfLineOnly:aBoolean
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5493
    atEndOfLineOnly := aBoolean.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5494
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5495
    "Created: / 13-09-2018 / 10:04:16 / Claus Gittinger"
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5496
!
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5497
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5498
forward
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5499
    ^ forward ? true
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5500
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5501
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5502
fullWord
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5503
    ^ fullWord ? false
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5504
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5505
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5506
ignoreCase
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5507
    ^ ignoreCase ? false
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5508
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5509
5217
a243db9b7c43 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5198
diff changeset
  5510
ignoreDiacritics
6281
5b9029e14c9e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  5511
    ^ ignoreDiacritics ? false
5217
a243db9b7c43 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5198
diff changeset
  5512
!
a243db9b7c43 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5198
diff changeset
  5513
a243db9b7c43 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5198
diff changeset
  5514
ignoreDiacritics:something
a243db9b7c43 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5198
diff changeset
  5515
    ignoreDiacritics := something.
a243db9b7c43 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5198
diff changeset
  5516
!
a243db9b7c43 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5198
diff changeset
  5517
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5518
match
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5519
    ^ match ? false
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5520
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5521
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5522
pattern
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5523
    ^ pattern
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5524
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5525
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5526
pattern:patternString
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5527
    pattern := patternString.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5528
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5529
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5530
pattern:patternString ignoreCase:ignoredCaseBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5531
    pattern := patternString.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5532
    ignoreCase := ignoredCaseBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5533
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5534
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5535
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5536
    pattern := patternString.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5537
    ignoreCase := ignoredCaseBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5538
    match := matchBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5539
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5540
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5541
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean forward:forwardBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5542
    pattern := patternString.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5543
    ignoreCase := ignoredCaseBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5544
    match := matchBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5545
    forward := forwardBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5546
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5547
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5548
pattern:patternString ignoreCase:ignoredCaseBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5549
	  match:matchBoolean regexMatch:regexMatchBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5550
	  variable:variableBoolen
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5551
	  fullWord:fullWordBoolen forward:forwardBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5552
	  atBeginOfLineOnly:atBeginOfLineOnlyArg
5533
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5553
    pattern := patternString.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5554
    ignoreCase := ignoredCaseBoolean.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5555
    match := matchBoolean.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5556
    regexMatch := regexMatchBoolean.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5557
    variable := variableBoolen.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5558
    fullWord := fullWordBoolen.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5559
    forward := forwardBoolean.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5560
    atBeginOfLineOnly := atBeginOfLineOnlyArg
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5561
!
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5562
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5563
pattern:patternString ignoreCase:ignoredCaseBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5564
	  match:matchBoolean regexMatch:regexMatchBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5565
	  variable:variableBoolen
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5566
	  fullWord:fullWordBoolen forward:forwardBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5567
	  atBeginOfLineOnly:atBeginOfLineOnlyArg
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5568
	  wrapAtEnd:wrapAtEndOfTextArg
5533
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5569
    pattern := patternString.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5570
    ignoreCase := ignoredCaseBoolean.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5571
    match := matchBoolean.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5572
    regexMatch := regexMatchBoolean.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5573
    variable := variableBoolen.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5574
    fullWord := fullWordBoolen.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5575
    forward := forwardBoolean.
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5576
    atBeginOfLineOnly := atBeginOfLineOnlyArg.
5544
50fae0f51891 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  5577
    wrapAtEndOfText := wrapAtEndOfTextArg.
5533
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5578
!
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5579
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5580
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen forward:forwardBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5581
    pattern := patternString.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5582
    ignoreCase := ignoredCaseBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5583
    match := matchBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5584
    variable := variableBoolen.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5585
    forward := forwardBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5586
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5587
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5588
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen fullWord:fullWordBoolen forward:forwardBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5589
    pattern := patternString.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5590
    ignoreCase := ignoredCaseBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5591
    match := matchBoolean.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5592
    variable := variableBoolen.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5593
    fullWord := fullWordBoolen.
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5594
    forward := forwardBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5595
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5596
5789
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5597
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5598
		      fullWord:fullWordBoolen forward:forwardBoolean
a6db617369e9 Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents: 5780
diff changeset
  5599
		      atBeginOfLineOnly:atBeginOfLineOnlyArg
5076
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5600
    pattern := patternString.
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5601
    ignoreCase := ignoredCaseBoolean.
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5602
    match := matchBoolean.
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5603
    variable := variableBoolen.
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5604
    fullWord := fullWordBoolen.
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5605
    forward := forwardBoolean.
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5606
    atBeginOfLineOnly := atBeginOfLineOnlyArg
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5607
!
3172089d53a7 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5031
diff changeset
  5608
6429
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5609
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5610
                      fullWord:fullWordBoolen forward:forwardBoolean
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5611
                      atBeginOfLineOnly:atBeginOfLineOnlyArg
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5612
                      atEndOfLineOnly:atEndOfLineOnlyArg
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5613
    pattern := patternString.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5614
    ignoreCase := ignoredCaseBoolean.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5615
    match := matchBoolean.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5616
    variable := variableBoolen.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5617
    fullWord := fullWordBoolen.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5618
    forward := forwardBoolean.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5619
    atBeginOfLineOnly := atBeginOfLineOnlyArg.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5620
    atEndOfLineOnly := atEndOfLineOnlyArg.
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5621
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5622
    "Created: / 13-09-2018 / 10:04:35 / Claus Gittinger"
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5623
!
5bc480285a06 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6398
diff changeset
  5624
5533
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5625
regexMatch
5715
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5626
    ^ regexMatch ? false
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5627
!
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5628
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5629
regexMatch:aBoolean
8baebc416a38 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  5630
    regexMatch := aBoolean.
5533
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5631
!
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5632
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5633
variable
6281
5b9029e14c9e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  5634
    ^ variable ? false
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5635
!
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5636
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5637
variable:variableBoolean
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5638
    variable := variableBoolean
5533
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5639
!
32bfa4f5e683 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5480
diff changeset
  5640
5544
50fae0f51891 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  5641
wrapAtEndOfText
6281
5b9029e14c9e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6252
diff changeset
  5642
    ^ wrapAtEndOfText ? false
5544
50fae0f51891 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  5643
!
50fae0f51891 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  5644
50fae0f51891 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  5645
wrapAtEndOfText:aBoolean
50fae0f51891 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5533
diff changeset
  5646
    wrapAtEndOfText := aBoolean.
4463
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5647
! !
8bfe40af7940 search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents: 4448
diff changeset
  5648
851
b9d71ccdefaa care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents: 837
diff changeset
  5649
!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
  5650
4523
585ec7f5fac2 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
  5651
version
5369
6bddfe83bab9 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5217
diff changeset
  5652
    ^ '$Header$'
4523
585ec7f5fac2 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
  5653
!
585ec7f5fac2 class: ListView
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
  5654
4015
8647dad37cb0 comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents: 3869
diff changeset
  5655
version_CVS
5369
6bddfe83bab9 class: ListView
Claus Gittinger <cg@exept.de>
parents: 5217
diff changeset
  5656
    ^ '$Header$'
249
75b8fb924904 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 236
diff changeset
  5657
! !
4495
512fb0a0d8bd class: ListView
Claus Gittinger <cg@exept.de>
parents: 4468
diff changeset
  5658