TextView.st
author Claus Gittinger <cg@exept.de>
Wed, 04 Sep 2002 21:02:27 +0200
changeset 2600 27417bb497f3
parent 2596 933689d5bd9c
child 2604 2031eca912aa
permissions -rw-r--r--
comment
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
2191
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    13
"{ Package: 'stx:libwidg' }"
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
    14
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    15
ListView subclass:#TextView
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    16
	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
1841
0c281de3baa7 checkin from browser
tm
parents: 1784
diff changeset
    17
		selectionEndCol clickPos clickStartLine clickStartCol clickLine
0c281de3baa7 checkin from browser
tm
parents: 1784
diff changeset
    18
		clickCol clickCount expandingTop wordStartCol wordStartLine
0c281de3baa7 checkin from browser
tm
parents: 1784
diff changeset
    19
		wordEndCol wordEndLine selectionFgColor selectionBgColor
0c281de3baa7 checkin from browser
tm
parents: 1784
diff changeset
    20
		selectStyle directoryForFileDialog defaultFileNameForFileDialog
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
    21
		externalEncoding contentsWasSaved lastSearchPattern
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
    22
		lastSearchIgnoredCase lastSearchDirection
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
    23
		parenthesisSpecification dropSource dragIsActive'
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
    24
	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    25
		DefaultSelectionBackgroundColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    26
		DefaultAlternativeSelectionForegroundColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
    27
		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
    28
		WordSelectCatchesBlanks ST80Selections LastSearchPatterns
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
    29
		NumRememberedSearchPatterns LastSearchIgnoredCase
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
    30
		DefaultParenthesisSpecification'
259
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    31
	poolDictionaries:''
837ccdc138ea use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    32
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    33
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    34
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
    35
!TextView class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    36
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    37
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    38
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    39
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
    40
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    41
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    42
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    43
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    44
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    45
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    46
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    47
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    48
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    49
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    50
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
    51
documentation
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    52
"
120
claus
parents: 119
diff changeset
    53
    a view for readOnly text - this class adds selections to a simple list.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
    54
    The text is not editable and there is no cursor.
120
claus
parents: 119
diff changeset
    55
    Use TextViews for readonly text, EditTextView for editable text.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    56
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    57
    Please read the historic notice in the ListView class.
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 292
diff changeset
    58
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
    59
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    60
120
claus
parents: 119
diff changeset
    61
      selectionStartLine      <Number>                the line of the selection start (or nil)
claus
parents: 119
diff changeset
    62
      selectionStartCol       <Number>                the col of the selection start
claus
parents: 119
diff changeset
    63
      selectionEndLine        <Number>                the line of the selection end
claus
parents: 119
diff changeset
    64
      selectionEndCol         <Number>                the col of the selection end
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    65
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    66
      clickStartLine          <Number>                temporary - remember where select operation started
120
claus
parents: 119
diff changeset
    67
      clickStartCol           <Number>                temporary
claus
parents: 119
diff changeset
    68
      clickLine               <Number>                temporary
claus
parents: 119
diff changeset
    69
      clickCol                <Number>                temporary
claus
parents: 119
diff changeset
    70
      clickCount              <Number>                temporary
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    71
      expandingTop            <Boolean>               temporary - for expandSelection
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    72
120
claus
parents: 119
diff changeset
    73
      selectionFgColor        <Color>                 color used to draw selections
claus
parents: 119
diff changeset
    74
      selectionBgColor        <Color>                 color used to draw selections
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    75
120
claus
parents: 119
diff changeset
    76
      selectStyle             <Symbol>                how words are selected
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    77
120
claus
parents: 119
diff changeset
    78
      directoryForFileDialog  <nil|pathName>          directory where save dialog should start
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    79
120
claus
parents: 119
diff changeset
    80
      contentsWasSaved        <Boolean>               set to true, whenever saved in a file
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
    81
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
    82
      externalEncoding        <Symbol|nil>            external encoding, used when text is saved to
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
    83
                                                      a file. Usually something like
96256221e3af support drag
ca
parents: 2581
diff changeset
    84
                                                      #jis7, #euc, #sjis etc.
96256221e3af support drag
ca
parents: 2581
diff changeset
    85
                                                      (currently only passed down from the
96256221e3af support drag
ca
parents: 2581
diff changeset
    86
                                                       fileBrowser)
96256221e3af support drag
ca
parents: 2581
diff changeset
    87
96256221e3af support drag
ca
parents: 2581
diff changeset
    88
      dropSource              <DropSource>            drag operation descriptor or nil (dragging disabled)
96256221e3af support drag
ca
parents: 2581
diff changeset
    89
      dragIsActive            <Boolean>               true, drag operation is activated  
96256221e3af support drag
ca
parents: 2581
diff changeset
    90
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
    91
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
    92
    [class variables:]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
    93
        ST80Selections        <Boolean>               enables ST80 style doubleclick behavior
96256221e3af support drag
ca
parents: 2581
diff changeset
    94
                                                      (right after opening parenthesis, right before
96256221e3af support drag
ca
parents: 2581
diff changeset
    95
                                                       closing parenthesis, at begin of a line
96256221e3af support drag
ca
parents: 2581
diff changeset
    96
                                                       at begin of text)
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
    97
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
    98
    [StyleSheet parameters:]
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
    99
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   100
      textView.background                       defaults to viewBackground
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   101
      textView.ViewFont                         defaults to textFont
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   102
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   103
      text.st80Selections                       st80 behavior (click on char after parent or quote)
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   104
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   105
      text.selectionForegroundColor             defaults to textBackgroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   106
      text.selectionBackgroundColor             defaults to textForegroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   107
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   108
      text.alternativeSelectionForegroundColor  pasted text (i.e. paste will not replace)
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   109
                                                defaults to selectionForegroundColor
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   110
      text.alternativeSelectionBackgroundColor  pasted text (i.e. paste will not replace)
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
   111
                                                defaults to selectionBackgroundColor
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   112
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   113
    [author:]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
   114
        Claus Gittinger
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   115
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 504
diff changeset
   116
    [see also:]
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
   117
        EditTextView CodeView Workspace
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   118
"
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   119
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   120
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   121
examples
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   122
"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   123
    although textViews (and instances of subclasses) are mostly used
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   124
    as components (in the fileBrowser, the browser, the launcher etc.),
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   125
    they may also be opened as a textEditor;
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   126
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   127
    open a (readonly) textView on some information text:
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   128
							[exBegin]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   129
	TextView 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   130
	    openWith:'read this' 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   131
	    title:'demonstration'
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   132
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   133
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   134
    the same, but open it modal:
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   135
							[exBegin]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   136
	TextView 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   137
	    openModalWith:'read this first' 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   138
	    title:'demonstration'
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   139
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   140
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   141
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   142
    open it modal (but editable) on some text:
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   143
    (must accept before closing)
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   144
    This is somewhat kludgy - when closed, the view has already
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   145
    nilled its link to the model. Therefore, the accept must be
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   146
    done 'manually' below.
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   147
    However, usually an applicationModel is installed as the
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   148
    editor-topViews application. This would get a closeRequest,
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   149
    where it could handle things.
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   150
							[exBegin]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   151
	|m textView|
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   152
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   153
	m := 'read this first' asValue.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   154
	textView := EditTextView openModalOnModel:m.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   155
	textView modified ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   156
	    (self confirm:'text was not accepted - do it now ?')
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   157
	    ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   158
		m value:textView contents
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   159
	    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   160
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   161
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   162
	Transcript showCR:m value.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   163
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   164
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   165
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   166
    open a textEditor on some file:
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   167
							[exBegin]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   168
	EditTextView openOn:'Makefile'
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   169
							[exEnd]
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   170
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   171
"
1016
6b49dc4b059d examples
Claus Gittinger <cg@exept.de>
parents: 1014
diff changeset
   172
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   173
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   174
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   175
!TextView class methodsFor:'instance creation'!
119
claus
parents: 97
diff changeset
   176
claus
parents: 97
diff changeset
   177
on:aModel aspect:aspect change:change menu:menu initialSelection:initial
claus
parents: 97
diff changeset
   178
    "for ST-80 compatibility"
claus
parents: 97
diff changeset
   179
120
claus
parents: 119
diff changeset
   180
    ^ (self new) 
claus
parents: 119
diff changeset
   181
	on:aModel 
claus
parents: 119
diff changeset
   182
	aspect:aspect
claus
parents: 119
diff changeset
   183
	list:aspect
claus
parents: 119
diff changeset
   184
	change:change 
claus
parents: 119
diff changeset
   185
	menu:menu
claus
parents: 119
diff changeset
   186
	initialSelection:initial
119
claus
parents: 97
diff changeset
   187
! !
claus
parents: 97
diff changeset
   188
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   189
!TextView class methodsFor:'class initialization'!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   190
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   191
initialize
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   192
    DefaultParenthesisSpecification isNil ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   193
        DefaultParenthesisSpecification := IdentityDictionary new.       
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   194
        DefaultParenthesisSpecification at:#open        put:#( $( $[ ${ "$> $<") .
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   195
        DefaultParenthesisSpecification at:#close       put:#( $) $] $} "$> $<").
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   196
        DefaultParenthesisSpecification at:#ignore      put:#( $' $" '$[' '$]' '${' '$)' ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   197
        DefaultParenthesisSpecification at:#eolComment  put:'"/'.     "/ sigh - must be 2 characters
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   198
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   199
! !
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   200
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   201
!TextView class methodsFor:'defaults'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
   202
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   203
defaultIcon
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   204
    "return the default icon if started as a topView"
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   205
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   206
    <resource: #style (#ICON #ICON_FILE)>
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   207
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   208
    |nm i|
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   209
1146
027884518745 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
   210
    i := self classResources at:'ICON' default:nil.
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   211
    i isNil ifTrue:[
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   212
        nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'.
2074
24e9d7beed2b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   213
        i := Smalltalk imageFromFileNamed:nm forClass:self.
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   214
    ].
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   215
    i notNil ifTrue:[
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   216
        i := i onDevice:Display
1143
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   217
    ].
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   218
    ^ i
f5c02d0c66cf icon from resources
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   219
1195
29102801022f defaultIcon improved
Claus Gittinger <cg@exept.de>
parents: 1193
diff changeset
   220
    "Modified: 18.4.1997 / 15:18:06 / cg"
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   221
!
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   222
910
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   223
defaultMenuMessage
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   224
    "This message is the default yo be sent to the menuHolder to get a menu"
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   225
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   226
    ^ #editMenu
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   227
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   228
    "Created: 3.1.1997 / 01:52:21 / stefan"
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   229
!
0446030ce647 Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents: 906
diff changeset
   230
2306
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   231
defaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   232
    "return the default selection background color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   233
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   234
    ^DefaultSelectionBackgroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   235
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   236
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   237
defaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   238
    "return the default selection foreground color"
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   239
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   240
    ^DefaultSelectionForegroundColor
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   241
!
39f295426770 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2291
diff changeset
   242
1477
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   243
defaultViewBackgroundColor
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   244
    "return the default view background"
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   245
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   246
    ^DefaultViewBackground
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   247
!
2d4b6115e2c5 redefine #defaultViewBackgroundColor for the spec class
tz
parents: 1476
diff changeset
   248
1729
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   249
st80SelectMode
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   250
    ^ ST80Selections
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   251
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   252
    "Modified: / 6.1.1999 / 14:19:26 / cg"
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   253
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   254
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   255
st80SelectMode:aBoolean
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   256
    ST80Selections := aBoolean
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   257
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   258
    "Created: / 7.1.1999 / 13:35:24 / cg"
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   259
!
71462ffec5e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
   260
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   261
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   262
    "extract values from the styleSheet and cache them in class variables"
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   263
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   264
    <resource: #style (#'textView.background'
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   265
                       #'text.selectionForegroundColor' #'text.selectionBackgroundColor'
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   266
                       #'text.alternativeSelectionForegroundColor' #'text.alternativeSelectionBackgroundColor'
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   267
                       #'textView.font' #'text.wordSelectCatchesBlanks'
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   268
                       #'text.st80Selections')>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 428
diff changeset
   269
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   270
    DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   271
    DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   272
    DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'.
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   273
    DefaultAlternativeSelectionForegroundColor := StyleSheet colorAt:'text.alternativeSelectionForegroundColor' default:DefaultSelectionForegroundColor.
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
   274
    DefaultAlternativeSelectionBackgroundColor := StyleSheet colorAt:'text.alternativeSelectionBackgroundColor' default:DefaultSelectionBackgroundColor.
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
   275
    DefaultFont := StyleSheet fontAt:'textView.font'.
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
   276
    MatchDelayTime := 0.6.
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   277
    WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   278
    ST80Selections := StyleSheet at:'text.st80Selections' default:false.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   279
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
   280
    "Modified: / 31.10.1997 / 13:17:16 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   281
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   282
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   283
!TextView class methodsFor:'interface specs'!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   284
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   285
searchDialogSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   286
    "This resource specification was automatically generated
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   287
     by the UIPainter of ST/X."
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   288
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   289
    "Do not manually edit this!! If it is corrupted,
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   290
     the UIPainter may not be able to read the specification."
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   291
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   292
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   293
     UIPainter new openOnClass:TextView andSelector:#searchDialogSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   294
    "
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   295
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   296
    <resource: #canvas>
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   297
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   298
    ^ 
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   299
     #(#FullSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   300
        #name: #searchDialogSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   301
        #window: 
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   302
       #(#WindowSpec
2421
bccbb97e8ab6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2420
diff changeset
   303
          #label: 'String search'
bccbb97e8ab6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2420
diff changeset
   304
          #name: 'String search'
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   305
          #min: #(#Point 10 10)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   306
          #max: #(#Point 1280 1024)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   307
          #bounds: #(#Rectangle 12 22 311 138)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   308
        )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   309
        #component: 
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   310
       #(#SpecCollection
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   311
          #collection: #(
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   312
           #(#HorizontalPanelViewSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   313
              #name: 'horizontalPanelView'
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   314
              #layout: #(#LayoutFrame 0 0.0 -26 1.0 0 1.0 0 1.0)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   315
              #level: 0
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   316
              #horizontalLayout: #fitSpace
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   317
              #verticalLayout: #center
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   318
              #horizontalSpace: 3
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   319
              #verticalSpace: 3
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   320
              #ignoreInvisibleComponents: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   321
              #reverseOrderIfOKAtLeft: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   322
              #component: 
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   323
             #(#SpecCollection
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   324
                #collection: #(
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   325
                 #(#ActionButtonSpec
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
   326
                    #label: 'Cancel'
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   327
                    #name: 'cancelButton'
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   328
                    #level: 2
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   329
                    #translateLabel: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   330
                    #tabable: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   331
                    #model: #cancel
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   332
                    #extent: #(#Point 95 21)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   333
                  )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   334
                 #(#ActionButtonSpec
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
   335
                    #label: 'Prev'
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   336
                    #name: 'prevButton'
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   337
                    #level: 2
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   338
                    #translateLabel: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   339
                    #tabable: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   340
                    #model: #prevAction
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   341
                    #extent: #(#Point 95 21)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   342
                  )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   343
                 #(#ActionButtonSpec
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
   344
                    #label: 'Next'
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   345
                    #name: 'nextButton'
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   346
                    #level: 2
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   347
                    #borderWidth: 1
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   348
                    #translateLabel: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   349
                    #tabable: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   350
                    #model: #nextAction
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   351
                    #isDefault: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   352
                    #extent: #(#Point 95 21)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   353
                  )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   354
                 )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   355
               
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   356
              )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   357
            )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   358
           #(#LabelSpec
2421
bccbb97e8ab6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2420
diff changeset
   359
              #label: 'SearchPattern:'
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   360
              #name: 'label'
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   361
              #layout: #(#LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   362
              #level: 0
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   363
              #translateLabel: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   364
              #adjust: #left
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   365
            )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   366
           #(#ComboBoxSpec
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   367
              #name: 'patternComboBox'
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   368
              #layout: #(#LayoutFrame 3 0.0 26 0 -3 1.0 48 0)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   369
              #tabable: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   370
              #model: #searchPattern
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   371
              #immediateAccept: false
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   372
              #acceptOnLeave: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   373
              #acceptOnReturn: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   374
              #acceptOnTab: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   375
              #acceptOnLostFocus: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   376
              #acceptOnPointerLeave: false
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   377
              #autoSelectInitialText: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   378
              #comboList: #patternList
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   379
            )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   380
           #(#CheckBoxSpec
2421
bccbb97e8ab6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2420
diff changeset
   381
              #label: 'Ignore case'
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   382
              #name: 'ignoreCaseCheckBox'
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   383
              #layout: #(#LayoutFrame 3 0.0 54 0 -3 1.0 77 0)
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   384
              #level: 0
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   385
              #tabable: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   386
              #model: #ignoreCase
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   387
              #translateLabel: true
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   388
            )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   389
           )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   390
         
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   391
        )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   392
      )
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   393
! !
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
   394
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
   395
!TextView class methodsFor:'startup'!
121
claus
parents: 120
diff changeset
   396
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   397
open
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   398
    "start an empty TextView"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   399
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   400
    ^ self openWith:nil
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   401
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   402
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   403
openModalOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   404
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   405
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   406
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   407
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   408
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   409
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   410
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   411
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   412
    "Created: 14.2.1997 / 15:24:12 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   413
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   414
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   415
openModalWith:aString
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   416
    "start a textView with aString as initial contents"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   417
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   418
    ^ self openModalWith:aString title:nil 
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   419
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   420
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   421
     TextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   422
     EditTextView openModalWith:'some text'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   423
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   424
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   425
    "Created: 14.2.1997 / 15:19:04 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   426
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   427
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   428
openModalWith:aString title:aTitle
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   429
    "start a textView with aString as initial contents. Return the textView."
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   430
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   431
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   432
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   433
    textView := self setupWith:aString title:aTitle.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   434
    textView topView openModal.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   435
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   436
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   437
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   438
     TextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   439
     EditTextView openModalWith:'some text' title:'testing'
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   440
    "
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   441
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   442
    "Modified: 9.9.1996 / 19:32:29 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   443
    "Created: 14.2.1997 / 15:19:18 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   444
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   445
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   446
openOn:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   447
    "start a textView on a file; return the textView"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   448
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   449
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   450
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   451
    textView := self setupForFile:aFileName.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   452
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   453
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   454
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   455
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   456
     TextView openOn:'../../doc/overview.doc'
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   457
     EditTextView openOn:'../../doc/overview.doc'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   458
    "
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   459
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   460
    "Modified: 14.2.1997 / 15:21:51 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   461
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   462
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   463
openOnModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   464
    "start a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   465
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   466
    |textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   467
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   468
    textView := self setupForModel:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   469
    textView topView open.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   470
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   471
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   472
    "Created: 14.2.1997 / 15:23:36 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   473
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   474
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   475
openWith:aStringOrStringCollection
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   476
    "start a textView with aStringOrStringCollection as initial contents"
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   477
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   478
    ^ self openWith:aStringOrStringCollection title:nil 
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   479
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   480
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   481
     TextView openWith:'some text'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   482
     EditTextView openWith:'some text'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   483
    "
119
claus
parents: 97
diff changeset
   484
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   485
    "Created: 10.12.1995 / 17:41:32 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   486
    "Modified: 5.3.1997 / 15:37:19 / cg"
126
claus
parents: 121
diff changeset
   487
!
claus
parents: 121
diff changeset
   488
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   489
openWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   490
    "start a textView with aStringOrStringCollection as initial contents. Return the textView."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   491
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   492
    |textView|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   493
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   494
    textView := self setupWith:aStringOrStringCollection title:aTitle.
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   495
    textView topView open.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   496
    ^ textView
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   497
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   498
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   499
     TextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   500
     EditTextView openWith:'some text' title:'testing'
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   501
    "
126
claus
parents: 121
diff changeset
   502
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   503
    "Created: 10.12.1995 / 17:40:02 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   504
    "Modified: 5.3.1997 / 15:37:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   505
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   506
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   507
setupEmpty
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   508
    "create a textview in a topview, with horizontal and
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   509
     vertical scrollbars - a helper for #startWith: and #startOn:"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   510
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   511
    |top frame label|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   512
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   513
    label := 'unnamed'.
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   514
    top := StandardSystemView label:label icon:self defaultIcon.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   515
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   516
    frame := HVScrollableView 
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   517
		for:self 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   518
		miniScrollerH:true miniScrollerV:false
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   519
		in:top.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   520
    frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   521
    ^ frame scrolledView
896
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   522
963dc303b753 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 863
diff changeset
   523
    "Modified: 23.5.1965 / 14:12:32 / cg"
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   524
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   525
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   526
setupForFile:aFileName
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   527
    "setup a textView on a file; return the textView"
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   528
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
   529
    |top textView f|
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   530
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   531
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   532
    top := textView topView.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   533
    aFileName notNil ifTrue:[
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
   534
	f := aFileName asFilename.
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   535
	top label:(f baseName).
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   536
	textView contents:(f contents).
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   537
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   538
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   539
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   540
1014
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   541
    "Created: 14.2.1997 / 15:21:43 / cg"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   542
!
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   543
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   544
setupForModel:aModel
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   545
    "setup a textView on a model; return the textView"
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   546
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   547
    |top textView|
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   548
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   549
    textView := self setupEmpty.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   550
    textView model:aModel.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   551
    top := textView topView.
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   552
    ^ textView
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   553
d70cad164cd0 more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents: 1003
diff changeset
   554
    "Created: 14.2.1997 / 15:22:42 / cg"
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   555
!
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   556
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   557
setupWith:aStringOrStringCollection title:aTitle
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   558
    "setup a textView with aStringOrStringCollection as initial contents in a topView"
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   559
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   560
    |top textView|
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   561
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   562
    textView := self setupEmpty.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   563
    top := textView topView.
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   564
    aTitle notNil ifTrue:[top label:aTitle].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   565
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   566
    aStringOrStringCollection notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   567
	textView contents:aStringOrStringCollection
830
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   568
    ].
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   569
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   570
    ^ textView
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   571
0441903116d6 separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
   572
    "Created: 9.9.1996 / 19:31:22 / cg"
1100
2256f369ee96 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1055
diff changeset
   573
    "Modified: 5.3.1997 / 15:37:37 / cg"
119
claus
parents: 97
diff changeset
   574
! !
claus
parents: 97
diff changeset
   575
2100
69c10efca8f4 category renamining
Claus Gittinger <cg@exept.de>
parents: 2074
diff changeset
   576
!TextView methodsFor:'Compatibility - ST80'!
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   577
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   578
displaySelection:aBoolean
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   579
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   580
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   581
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   582
2118
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   583
editText:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   584
    "ST-80 compatibility: set the edited text."
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   585
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   586
    self contents:someText
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   587
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   588
    "Created: / 5.2.2000 / 17:06:18 / cg"
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   589
!
f9d8bfb35b03 added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2109
diff changeset
   590
2291
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   591
selectAndScroll
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   592
    "ST-80 compatibility: ignored here."
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   593
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   594
!
469168037c42 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2217
diff changeset
   595
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   596
selectionStartIndex
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   597
    "ST-80 compatibility: return the selections start character position."
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   598
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   599
    ^ self characterPositionOfSelection
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   600
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   601
    "Created: / 19.6.1998 / 00:21:44 / cg"
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   602
!
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   603
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   604
selectionStopIndex
2052
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   605
    "ST-80 compatibility: return the character position of
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   606
     the character right after the selection."
6f9798507b6c ST80 compatibility:
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
   607
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   608
    |idx|
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   609
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   610
    idx := self characterPositionOfSelectionEnd.
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   611
    idx == 0 ifTrue:[^ 0].
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   612
    ^ idx + 1
1584
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   613
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   614
    "Created: / 19.6.1998 / 00:22:08 / cg"
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   615
! !
9f3875dc341e added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents: 1545
diff changeset
   616
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   617
!TextView methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   618
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   619
characterPositionOfSelection
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   620
    "return the character index of the first character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   621
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   622
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   623
    selectionStartLine isNil ifTrue:[^ 0].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   624
    ^ self characterPositionOfLine:selectionStartLine
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   625
			       col:selectionStartCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   626
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   627
    "Modified: 14.8.1997 / 16:35:37 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   628
!
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   629
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   630
characterPositionOfSelectionEnd
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   631
    "return the character index of the last character in the selection.
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   632
     Returns 0 if there is no selection."
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   633
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   634
    selectionStartLine isNil ifTrue:[^ 0].
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   635
    ^ self characterPositionOfLine:selectionEndLine
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
   636
                               col:selectionEndCol
1303
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   637
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   638
    "Created: 14.8.1997 / 16:35:24 / cg"
6e2aa19c1aed checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1288
diff changeset
   639
    "Modified: 14.8.1997 / 16:35:45 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   640
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   641
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   642
contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   643
    "return true, if the contents was saved (by a save action),
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   644
     false if not (or was modified again after the last save)."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   645
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   646
    ^ contentsWasSaved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   647
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   648
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   649
defaultFileNameForFileDialog:aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   650
    "define the default fileName to use for the save-box"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   651
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   652
    defaultFileNameForFileDialog := aBaseName
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   653
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   654
    "Created: 13.2.1997 / 18:29:53 / cg"
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   655
!
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   656
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   657
directoryForFileDialog:aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   658
    "define the default directory to use for save-box"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   659
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   660
    directoryForFileDialog := aDirectory
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   661
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
   662
    "Modified: 13.2.1997 / 18:30:01 / cg"
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   663
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   664
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   665
externalEncoding:encodingSymOrNil
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   666
    "define how the contents should be encoded when saved
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   667
     via the 'save / save as' dialog.
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   668
     This is (currently) only passed down from the fileBrowser,
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   669
     and required when japanese/chines/korean text is edited.
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   670
     (encoding is one of #euc, #sjis, #jis7, #gb, #big5 or #ksc)"
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   671
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
   672
    externalEncoding := encodingSymOrNil
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   673
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   674
2581
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   675
parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   676
    "return the value of the instance variable 'parenthesisSpecification' (automatically generated)"
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   677
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   678
    ^ parenthesisSpecification
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   679
!
03ffde9bbf6a add parenthesisSpecification getter method
penk
parents: 2558
diff changeset
   680
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   681
parenthesisSpecification:aDictionary
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   682
    "set the dictionary which specifies which characters are opening, which are closing
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   683
     and which are ignored characters w.r.t. parenthesis matching.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   684
     See the classes initialize method for a useful value."
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   685
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
   686
    parenthesisSpecification := aDictionary
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   687
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   688
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   689
!TextView methodsFor:'accessing-contents'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   690
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   691
fromFile:aFileName
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   692
    "take contents from a named file"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   693
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
   694
    |f|
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
   695
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
   696
    f := aFileName asFilename.
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
   697
    self directoryForFileDialog:(f directoryName).
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
   698
    self contents:(f contents)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   699
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   700
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   701
list:something
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   702
    "set the displayed contents (a collection of strings)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   703
     with redraw.
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   704
     Redefined since changing the contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   705
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   706
    self unselect.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   707
    super list:something
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   708
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   709
    "Modified: 29.4.1996 / 12:13:24 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   710
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   711
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   712
setContents:something
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   713
    "set the contents (either a string or a Collection of strings)
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   714
     dont change the position (i.e. do not scroll) or the selection."
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   715
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   716
    |selStartLine selStartCol selEndLine selEndCol selStyle|
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   717
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   718
    selStartLine := selectionStartLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   719
    selStartCol := selectionStartCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   720
    selEndLine := selectionEndLine.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   721
    selEndCol := selectionEndCol.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   722
    selStyle := selectStyle.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   723
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   724
    super setContents:something.
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   725
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   726
    selStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   727
	self 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   728
	    selectFromLine:selStartLine col:selStartCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   729
	    toLine:selEndLine col:selEndCol.
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   730
    ].
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   731
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   732
    selectStyle := selStyle
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   733
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   734
    "Modified: / 31.3.1998 / 23:33:21 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   735
!
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   736
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   737
setList:something
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   738
    "set the displayed contents (a collection of strings)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   739
     without redraw.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   740
     Redefined since changing contents implies deselect"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   741
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   742
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   743
    super setList:something
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   744
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   745
1487
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
   746
text
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
   747
    "for ST80 compatibility"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
   748
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
   749
    ^ self contents
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
   750
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
   751
    "Created: / 19.4.1998 / 12:53:10 / cg"
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
   752
!
4a9bfda28991 added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1477
diff changeset
   753
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   754
wordAtLine:selectLine col:selectCol do:aFiveArgBlock
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   755
    "find word boundaries, evaluate the block argument with those.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   756
     A helper for nextWord and selectWord functions."
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   757
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   758
    |beginCol endCol endLine thisCharacter flag|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   759
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   760
    flag := #word.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   761
    beginCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   762
    endCol := selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   763
    endLine := selectLine.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   764
    thisCharacter := self characterAtLine:selectLine col:beginCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   765
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   766
    beginCol := self findBeginOfWordAtLine:selectLine col:selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   767
    endCol := self findEndOfWordAtLine:selectLine col:selectCol.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   768
    endCol == 0 ifTrue:[
1784
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   769
	endLine := selectLine + 1
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   770
    ].
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   771
1750
d87cc464fde2 comment
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   772
    "is the initial character within a word ?"
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   773
    (wordCheck value:thisCharacter) ifTrue:[
1784
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   774
	"
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   775
	 try to catch a blank ...
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   776
	"
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   777
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   778
	WordSelectCatchesBlanks ifTrue:[
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   779
	    ((beginCol == 1)
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   780
	    or:[(self characterAtLine:selectLine col:(beginCol - 1))
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   781
		 ~~ Character space]) ifTrue:[
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   782
		((self characterAtLine:selectLine col:(endCol + 1))
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   783
		  == Character space) ifTrue:[
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   784
		    endCol := endCol + 1.
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   785
		    flag := #wordRight
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   786
		]
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   787
	    ] ifFalse:[
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   788
		beginCol := beginCol - 1.
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   789
		flag := #wordLeft
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   790
	    ].
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   791
	].
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   792
    ].
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   793
    aFiveArgBlock value:selectLine 
1784
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   794
		  value:beginCol 
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   795
		  value:endLine 
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   796
		  value:endCol
e45846a6af7a remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents: 1769
diff changeset
   797
		  value:flag
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   798
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   799
    "Modified: 18.3.1996 / 17:31:04 / cg"
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   800
! !
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   801
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   802
!TextView methodsFor:'accessing-look'!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   803
2027
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   804
selectionBackgroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   805
    "return the selection-background color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   806
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   807
    ^ selectionBgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   808
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   809
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   810
selectionForegroundColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   811
    "return the selection-foreground color."
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   812
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   813
    ^ selectionFgColor
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   814
!
0bde8408361a accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   815
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   816
selectionForegroundColor:color1 backgroundColor:color2
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   817
    "set both the selection-foreground and cursor background colors.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   818
     The default is defined by the styleSheet; 
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   819
     typically black-on-green for color displays and white-on-black for b&w displays."
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   820
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   821
    selectionFgColor := color1 onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   822
    selectionBgColor := color2 onDevice:device.
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   823
    shown ifTrue:[
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   824
        self hasSelection ifTrue:[
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   825
            self invalidate
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
   826
        ]
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   827
    ]
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   828
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 715
diff changeset
   829
    "Modified: 29.5.1996 / 16:22:15 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   830
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   831
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   832
!TextView methodsFor:'accessing-mvc'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   833
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   834
on:aModel aspect:aspectSym list:listSym change:changeSym menu:menuSym initialSelection:initial
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   835
    "set all of model, aspect, listMessage, changeSymbol, menySymbol
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   836
     and selection. Added for ST-80 compatibility"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   837
906
a8b9b481ce70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   838
    aspectSym notNil ifTrue:[aspectMsg := aspectSym. 
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
   839
			     listMsg isNil ifTrue:[listMsg := aspectSym]].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   840
    changeSym notNil ifTrue:[changeMsg := changeSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   841
    listSym notNil ifTrue:[listMsg := listSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   842
    menuSym notNil ifTrue:[menuMsg := menuSym].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   843
"/    initial notNil ifTrue:[initialSelectionMsg := initial].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
   844
    self model:aModel.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   845
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
   846
    "Modified: 15.8.1996 / 12:52:54 / stefan"
906
a8b9b481ce70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 904
diff changeset
   847
    "Modified: 2.1.1997 / 16:11:28 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   848
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   849
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
   850
!TextView methodsFor:'drag & drop'!
96256221e3af support drag
ca
parents: 2581
diff changeset
   851
96256221e3af support drag
ca
parents: 2581
diff changeset
   852
allowDrag:aBoolean
96256221e3af support drag
ca
parents: 2581
diff changeset
   853
    "enable/disable dragging support
96256221e3af support drag
ca
parents: 2581
diff changeset
   854
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
   855
    aBoolean ifFalse:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   856
        dropSource := nil.
96256221e3af support drag
ca
parents: 2581
diff changeset
   857
    ] ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   858
        dropSource ifNil:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   859
            dropSource := DropSource receiver:self
96256221e3af support drag
ca
parents: 2581
diff changeset
   860
                              argument:nil
96256221e3af support drag
ca
parents: 2581
diff changeset
   861
                    dropObjectSelector:#collectionOfDragObjects
96256221e3af support drag
ca
parents: 2581
diff changeset
   862
                 displayObjectSelector:nil
96256221e3af support drag
ca
parents: 2581
diff changeset
   863
                      feedBackSelector:nil
96256221e3af support drag
ca
parents: 2581
diff changeset
   864
        ]
96256221e3af support drag
ca
parents: 2581
diff changeset
   865
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
   866
!
96256221e3af support drag
ca
parents: 2581
diff changeset
   867
96256221e3af support drag
ca
parents: 2581
diff changeset
   868
canDrag
96256221e3af support drag
ca
parents: 2581
diff changeset
   869
    "returns true if dragging is enabled
96256221e3af support drag
ca
parents: 2581
diff changeset
   870
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
   871
    dropSource notNil ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   872
        ^ self hasSelection
96256221e3af support drag
ca
parents: 2581
diff changeset
   873
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
   874
    ^ false
96256221e3af support drag
ca
parents: 2581
diff changeset
   875
!
96256221e3af support drag
ca
parents: 2581
diff changeset
   876
96256221e3af support drag
ca
parents: 2581
diff changeset
   877
collectionOfDragObjects
96256221e3af support drag
ca
parents: 2581
diff changeset
   878
    "returns collection of dragable objects assigned to selection
96256221e3af support drag
ca
parents: 2581
diff changeset
   879
     Here, by default, a collection of text-dragObjects is generated;
96256221e3af support drag
ca
parents: 2581
diff changeset
   880
     however, if a dragObjectConverter is defined, that one gets a chance
96256221e3af support drag
ca
parents: 2581
diff changeset
   881
     to convert as appropriate.
96256221e3af support drag
ca
parents: 2581
diff changeset
   882
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
   883
    |selection|
96256221e3af support drag
ca
parents: 2581
diff changeset
   884
96256221e3af support drag
ca
parents: 2581
diff changeset
   885
    selection := self selection.
96256221e3af support drag
ca
parents: 2581
diff changeset
   886
96256221e3af support drag
ca
parents: 2581
diff changeset
   887
    selection size == 0 ifTrue:[^ nil].
96256221e3af support drag
ca
parents: 2581
diff changeset
   888
  ^ Array with:(DropObject newText:selection).
96256221e3af support drag
ca
parents: 2581
diff changeset
   889
!
96256221e3af support drag
ca
parents: 2581
diff changeset
   890
96256221e3af support drag
ca
parents: 2581
diff changeset
   891
dropSource
96256221e3af support drag
ca
parents: 2581
diff changeset
   892
    "returns the dropSource or nil
96256221e3af support drag
ca
parents: 2581
diff changeset
   893
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
   894
    ^ dropSource
96256221e3af support drag
ca
parents: 2581
diff changeset
   895
!
96256221e3af support drag
ca
parents: 2581
diff changeset
   896
96256221e3af support drag
ca
parents: 2581
diff changeset
   897
dropSource:aDropSourceOrNil
96256221e3af support drag
ca
parents: 2581
diff changeset
   898
    "set the dropSource or nil
96256221e3af support drag
ca
parents: 2581
diff changeset
   899
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
   900
    dropSource := aDropSourceOrNil.
96256221e3af support drag
ca
parents: 2581
diff changeset
   901
! !
96256221e3af support drag
ca
parents: 2581
diff changeset
   902
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   903
!TextView methodsFor:'event processing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   904
53
b587b15eafab *** empty log message ***
claus
parents: 45
diff changeset
   905
buttonMotion:buttonMask x:x y:y
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   906
    "mouse-move while button was pressed - handle selection changes"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   907
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   908
    |movedVisibleLine movedLine movedCol 
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   909
     movedUp 
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   910
     oldStartLine oldEndLine oldStartCol oldEndCol|
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   911
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
   912
    clickLine isNil ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   913
        dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
   914
        ^ self
96256221e3af support drag
ca
parents: 2581
diff changeset
   915
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
   916
96256221e3af support drag
ca
parents: 2581
diff changeset
   917
    dragIsActive ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   918
        clickPos ifNil:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   919
            dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
   920
          ^ self
96256221e3af support drag
ca
parents: 2581
diff changeset
   921
        ].
96256221e3af support drag
ca
parents: 2581
diff changeset
   922
        (clickPos dist:(x@y)) >= 5.0 ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   923
            dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
   924
96256221e3af support drag
ca
parents: 2581
diff changeset
   925
            self hasSelection ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
   926
                dropSource startDragIn:self at:(x@y)
96256221e3af support drag
ca
parents: 2581
diff changeset
   927
            ]
96256221e3af support drag
ca
parents: 2581
diff changeset
   928
        ].
96256221e3af support drag
ca
parents: 2581
diff changeset
   929
        ^ self
96256221e3af support drag
ca
parents: 2581
diff changeset
   930
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   931
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   932
    "is it the select or 1-button ?"
1619
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   933
    self sensor leftButtonPressed ifFalse:[^ self].
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   934
"/    (device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   935
"/        (device buttonMotionMask:buttonMask includesButton:1) ifFalse:[
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   936
"/            ^ self
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   937
"/        ].
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
   938
"/    ].
53
b587b15eafab *** empty log message ***
claus
parents: 45
diff changeset
   939
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   940
    "if moved outside of view, start autoscroll"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   941
    (y < 0) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   942
        self compressMotionEvents:false.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   943
        self startAutoScrollUp:y.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   944
        ^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   945
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   946
    (y > height) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   947
        self compressMotionEvents:false.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   948
        self startAutoScrollDown:(y - height).
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   949
        ^ self
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   950
    ].
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
   951
    ((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   952
        self compressMotionEvents:false.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   953
        self startAutoScrollLeft:x.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   954
        ^ self
59
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   955
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 53
diff changeset
   956
    (x > width) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   957
        self compressMotionEvents:false.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   958
        self startAutoScrollRight:(x - width).
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   959
        ^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   960
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   961
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   962
    "move inside - stop autoscroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   963
    autoScrollBlock notNil ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   964
        self stopScrollSelect
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   965
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   966
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   967
    movedVisibleLine := self visibleLineOfY:y.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   968
    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   969
    (x < leftMargin) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   970
        movedCol := 0
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   971
    ] ifFalse:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   972
        movedCol := self colOfX:x inVisibleLine:movedVisibleLine
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   973
    ].
1755
ab3c4ee45498 allow selection of a single character
Claus Gittinger <cg@exept.de>
parents: 1750
diff changeset
   974
    ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   975
        selectionStartLine notNil ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   976
            ^ self
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   977
        ].
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   978
        (clickPos isNil 
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   979
        or:[(clickPos x - x) abs < 3 
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   980
            and:[(clickPos y - y) abs < 3]]) ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   981
            ^ self
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   982
        ].
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   983
        selectionStartLine := clickLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   984
        selectionStartCol := clickCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   985
        selectionEndLine := selectionStartLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   986
        selectionEndCol := selectionStartCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   987
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   988
        oldStartLine := selectionStartLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   989
        oldEndLine := selectionEndLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   990
        oldStartCol := selectionStartCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   991
        oldEndCol := selectionEndCol-1.
1755
ab3c4ee45498 allow selection of a single character
Claus Gittinger <cg@exept.de>
parents: 1750
diff changeset
   992
    ] ifFalse:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   993
        selectionStartLine isNil ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   994
            selectionStartLine := clickLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   995
            selectionStartCol := clickCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   996
            selectionEndLine := selectionStartLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   997
            selectionEndCol := selectionStartCol
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   998
        ].
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
   999
        oldStartLine := selectionStartLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1000
        oldEndLine := selectionEndLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1001
        oldStartCol := selectionStartCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1002
        oldEndCol := selectionEndCol.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1003
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1004
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1005
    "find out if we are before or after initial click"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1006
    movedUp := false.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1007
    (movedLine < clickStartLine) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1008
        movedUp := true
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1009
    ] ifFalse:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1010
        (movedLine == clickStartLine) ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1011
            (movedCol < clickStartCol) ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1012
                movedUp := true
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1013
            ]
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1014
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1015
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1016
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1017
    movedUp ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1018
        "change selectionStart"
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1019
        selectionStartCol := movedCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1020
        selectionStartLine := movedLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1021
        selectionEndCol := clickStartCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1022
        selectionEndLine := clickStartLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1023
        selectStyle notNil ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1024
            selectionEndCol := wordEndCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1025
            selectionEndLine := wordEndLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1026
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1027
    ] ifFalse:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1028
        "change selectionEnd"
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1029
        selectionEndCol := movedCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1030
        selectionEndLine := movedLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1031
        selectionStartCol := clickStartCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1032
        selectionStartLine := clickStartLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1033
        selectStyle notNil ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1034
            selectionStartCol := wordStartCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1035
            selectionStartLine := wordStartLine.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1036
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1037
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1038
164
Claus Gittinger <cg@exept.de>
parents: 132
diff changeset
  1039
    selectionStartLine isNil ifTrue:[^ self].
Claus Gittinger <cg@exept.de>
parents: 132
diff changeset
  1040
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1041
    (selectionStartCol == 0) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1042
        selectionStartCol := 1
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1043
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1044
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1045
    "
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1046
     if in word-select, just catch the rest of the word
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1047
    "
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1048
    (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1049
        movedUp ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1050
            selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1051
        ] ifFalse:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1052
            selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1053
            selectionEndCol == 0 ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1054
                selectionEndLine := selectionEndLine + 1
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1055
            ]
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1056
        ].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1057
    ].
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1058
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1059
    selectStyle == #line ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1060
        movedUp ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1061
            selectionStartCol := 1.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1062
        ] ifFalse:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1063
            selectionEndCol := 0.
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1064
            selectionEndLine := selectionEndLine + 1
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1065
        ]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1066
    ].
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1067
209
7a6db7fac566 dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
  1068
    self validateNewSelection.
7a6db7fac566 dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
  1069
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1070
    (oldStartLine == selectionStartLine) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1071
        (oldStartCol ~~ selectionStartCol) ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1072
            self redrawLine:oldStartLine 
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1073
                       from:((selectionStartCol min:oldStartCol) max:1)
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1074
                         to:((selectionStartCol max:oldStartCol) max:1)
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1075
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1076
    ] ifFalse:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1077
        self redrawFromLine:(oldStartLine min:selectionStartLine)
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1078
                         to:(oldStartLine max:selectionStartLine)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1079
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1080
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1081
    (oldEndLine == selectionEndLine) ifTrue:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1082
        (oldEndCol ~~ selectionEndCol) ifTrue:[
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1083
            self redrawLine:oldEndLine 
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1084
                       from:((selectionEndCol min:oldEndCol) max:1)
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1085
                         to:((selectionEndCol max:oldEndCol) max:1)
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1086
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1087
    ] ifFalse:[
1922
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1088
        self redrawFromLine:(oldEndLine min:selectionEndLine)
87222b5b9e32 oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents: 1909
diff changeset
  1089
                         to:(oldEndLine max:selectionEndLine)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1090
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1091
    clickLine := movedLine.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1092
    clickCol := movedCol
1619
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1093
f600c27c2c47 ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents: 1584
diff changeset
  1094
    "Modified: / 28.7.1998 / 16:02:18 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1095
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1096
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1097
buttonMultiPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1098
    "multi-mouse-click - select word under pointer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1099
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1100
    ((button == 1) or:[button == #select]) ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1101
	clickCount notNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1102
	    clickCount := clickCount + 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1103
	    (clickCount == 2) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1104
		self doubleClickX:x y:y
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1105
	    ] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1106
		(clickCount == 3) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1107
		    self tripleClickX:x y:y
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1108
		] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1109
		    (clickCount == 4) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1110
			self quadClickX:x y:y
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1111
		    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1112
		]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1113
	    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1114
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1115
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1116
	super buttonMultiPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1117
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1118
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1119
    "Modified: 11.9.1997 / 04:15:35 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1120
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1121
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1122
buttonPress:button x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1123
    "mouse-click - prepare for selection change"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1124
1308
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1125
    |sensor clickVisibleLine|
61d944600e3f care for nil sensors
Claus Gittinger <cg@exept.de>
parents: 1303
diff changeset
  1126
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1127
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1128
    sensor       := self sensor.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1129
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1130
    (sensor notNil and:[sensor shiftDown]) ifTrue:[
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1131
        "mouse-click with shift - adding to selection"
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1132
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1133
        "very simple - just simulate a move"
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1134
        ^ self buttonMotion:(device button1MotionMask) x:x y:y
813
7168eda47e3b Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  1135
    ].
7168eda47e3b Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  1136
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1137
    ((button == 1) or:[button == #select]) ifTrue:[
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1138
        clickVisibleLine := self visibleLineOfY:y.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1139
        clickPos := x @ y.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1140
        clickCol := self colOfX:x inVisibleLine:clickVisibleLine.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1141
        clickLine := self visibleLineToAbsoluteLine:clickVisibleLine.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1142
        clickStartLine := clickLine.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1143
        clickStartCol := clickCol.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1144
2593
6f1cdd5dafaa textDrag start with CTRL (optional)
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
  1145
        (self canDrag 
6f1cdd5dafaa textDrag start with CTRL (optional)
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
  1146
        and:[(self isInSelection:clickLine col:clickCol)
6f1cdd5dafaa textDrag start with CTRL (optional)
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
  1147
        and:[UserPreferences current startTextDragWithControl not
6f1cdd5dafaa textDrag start with CTRL (optional)
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
  1148
             or:[sensor ctrlDown]]]) ifTrue:[
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1149
            dragIsActive := true
96256221e3af support drag
ca
parents: 2581
diff changeset
  1150
        ] ifFalse:[
96256221e3af support drag
ca
parents: 2581
diff changeset
  1151
            self unselect.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1152
        ].
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1153
        clickCount := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1154
    ] ifFalse:[
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1155
        super buttonPress:button x:x y:y
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1156
    ]
813
7168eda47e3b Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents: 770
diff changeset
  1157
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1158
    "Modified: / 20.5.1999 / 17:02:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1159
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1160
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1161
buttonRelease:button x:x y:y
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1162
    "mouse- button release - turn off autoScroll if any"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1163
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 22
diff changeset
  1164
    ((button == 1) or:[button == #select]) ifTrue:[
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1165
        autoScrollBlock notNil ifTrue:[
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1166
            self stopScrollSelect
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1167
        ].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1168
        dragIsActive ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
  1169
            self unselect
96256221e3af support drag
ca
parents: 2581
diff changeset
  1170
        ].
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1171
        clickPos := nil.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1172
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1173
    ] ifFalse:[
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1174
        super buttonRelease:button x:x y:y
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1175
    ].
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1176
    dragIsActive := false.
96256221e3af support drag
ca
parents: 2581
diff changeset
  1177
1909
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1178
    "/ clickPos := clickLine := clickCol := nil.
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1179
27778cfa4bda checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1893
diff changeset
  1180
    "Modified: / 20.5.1999 / 17:14:23 / cg"
824
f62922fcfa5d Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents: 813
diff changeset
  1181
!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1182
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1183
doubleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1184
    "double-click - select word under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1185
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1186
    |sel ch matchCol scanCol fwdScan|
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1187
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1188
    ST80Selections == true ifTrue:[
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1189
        "/ st80 selects:
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1190
        "/   if clicked right after a parenthesis -> select to matching parenthesis
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1191
        "/   if clicked at beginning of the line  -> select that line
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1192
        "/   if clicked at the top of the text    -> select all
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1193
        "/
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1194
        clickCol == 1 ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1195
            clickLine == 1 ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1196
                self selectAll.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1197
                ^ self.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1198
            ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1199
            self selectLineAtY:y.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1200
            selectStyle := #line.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1201
            ^ self
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1202
        ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1203
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1204
        matchCol := nil.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1205
        "/ see what is to the left of that character ...
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1206
        clickCol > 1 ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1207
            ch := self characterAtLine:clickLine col:clickCol-1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1208
            ('([{<' includes:ch) ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1209
                matchCol := clickCol - 1
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1210
            ] ifFalse:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1211
                ('"' includes:ch) ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1212
                    scanCol := clickCol - 1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1213
                    fwdScan := true
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1214
                ]
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1215
            ]
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1216
        ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1217
        clickCol < (self listAt:clickLine) size ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1218
            ch := self characterAtLine:clickLine col:clickCol+1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1219
            (')]}>' includes:ch) ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1220
                matchCol := clickCol + 1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1221
            ] ifFalse:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1222
                ('"' includes:ch) ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1223
                    scanCol := clickCol + 1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1224
                    fwdScan := false
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1225
                ]
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1226
            ]
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1227
        ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1228
        matchCol notNil ifTrue:[
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1229
            self searchForAndSelectMatchingParenthesisFromLine:clickLine col:matchCol.
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1230
            ^ self
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1231
        ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1232
        scanCol notNil ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1233
            "/ if its an EOL comment, do it differently
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1234
            ch := self characterAtLine:clickLine col:clickCol.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1235
            ch == $/ ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1236
                self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1237
                ^ self
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1238
            ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1239
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1240
            self 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1241
                scanFor:$" fromLine:clickLine col:scanCol forward:fwdScan
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1242
                ifFound:[:line :col |
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1243
                            |selStart selEnd|
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1244
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1245
                            fwdScan ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1246
                                selStart := scanCol+1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1247
                                selEnd := col-1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1248
                            ] ifFalse:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1249
                                selStart := scanCol-1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1250
                                selEnd := col+1.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1251
                            ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1252
                            self selectFromLine:clickLine col:selStart
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1253
                                 toLine:line col:selEnd.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1254
                            ^ self
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1255
                           ]
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1256
                ifNotFound:[self showNotFound].
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1257
            ^ self
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1258
        ]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1259
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1260
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1261
    self selectWordAtX:x y:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1262
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1263
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1264
     special - if clicked on a parenthesis, select to matching
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1265
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1266
    ((sel := self selection) size == 1 
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1267
    and:[(sel := sel at:1) size == 1]) ifTrue:[
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1268
        ch := sel at:1.
2324
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  1269
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1270
        ('()[]{}<>' includes:ch) ifTrue:[
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1271
            self 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1272
                searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1273
                ifFound:[:line :col | 
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1274
                              |prevLine prevCol moveBack pos1|
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1275
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1276
                              prevLine := firstLineShown.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  1277
                              prevCol := viewOrigin x.
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1278
                              self selectFromLine:selectionStartLine col:selectionStartCol
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1279
                                           toLine:line col:col.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1280
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1281
                              self sensor ctrlDown ifFalse:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1282
                                  "/ undo scroll operation ...
2191
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1283
                                  self withCursor:Cursor eye do:[
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1284
                                      |delayCount|
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1285
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1286
                                      moveBack := false.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1287
                                      (')]}>' includes:ch) ifTrue:[
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  1288
                                           (firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1289
                                               moveBack := true
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1290
                                           ] 
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1291
                                      ] ifFalse:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1292
                                           selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1293
                                               self makeLineVisible:selectionEndLine.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1294
                                               moveBack := true
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1295
                                           ]
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1296
                                      ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1297
                                      moveBack ifTrue:[
2191
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1298
                                           delayCount  := 0.
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1299
                                           pos1 := x@y. 
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1300
                                           self invalidateRepairNow:true.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1301
                                           Delay waitForSeconds:MatchDelayTime. 
2191
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1302
                                           delayCount := delayCount + MatchDelayTime. 
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1303
                                           [self sensor hasUserEventFor:self] whileFalse:[
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1304
                                                Delay waitForSeconds:MatchDelayTime / 2.
2191
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1305
                                                delayCount := delayCount + (MatchDelayTime / 2). 
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1306
                                                delayCount > 2 ifTrue:[
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1307
                                                    self cursor:Cursor eyeClosed.
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1308
                                                ].
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1309
                                                delayCount >= 2.3 ifTrue:[
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1310
                                                    self cursor:Cursor eye.
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1311
                                                    delayCount := 0.
373219bb2e9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2158
diff changeset
  1312
                                                ]
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1313
                                           ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1314
                                           self scrollToLine:prevLine; scrollToCol:prevCol.
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1315
                                      ].
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1316
                                  ]
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1317
                              ]
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1318
                          ]
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1319
                ifNotFound:[self showNotFound]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1320
                onError:[self beep].
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1321
            selectStyle := nil
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1322
        ]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1323
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1324
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1325
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1326
     remember words position in case of a drag following
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1327
    "
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1328
    wordStartLine := selectionStartLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1329
    wordEndLine := selectionEndLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1330
    selectStyle == #wordLeft ifTrue:[
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1331
        wordStartCol := selectionStartCol + 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1332
    ] ifFalse:[
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1333
        wordStartCol := selectionStartCol.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1334
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1335
    selectStyle == #wordRight ifTrue:[
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1336
        wordEndCol := selectionEndCol - 1
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1337
    ] ifFalse:[
1851
edec458ccfb4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1338
        wordEndCol := selectionEndCol
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1339
    ]
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1340
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1341
    "Created: 11.9.1997 / 04:12:55 / cg"
1332
0794ee877118 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1329
diff changeset
  1342
    "Modified: 19.9.1997 / 06:43:10 / cg"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1343
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1344
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1345
keyPress:key x:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1346
    "handle some keyboard input (there is not much to be done here)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1347
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1348
    <resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1349
                          #GotoLine #SelectAll #SaveAs #Print
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1350
                          #'F*' #'f*' )>
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1351
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1352
    (key == #Find) ifTrue:[self search. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1353
    (key == #Copy) ifTrue:[self copySelection. ^self].
447
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1354
    (key == #GotoLine) ifTrue:[self gotoLine. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1355
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1356
    (key == #FindNext) ifTrue:[self searchFwd. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1357
    (key == #FindPrev) ifTrue:[self searchBwd. ^self].
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1358
    (key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1359
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1360
    (key == #SelectAll) ifTrue:[self selectAll. ^self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1361
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1362
    (key == #SaveAs)    ifTrue:[self save.    ^self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1363
    (key == #Print)     ifTrue:[self doPrint. ^self].
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  1364
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1365
    "
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1366
     shift-Fn defines a key-sequence 
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1367
     Fn       pastes that sequence
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1368
     cmd-Fn   performs a 'doIt' on the sequence (Workspaces only)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1369
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1370
     (see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1371
    "
1193
811135bbd017 Do not crash when typing simple keys.
Stefan Vogel <sv@exept.de>
parents: 1188
diff changeset
  1372
    (key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1373
        (('[fF][0-9]' match:key)
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1374
        or:['[fF][0-9][0-9]' match:key]) ifTrue:[
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1375
            self sensor shiftDown ifTrue:[
1967
273caf76b2ea ask UserPrefs for functionKeySequences (no need for a global)
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  1376
                UserPreferences current functionKeySequences
273caf76b2ea ask UserPrefs for functionKeySequences (no need for a global)
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  1377
                    at:key put:(self selection)
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1378
            ].
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1379
            ^ self
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1380
        ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1381
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1382
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1383
    super keyPress:key x:x y:y
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 309
diff changeset
  1384
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1385
    "Modified: / 18.4.1997 / 12:12:27 / stefan"
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1386
    "Modified: / 3.5.1999 / 15:03:16 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1387
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1388
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1389
mapped 
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1390
    super mapped.
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1391
    selectionFgColor := selectionFgColor onDevice:device.
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1392
    selectionBgColor := selectionBgColor onDevice:device.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1393
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1394
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1395
quadClickX:x y:y
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1396
    "quadrupleClick-click - select all"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1397
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1398
    self selectAll
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1399
1476
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1400
    "Created: / 11.9.1997 / 04:15:24 / cg"
ac38c8af8585 setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1401
    "Modified: / 31.3.1998 / 14:21:13 / cg"
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1402
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1403
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1404
tripleClickX:x y:y
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1405
    "triple-click - select line under pointer"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1406
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1407
    self selectLineAtY:y.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1408
    selectStyle := #line
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1409
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  1410
    "Created: 11.9.1997 / 04:13:37 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1411
! !
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1412
2120
1054ce5c8fe7 category change
Claus Gittinger <cg@exept.de>
parents: 2118
diff changeset
  1413
!TextView methodsFor:'initialization & release'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1414
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1415
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1416
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1417
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1418
    super fetchDeviceResources.
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1419
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1420
    selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:device].
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1421
    selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:device].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1422
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1423
    "Created: 14.1.1997 / 00:14:33 / cg"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1424
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
  1425
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1426
initStyle
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1427
    "setup viewStyle specifics"
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1428
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1429
    super initStyle.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1430
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
  1431
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device].
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
  1432
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1433
    viewBackground := DefaultViewBackground.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1434
    selectionFgColor := DefaultSelectionForegroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1435
    selectionFgColor isNil ifTrue:[selectionFgColor := bgColor].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1436
    selectionBgColor := DefaultSelectionBackgroundColor.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1437
    selectionBgColor isNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1438
	device hasColors ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1439
	    DefaultSelectionForegroundColor isNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1440
		selectionFgColor := fgColor
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1441
	    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1442
	    selectionBgColor := Color green
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1443
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1444
	    device hasGrayscales ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1445
		DefaultSelectionForegroundColor isNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1446
		    selectionFgColor := fgColor
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1447
		].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1448
		selectionBgColor := Color grey
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1449
	    ] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1450
		selectionBgColor := fgColor
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1451
	    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1452
	]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1453
    ].
708
e8eb52699f90 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
  1454
966
824e0ecc0e6f comments
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  1455
    "Modified: 22.1.1997 / 11:57:53 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1456
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1457
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1458
initialize
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1459
    super initialize.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1460
    contentsWasSaved := false.
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1461
    dragIsActive     := false.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1462
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1463
    parenthesisSpecification isNil ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1464
        parenthesisSpecification := DefaultParenthesisSpecification.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1465
    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  1466
911
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1467
    "I handle menus myself"
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1468
    menuHolder := menuPerformer := self.
22a930d19a9b menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents: 910
diff changeset
  1469
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  1470
    "/ on default allow drag
96256221e3af support drag
ca
parents: 2581
diff changeset
  1471
    self allowDrag:true.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1472
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1473
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1474
!TextView methodsFor:'menu actions'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1475
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1476
appendTo:fileName
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1477
    "append contents to a file named fileName"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1478
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1479
    |aStream msg|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1480
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1481
    (FileStream userInitiatedFileSaveQuerySignal queryWith:fileName asFilename) ifFalse:[
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1482
        msg := resources string:'Refused to append to file ''%1'' !!' with:fileName.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1483
        self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1484
        ^ self
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1485
    ].
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1486
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1487
    aStream := FileStream appendingOldFileNamed:fileName.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1488
    aStream isNil ifTrue:[
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1489
        msg := resources string:'cannot append to file %1 !!' with:fileName.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1490
        self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1491
    ] ifFalse:[
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1492
        self 
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1493
            fileOutContentsOn:aStream 
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1494
            compressTabs:true 
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1495
            encoding:externalEncoding.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1496
        aStream close.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1497
        contentsWasSaved := true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1498
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1499
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1500
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1501
changeFont
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1502
    "pop up a fontPanel to change font"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1503
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1504
    |newFont|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1505
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1506
    newFont := FontPanel fontFromUserInitial:font.
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1507
    newFont notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1508
	self font:newFont.
411
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1509
    ]
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1510
c1d26677134b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1511
    "Modified: 27.2.1996 / 00:53:51 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1512
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1513
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1514
copySelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1515
    "copy contents into smalltalk copybuffer"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1516
863
ed4282df00a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
  1517
    |text|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1518
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1519
    text := self selection.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1520
    text notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1521
	self unselect.
649
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  1522
863
ed4282df00a0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
  1523
	"/ forget any emphasis ...
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1524
	text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1525
	self setTextSelection:text.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1526
    ]
649
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  1527
097c69ce9599 forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents: 633
diff changeset
  1528
    "Modified: 17.5.1996 / 08:57:54 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1529
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1530
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1531
defaultForGotoLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1532
    "return a default value to show in the gotoLine box"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1533
447
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1534
    ^ selectionStartLine
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1535
ed41e1bbd9a1 also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
  1536
    "Modified: 1.3.1996 / 18:44:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1537
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1538
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1539
doPrint
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1540
    "print the contents on the printer"
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1541
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1542
    |printStream|
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1543
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1544
    list isNil ifTrue:[^ self].
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1545
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  1546
    self withWaitCursorDo:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1547
	printStream := Printer new.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1548
	printStream notNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1549
	    Printer writeErrorSignal handle:[:ex |
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1550
		self warn:('error while printing:\\' 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1551
			    , ex errorString 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1552
			    , '\\(printing with: ' , (Printer printCommand) , ')') withCRs
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1553
	    ] do:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1554
		self fileOutContentsOn:printStream.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1555
	    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1556
	    printStream close
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  1557
	]
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  1558
    ].
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  1559
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1560
    "Created: 6.5.1996 / 16:11:26 / cg"
829
fd15ef9c598a show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents: 824
diff changeset
  1561
    "Modified: 5.9.1996 / 19:18:30 / cg"
614
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1562
!
564049dc75d5 renamed #print to #doPrint
Claus Gittinger <cg@exept.de>
parents: 599
diff changeset
  1563
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1564
editMenu
1109
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1565
    "return my popUpMenu"
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1100
diff changeset
  1566
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  1567
    <resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)>
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1255
diff changeset
  1568
    <resource: #programMenu>
489
5816aa12fec8 resources
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  1569
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  1570
    |items m|
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  1571
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  1572
    items := #(
2458
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1573
                        ('Copy'        copySelection  Copy)
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1574
                        ('-'           nil            )
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1575
                        ('Search...'   search         Find)
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1576
                        ('Goto...'     gotoLine       GotoLine)
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1577
                        ('-'           nil            )
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1578
                        ('Font...'     changeFont     )
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1579
                        ('-'           nil            )
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1580
                        ('Save As...'  save           SaveAs)
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1581
                        ('Print'       doPrint        Print)
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1582
                ).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1583
1545
1812c587358f use new popupMenu creation
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
  1584
    m := PopUpMenu itemList:items resources:resources.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1585
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  1586
    self hasSelectionForCopy ifFalse:[
2458
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1587
        m disable:#copySelection.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1588
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1589
    ^ m
428
6b0881b0bce1 changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents: 411
diff changeset
  1590
2458
4a61ac0ba64c menu order
Claus Gittinger <cg@exept.de>
parents: 2455
diff changeset
  1591
    "Modified: / 12.11.2001 / 13:43:56 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1592
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1593
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1594
find
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1595
    "same as search - for VW compatibility"
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1596
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1597
    self search
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1598
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1599
    "Created: 31.7.1997 / 19:13:58 / cg"
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1600
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1601
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1602
gotoLine
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  1603
    "show a box to enter lineNumber for positioning;
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1604
     The entered number may be prefixed by a + or -; 
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1605
     in this case, the linenumber is taken relative to the current position."
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1606
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1607
    |l lineNumberBox input lineToGo relative|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1608
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1609
    lineNumberBox :=
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1610
        EnterBox
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1611
           title:(resources string:'Line number (or +/- relativeNr):')
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1612
           okText:(resources string:'Goto')
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1613
           abortText:(resources string:'Cancel')
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1614
           action:[:l | input := l].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1615
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1616
    l := self defaultForGotoLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1617
    l notNil ifTrue:[
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1618
        l := l printString
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1619
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1620
    lineNumberBox initialText:l .
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1621
    lineNumberBox showAtPointer.
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1622
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  1623
    input size > 0 ifTrue:[
1926
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1624
        input := input withoutSpaces.
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1625
        input size > 0 ifTrue:[
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1626
            (input startsWith:$+) ifTrue:[
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1627
                relative := 1.
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1628
            ] ifFalse:[
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1629
                (input startsWith:$-) ifTrue:[
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1630
                    relative := -1.
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1631
                ].
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1632
            ].
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1633
            relative notNil ifTrue:[
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1634
                input := input copyFrom:2.
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1635
            ].
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1636
            lineToGo := Integer readFromString:input onError:nil.
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1637
            lineToGo notNil ifTrue:[
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1638
                relative notNil ifTrue:[
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1639
                    lineToGo := self currentLine + (lineToGo * relative)
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1640
                ].
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1641
                self gotoLine:lineToGo
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1642
            ]
de514188eaf2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1922
diff changeset
  1643
        ]
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1644
    ].
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  1645
1524
60582bfee9ce allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents: 1496
diff changeset
  1646
    "Modified: / 17.5.1998 / 20:07:59 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1647
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1648
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1649
save
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1650
    "save contents into a file 
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1651
     - ask user for filename using a fileSelectionBox."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1652
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1653
    |fileBox|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1654
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1655
    fileBox := FileSaveBox
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1656
                    title:(resources string:'Save contents in:')
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1657
                    okText:(resources string:'Save')
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1658
                    abortText:(resources string:'Cancel')
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1659
                    action:[:fileName | self saveAs:fileName].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1660
    fileBox appendAction:[:fileName | self appendTo:fileName].
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1661
    directoryForFileDialog notNil ifTrue:[
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1662
        fileBox directory:directoryForFileDialog
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1663
    ].
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1664
    defaultFileNameForFileDialog notNil ifTrue:[
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2414
diff changeset
  1665
        fileBox initialText:defaultFileNameForFileDialog asString
1003
b1affa654489 added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  1666
    ].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1667
    fileBox showAtPointer.
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1668
1188
1ad187181fcb destroy saveBox after use.
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1669
    directoryForFileDialog := fileBox directory.  "/ remember for next time
1ad187181fcb destroy saveBox after use.
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1670
1ad187181fcb destroy saveBox after use.
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1671
    fileBox destroy.
1ad187181fcb destroy saveBox after use.
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1672
1ad187181fcb destroy saveBox after use.
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1673
    "Modified: 16.4.1997 / 20:49:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1674
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1675
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1676
saveAs:fileName
916
4201c9c2a4f0 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1677
    "save the contents into a file named fileName"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1678
 
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1679
    ^ self saveAs:fileName doAppend:false
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1680
!
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1681
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1682
saveAs:fileName doAppend:doAppend
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1683
    "save the contents into a file named fileName;
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1684
     if doAppend is true, the views contents is appended to the existing
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1685
     contents - otherwise, it overwrites any previous file contents."
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1686
 
916
4201c9c2a4f0 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1687
    self withCursor:Cursor write do:[
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1688
        |aStream msg|
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1689
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1690
        (FileStream userInitiatedFileSaveQuerySignal queryWith:fileName asFilename) ifFalse:[
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1691
            msg := resources string:'Refused to write file ''%1'' !!' with:fileName.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1692
            self warn:(msg , '\\(ST/X internal permission check)' ) withCRs.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1693
            ^ self
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1694
        ].
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1695
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1696
        FileStream openErrorSignal catch:[
2488
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1697
            doAppend ifTrue:[
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1698
                aStream := FileStream appendingOldFileNamed:fileName
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1699
            ] ifFalse:[
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1700
                aStream := FileStream newFileNamed:fileName.
3e1ee2bbab6b added saveAs:doAppend:
Claus Gittinger <cg@exept.de>
parents: 2458
diff changeset
  1701
            ]
2036
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1702
        ].
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1703
        aStream isNil ifTrue:[
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1704
            msg := resources string:'cannot write file ''%1'' !!' with:fileName.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1705
            self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1706
        ] ifFalse:[
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1707
            self
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1708
                fileOutContentsOn:aStream 
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1709
                compressTabs:true 
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1710
                encoding:externalEncoding.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1711
            aStream close.
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1712
            contentsWasSaved := true
83ac940a9fc6 allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents: 2027
diff changeset
  1713
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1714
    ]
916
4201c9c2a4f0 show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  1715
1359
d1d0c157a85f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1353
diff changeset
  1716
    "Modified: 22.10.1997 / 12:32:51 / cg"
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1717
!
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1718
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1719
search
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1720
    "search for a string - show a box to enter searchpattern 
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1721
     - currently no regular expressions are handled."
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1722
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1723
    "
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1724
     Q: is it a good idea to preserve the last searchstring between views ?
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1725
    "
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1726
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1727
    |searchBox patternHolder caseHolder 
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1728
     pattern fwd ign initialString
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1729
     bindings bldr searchAction modal|
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1730
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1731
    modal := (UserPreferences current searchDialogIsModal).
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  1732
2411
66f0c8bb1f87 remember last ignore-case flag setting
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  1733
    ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? false.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1734
    caseHolder := ign asValue.
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1735
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1736
    patternHolder := '' asValue.
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  1737
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  1738
    lastSearchPattern notNil ifTrue:[
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1739
        initialString := lastSearchPattern
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1740
    ].
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1741
    self hasSelectionWithinSingleLine ifTrue:[
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1742
        initialString := self selection
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  1743
    ].
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1744
    initialString isNil ifTrue:[
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1745
        LastSearchPatterns size > 0 ifTrue:[
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1746
            initialString := LastSearchPatterns first
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1747
        ]
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1748
    ].
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1749
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1750
    initialString notNil ifTrue:[
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1751
        patternHolder value:initialString.
2109
ccad6daad477 selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents: 2100
diff changeset
  1752
    ].
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1753
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1754
    fwd := true. 
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1755
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1756
    searchAction := [:fwd |
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1757
        pattern := patternHolder value.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1758
        pattern := pattern string withoutSeparators. "/ is that a good idea ?
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1759
        pattern notEmpty ifTrue:[
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1760
            self rememberSearchPattern:pattern.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1761
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1762
            ign := caseHolder value.
2411
66f0c8bb1f87 remember last ignore-case flag setting
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  1763
            LastSearchIgnoredCase := ign.
66f0c8bb1f87 remember last ignore-case flag setting
Claus Gittinger <cg@exept.de>
parents: 2403
diff changeset
  1764
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1765
            fwd ifFalse:[
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1766
                lastSearchDirection := #backward.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1767
                self searchBwd:pattern ignoreCase:ign.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1768
            ] ifTrue:[
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1769
                lastSearchDirection := #forward.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1770
                self searchFwd:pattern ignoreCase:ign.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1771
            ]
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1772
        ]
1288
19eee9e48131 added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1773
    ].
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  1774
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1775
    bindings := IdentityDictionary new.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1776
    bindings at:#searchPattern put:patternHolder.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1777
    modal ifTrue:[
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1778
        bindings at:#nextAction put:[searchBox doAccept.].
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1779
        bindings at:#prevAction put:[fwd := false. searchBox doAccept.].
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1780
    ] ifFalse:[
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1781
        bindings at:#nextAction put:[searchAction value:true.  "searchBox doAccept."].
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1782
        bindings at:#prevAction put:[searchAction value:false. "fwd := false. searchBox doAccept."].
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1783
    ].
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1784
    bindings at:#ignoreCase put:caseHolder.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1785
    bindings at:#patternList put:LastSearchPatterns.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1786
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1787
    modal ifTrue:[
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1788
        searchBox := SimpleDialog new.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1789
    ] ifFalse:[
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1790
        searchBox := ApplicationModel new.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1791
        searchBox createBuilder.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1792
    ].
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1793
    searchBox resources:(self resources).
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1794
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1795
    bldr := searchBox builder.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1796
    bldr addBindings:bindings.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1797
    searchBox allButOpenFrom:(self class searchDialogSpec).
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1798
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1799
    (bldr componentAt:#nextButton) cursor:(Cursor thumbsUp).
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1800
    (bldr componentAt:#prevButton) cursor:(Cursor thumbsUp).
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1801
    (bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown).
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1802
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1803
    modal ifTrue:[
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1804
        searchBox openDialog.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1805
        searchBox accepted ifTrue:[ searchAction value:fwd ].
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1806
    ] ifFalse:[
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1807
        (bldr componentAt:#nextButton) isReturnButton:false.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1808
        (bldr componentAt:#cancelButton) label:(resources string:'Close').
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1809
        (bldr componentAt:#cancelButton) action:[searchBox closeRequest].
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1810
        "/ searchBox masterApplication:self application.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1811
        self topView beMaster.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1812
        searchBox window beSlave.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1813
        searchBox window openInGroup:(self windowGroup).
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1814
        "/ searchBox window open.
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1815
    ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1816
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1817
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1818
!TextView methodsFor:'private'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1819
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  1820
currentSelectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  1821
    ^  selectionBgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  1822
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  1823
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  1824
currentSelectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  1825
    ^ selectionFgColor
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  1826
!
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  1827
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1828
fileOutContentsOn:aStream
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1829
    "save contents on a stream, replacing leading spaces by tab-characters."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1830
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1831
    self 
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1832
	fileOutContentsOn:aStream 
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1833
	compressTabs:true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1834
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1835
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1836
fileOutContentsOn:aStream compressTabs:compressTabs
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1837
    "save contents on a stream. If compressTabs is true,
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1838
     leading spaces will be replaced by tab-characters in the output."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1839
1255
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1840
    self 
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1841
	fileOutContentsOn:aStream 
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1842
	compressTabs:compressTabs 
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1843
	encoding:nil
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1844
!
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1845
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1846
fileOutContentsOn:aStream compressTabs:compressTabs encoding:encodingSymOrNil
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1847
    "save contents on a stream. If compressTabs is true,
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1848
     leading spaces will be replaced by tab-characters in the output."
c1bf6a3dbb78 allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents: 1195
diff changeset
  1849
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1850
    |startNr nLines string|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1851
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  1852
    aStream isFileStream ifTrue:[
2000
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1853
        "on some systems, writing linewise is very slow (via NFS)
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1854
         therefore we convert to a string and write it in big chunks.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1855
         To avoid creating huge strings, we do it in blocks of 1000 lines,
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1856
         limiting temporary string creation to about 50-80k.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1857
        "
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1858
        startNr := 1.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1859
        nLines := list size.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1860
        [startNr <= nLines] whileTrue:[
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1861
            string := list asStringWithCRsFrom:startNr 
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1862
                                            to:((startNr + 1000) min:nLines)
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1863
                                  compressTabs:compressTabs.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1864
            encodingSymOrNil notNil ifTrue:[
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1865
                string := string encodeInto:encodingSymOrNil
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1866
            ].
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1867
            aStream nextPutAll:string.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1868
            startNr := startNr + 1000 + 1.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1869
        ].
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  1870
    ] ifFalse:[
2000
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1871
        list do:[:aLine |
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1872
            aLine notNil ifTrue:[
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1873
                encodingSymOrNil notNil ifTrue:[
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1874
                    aStream nextPutLine:(aLine encodeInto:encodingSymOrNil)
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1875
                ] ifFalse:[
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1876
                    aStream nextPutLine:aLine.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1877
                ]
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1878
            ] ifFalse:[
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1879
                aStream cr.
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1880
            ]
efdedcb4ee33 oops - printing was wrong
Claus Gittinger <cg@exept.de>
parents: 1987
diff changeset
  1881
        ]
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  1882
    ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1883
758
e3b4e6a65a26 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 734
diff changeset
  1884
    "Modified: 8.6.1996 / 11:50:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1885
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1886
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1887
getFontParameters
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1888
    "get some info of the used font. They are cached since we use them often ..
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1889
     This is redefined here, to use the fonts maxHeight/maxAscent for
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1890
     line separation. This is required, to allow for proper handling of
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1891
     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: 651
diff changeset
  1892
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1893
    font := font onDevice:device.
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1894
    includesNonStrings == true ifTrue:[
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1895
        "/ for now, we do not support variable height entries ...
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1896
        fontHeight := list first heightOn:self
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1897
    ] ifFalse:[
1987
599825bed176 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1967
diff changeset
  1898
        fontHeight := font maxHeight.
668
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1899
    ].
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1900
    fontHeight := fontHeight + lineSpacing.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1901
    fontAscent := font maxAscent.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1902
    fontWidth := font width.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1903
    fontIsFixedWidth := font isFixedWidth.
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1904
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1905
    "Modified: 22.5.1996 / 12:02:47 / cg"
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1906
    "Created: 22.5.1996 / 12:18:34 / cg"
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1907
!
729295eb37fc use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
  1908
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1909
rememberSearchPattern:pattern
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1910
    |nRemembered|
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1911
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1912
    nRemembered := NumRememberedSearchPatterns ? 15.
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1913
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1914
    LastSearchPatterns isNil ifTrue:[
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1915
        LastSearchPatterns := OrderedCollection new.
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1916
    ].
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1917
    "/ move to top or addFirst
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1918
    (LastSearchPatterns includes:pattern) ifTrue:[
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1919
        LastSearchPatterns remove:pattern.
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1920
    ] ifFalse:[
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1921
        LastSearchPatterns size > nRemembered ifTrue:[
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1922
            LastSearchPatterns removeFirst
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1923
        ]
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1924
    ].
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1925
    LastSearchPatterns addFirst:pattern.
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1926
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1927
!
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  1928
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1929
scrollSelectDown
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1930
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1931
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1932
    |prevEndLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1933
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1934
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1935
    selectionEndLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1936
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1937
    self scrollDown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1938
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1939
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1940
    prevEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1941
    selectionEndLine := firstLineShown + nFullLinesShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1942
    selectionEndCol := 0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1943
    prevEndLine to:selectionEndLine do:[:lineNr |
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1944
	self redrawLine:lineNr
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1945
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1946
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1947
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1948
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1949
scrollSelectLeft
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1950
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1951
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1952
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1953
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1954
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1955
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1956
    selectionStartCol isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1957
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1958
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1959
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1960
    selectionStartCol := selectionStartCol - 1 max:1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1961
    self scrollLeft.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1962
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1963
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1964
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1965
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1966
scrollSelectRight
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1967
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1968
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1969
    |prevEndCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1970
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1971
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1972
    selectionEndCol isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1973
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1974
    prevEndCol := selectionEndCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1975
    selectionEndCol := selectionEndCol + 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1976
    self scrollRight.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1977
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1978
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1979
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1980
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1981
scrollSelectUp
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1982
    "auto scroll action; scroll and reinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1983
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1984
    |prevStartLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1985
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1986
    "just to make certain ..."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1987
    selectionStartLine isNil ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1988
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1989
    self scrollUp.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1990
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1991
    "make new selection immediately visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1992
    prevStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1993
    selectionStartLine := firstLineShown.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1994
    selectionStartCol := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1995
    selectionStartLine to:prevStartLine do:[:lineNr |
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1996
	self redrawLine:lineNr
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1997
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1998
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  1999
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2000
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2001
stopScrollSelect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2002
    "stop auto scroll; deinstall timed-block"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2003
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2004
    autoScrollBlock notNil ifTrue:[
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2005
	Processor removeTimedBlock:autoScrollBlock.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2006
	self compressMotionEvents:true.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2007
	autoScrollBlock := nil.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2008
	autoScrollDeltaT := nil
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2009
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2010
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2011
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2012
widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2013
    "return the width in pixels for a scroll between firstLine and lastLine"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2014
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2015
    selectionStartLine notNil ifTrue:[
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2016
	(lastLine < selectionStartLine) ifFalse:[
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2017
	    (firstLine > selectionEndLine) ifFalse:[
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2018
		^ width
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2019
	    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2020
	]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2021
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2022
    ^ super widthForScrollBetween:firstLine and:lastLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2023
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2024
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2025
!TextView methodsFor:'queries'!
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2026
2455
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  2027
isTextView
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  2028
    "I am showing text"
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  2029
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  2030
    ^ true
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  2031
!
750760093931 viewBackground setting;
Claus Gittinger <cg@exept.de>
parents: 2442
diff changeset
  2032
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2033
specClass
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2034
    "redefined, since the name of my specClass is nonStandard (i.e. not TextViewSpec)"
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2035
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2036
    self class == TextView ifTrue:[^ TextEditorSpec].
1046
10da5b6bd390 specClass query
ca
parents: 1028
diff changeset
  2037
    ^ super specClass
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2038
1380
1794c90633f9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1359
diff changeset
  2039
    "Modified: / 31.10.1997 / 19:48:35 / cg"
997
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2040
! !
615a5a19c5bf specClass
ca
parents: 966
diff changeset
  2041
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2042
!TextView methodsFor:'redrawing'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2043
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2044
clearMarginOfVisibleLine:visLine with:color
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2045
    "if there is a margin, clear it - a helper for selection drawing"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2046
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2047
    (leftMargin ~~ 0) ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2048
	self paint:color.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2049
	self fillRectangleX:margin
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2050
			  y:(self yOfVisibleLine:visLine)
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2051
		      width:leftMargin
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2052
		     height:fontHeight
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2053
    ]
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2054
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2055
    "Created: 6.3.1996 / 14:22:55 / cg"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2056
!
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2057
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2058
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2059
    startVisLineNr to:endVisLineNr do:[:visLine |
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2060
        self drawVisibleLineSelected:visLine 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2061
    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2062
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2063
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2064
drawVisibleLineSelected:visLineNr 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2065
    self 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2066
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2067
        inVisible:visLineNr 
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2068
        with:self currentSelectionFgColor and:self currentSelectionBgColor
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2069
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2070
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2071
drawVisibleLineSelected:visLineNr col:col
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2072
    self
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2073
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2074
        inVisible:visLineNr 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2075
        col:col 
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2076
        with:self currentSelectionFgColor and:self currentSelectionBgColor
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2077
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2078
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2079
drawVisibleLineSelected:visLineNr from:selectionStartCol
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2080
    self 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2081
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2082
        inVisible:visLineNr 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2083
        from:selectionStartCol
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2084
        with:self currentSelectionFgColor and:self currentSelectionBgColor.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2085
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2086
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2087
drawVisibleLineSelected:visLineNr from:startCol to:endCol
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2088
    self 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2089
        drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr))
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2090
        inVisible:visLineNr 
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2091
        from:startCol to:endCol
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2092
        with:self currentSelectionFgColor and:self currentSelectionBgColor.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2093
!
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2094
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2095
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2096
    "redraw a visible line range"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2097
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2098
    |startLine endLine specialCare end selVisStart line1 line2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2099
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2100
    shown ifFalse:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2101
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2102
    end := endVisLineNr.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2103
    (end > nLinesShown) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2104
        end := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2105
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2106
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2107
    selectionStartLine isNil ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2108
        specialCare := false
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2109
    ] ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2110
        startLine := self visibleLineToAbsoluteLine:startVisLineNr.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2111
        (startLine > selectionEndLine) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2112
            specialCare := false
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2113
        ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2114
            endLine := self visibleLineToAbsoluteLine:end.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2115
            (endLine < selectionStartLine) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2116
                specialCare := false
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2117
            ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2118
                specialCare := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2119
            ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2120
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2121
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2122
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2123
    "easy: nothing is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2124
    specialCare ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2125
        super redrawFromVisibleLine:startVisLineNr to:end.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2126
        ^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2127
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2128
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2129
    "easy: all is selected"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2130
    ((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2131
        self drawSelectedFromVisibleLine:startVisLineNr to:end.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2132
        ^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2133
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2134
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2135
    (selectionStartLine >= firstLineShown) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2136
        "draw unselected top part"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2137
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2138
        selVisStart := self listLineToVisibleLine:selectionStartLine.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2139
        super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1).
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2140
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2141
        "and first partial selected line"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2142
        self redrawVisibleLine:selVisStart.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2143
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2144
        "rest starts after this one"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2145
        line1 := selVisStart + 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2146
    ] ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2147
        line1 := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2148
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2149
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2150
    (line1 > end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2151
    (line1 < startVisLineNr) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2152
        line1 := startVisLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2153
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2154
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2155
    "draw middle part of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2156
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2157
    (selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2158
        line2 := nLinesShown
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2159
    ] ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2160
        line2 := (self listLineToVisibleLine:selectionEndLine) - 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2161
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2162
    (line2 > end) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2163
        line2 := end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2164
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2165
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2166
    self drawSelectedFromVisibleLine:line1 to:line2.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2167
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2168
    (line2 >= end) ifTrue:[^ self].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2169
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2170
    "last line of selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2171
    self redrawVisibleLine:(line2 + 1).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2172
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2173
    ((line2 + 2) <= end) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2174
        super redrawFromVisibleLine:(line2 + 2) to:end
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2175
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2176
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2177
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2178
redrawMarginOfVisibleLine:visLine
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2179
    "draw margin - a helper for selection drawing"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2180
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2181
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2182
    (leftMargin ~~ 0) ifTrue:[
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2183
    ]
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2184
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2185
    "Created: 6.3.1996 / 14:21:48 / cg"
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2186
!
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2187
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2188
redrawVisibleLine:visLineNr
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2189
    "redraw visible line lineNr"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2190
2558
4c10bec1117d more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents: 2557
diff changeset
  2191
    |line|
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2192
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2193
    selectionStartLine notNil ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2194
        line := self visibleLineToAbsoluteLine:visLineNr.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2195
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2196
            (line == selectionStartLine) ifTrue:[
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2197
                (line == selectionEndLine) ifTrue:[
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2198
                    "its part-of-single-line selection"
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2199
                    self clearMarginOfVisibleLine:visLineNr with:bgColor.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2200
                    (selectionStartCol > 1) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2201
                        super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2202
                    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2203
                    self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2204
                    super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2205
                    ^ self
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2206
                ].
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2207
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2208
                "its the first line of a multi-line selection"
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2209
                (selectionStartCol ~~ 1) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2210
                    self clearMarginOfVisibleLine:visLineNr with:bgColor.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2211
                    super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1)
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2212
                ] ifFalse:[
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2213
                    viewOrigin x == 0 ifTrue:[
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2214
                        self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2215
                    ]
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2216
                ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2217
                self drawVisibleLineSelected:visLineNr from:selectionStartCol.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2218
                ^ self
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2219
            ].
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2220
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2221
            (line == selectionEndLine) ifTrue:[
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2222
                "its the last line of a multi-line selection"
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2223
                (selectionEndCol == 0) ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2224
                    ^ super redrawVisibleLine:visLineNr
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2225
                ].
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2226
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2227
                self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2228
                self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2229
                super redrawVisibleLine:visLineNr from:(selectionEndCol + 1).
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2230
                ^ self
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2231
            ].
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2232
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2233
            "its a full line in a multi-line selection"
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2234
            self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor.
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2235
            self drawVisibleLineSelected:visLineNr.
2429
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2236
            ^ self
eed79a96e43b eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
  2237
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2238
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2239
    super redrawVisibleLine:visLineNr
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2240
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2241
    "Modified: 6.3.1996 / 14:22:19 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2242
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2243
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2244
redrawVisibleLine:visLine col:col
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  2245
    "redraw single character at col in visible line lineNr."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2246
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2247
    |line|
633
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  2248
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  2249
    "/
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  2250
    "/ care for selection
ea1c2ad6f2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 614
diff changeset
  2251
    "/
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2252
    selectionStartLine notNil ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2253
        line := self visibleLineToAbsoluteLine:visLine.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2254
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2255
            ((line == selectionStartLine)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2256
            and: [col < selectionStartCol]) ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2257
                ((line == selectionEndLine)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2258
                and: [col > selectionEndCol]) ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2259
                    "its in the selection"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2260
                    self drawVisibleLineSelected:visLine col:col.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2261
                    ^ self.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2262
                ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2263
            ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2264
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2265
    ].
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2266
    self drawVisibleLine:visLine col:col with:fgColor and:bgColor
1496
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  2267
95a24d9211df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  2268
    "Modified: / 22.4.1998 / 08:53:05 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2269
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2270
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2271
redrawVisibleLine:visLine from:startCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2272
    "redraw visible line lineNr from startCol to end of line"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2273
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2274
    |col line|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2275
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2276
    col := startCol.
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2277
    col == 0 ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2278
        col := 1.
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2279
    ].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2280
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2281
    selectionStartLine notNil ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2282
        line := self visibleLineToAbsoluteLine:visLine.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2283
        (line between:selectionStartLine and:selectionEndLine) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2284
            ((line == selectionStartLine) 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2285
             or:[line == selectionEndLine]) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2286
                "since I'm lazy, redraw full line"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2287
                self redrawVisibleLine:visLine.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2288
                ^ self
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2289
            ].
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2290
            "the line is fully within the selection"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2291
            self drawVisibleLineSelected:visLine from:col. 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2292
            ^ self
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2293
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2294
    ].
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2295
    super redrawVisibleLine:visLine from:col
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2296
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2297
    "Modified: 6.3.1996 / 14:19:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2298
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2299
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2300
redrawVisibleLine:visLine from:startCol to:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2301
    "redraw visible line lineNr from startCol to endCol"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2302
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2303
    |line allOut allIn leftCol rightCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2304
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2305
    line := self visibleLineToAbsoluteLine:visLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2306
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2307
    allIn := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2308
    allOut := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2309
    selectionStartLine isNil ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2310
        allOut := true
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2311
    ] ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2312
        (line between:selectionStartLine and:selectionEndLine) ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2313
            allOut := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2314
        ] ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2315
            (selectionStartLine == selectionEndLine) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2316
                ((endCol < selectionStartCol) 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2317
                or:[startCol > selectionEndCol]) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2318
                    allOut := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2319
                ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2320
                    ((startCol >= selectionStartCol) 
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2321
                    and:[endCol <= selectionEndCol]) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2322
                        allIn := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2323
                    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2324
                ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2325
            ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2326
                (line == selectionStartLine) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2327
                    (endCol < selectionStartCol) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2328
                        allOut := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2329
                    ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2330
                        (startCol >= selectionStartCol) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2331
                            allIn := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2332
                        ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2333
                    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2334
                ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2335
                    (line == selectionEndLine) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2336
                        (startCol > selectionEndCol) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2337
                            allOut := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2338
                        ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2339
                            (endCol <= selectionEndCol) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2340
                                allIn := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2341
                            ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2342
                        ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2343
                    ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2344
                        allIn := true
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2345
                    ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2346
                ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2347
            ]
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2348
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2349
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2350
    allOut ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2351
        super redrawVisibleLine:visLine from:startCol to:endCol.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2352
        ^ self
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2353
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2354
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2355
    allIn ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2356
        self drawVisibleLineSelected:visLine from:startCol to:endCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2357
    ] ifFalse:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2358
        "redraw part before selection"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2359
        ((line == selectionStartLine)
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2360
         and:[startCol <= selectionStartCol]) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2361
            super redrawVisibleLine:visLine from:startCol
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2362
                                              to:(selectionStartCol - 1).
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2363
            leftCol := selectionStartCol
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2364
        ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2365
            leftCol := startCol
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2366
        ].
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2367
        "redraw selected part"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2368
        (selectionEndLine > line) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2369
            rightCol := endCol
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2370
        ] ifFalse:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2371
            rightCol := selectionEndCol min:endCol
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2372
        ].
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2373
        self drawVisibleLineSelected:visLine from:leftCol to:rightCol.
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2374
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2375
        "redraw part after selection"
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2376
        (rightCol < endCol) ifTrue:[
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2377
            super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2378
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2379
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2380
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2381
    "special care for first and last line of selection:
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2382
     must handle margin also"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2383
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2384
    ((line == selectionEndLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2385
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2386
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2387
    ifTrue:[
2596
933689d5bd9c alternative selection color
Claus Gittinger <cg@exept.de>
parents: 2593
diff changeset
  2388
        self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2389
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2390
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2391
    ((line == selectionStartLine)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2392
    and:[(startCol == 1)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2393
    and:[selectionStartLine < selectionEndLine]])
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2394
    ifTrue:[
2557
dabeb8404df8 selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  2395
        self clearMarginOfVisibleLine:visLine with:bgColor.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2396
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2397
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  2398
    "Modified: 6.3.1996 / 14:23:26 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2399
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2400
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2401
!TextView methodsFor:'searching'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2402
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2403
scanFor:aCharacter fromLine:startLine col:startCol forward:forward
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2404
		     ifFound:foundBlock 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2405
		  ifNotFound:notFoundBlock
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2406
    "search for a character in the direction given by forward. 
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2407
     Performs foundBlock with line/col as argument if found, notFoundBlock if not."
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2408
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2409
    |i lineString 
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2410
     line   "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2411
     col    "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2412
     delta  "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2413
     endCol "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2414
     cc     
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2415
     maxLine "{ Class: SmallInteger }"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2416
      |
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2417
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2418
    col := startCol.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2419
    line := startLine.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2420
    forward ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2421
	delta := 1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2422
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2423
	delta := -1.
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2424
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2425
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2426
    lineString := list at:line.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2427
    maxLine := list size.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2428
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2429
    col := col + delta.
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2430
    [true] whileTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2431
	lineString notNil ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2432
	    forward ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2433
		endCol := lineString size.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2434
	    ] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2435
		endCol := 1
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2436
	    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2437
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2438
	    col to:endCol by:delta do:[:rCol |
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2439
		cc := lineString at:rCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2440
		cc == aCharacter ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2441
		    ^ foundBlock value:line value:rCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2442
		]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2443
	    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2444
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2445
	line := line + delta.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2446
	(line < 1 or:[line > maxLine]) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2447
	    ^ notFoundBlock value
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2448
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2449
	lineString := list at:line.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2450
	forward ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2451
	    col := 1
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2452
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2453
	    col := lineString size
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2454
	]
1322
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2455
    ].
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2456
    "not reached"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2457
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2458
    "Modified: 15.10.1996 / 12:22:30 / cg"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2459
    "Created: 11.9.1997 / 04:36:29 / cg"
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2460
!
b4ffcad003a7 support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
  2461
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2462
searchAgainInSameDirection
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2463
    "search again in the same direction and -if found- position cursor"
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2464
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2465
    |ign|
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2466
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2467
    ign := lastSearchIgnoredCase ? false.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2468
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2469
    self setSearchPattern.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2470
    lastSearchPattern notNil ifTrue:[
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2471
        lastSearchDirection == #backward ifTrue:[
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2472
            self 
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2473
                searchBwd:lastSearchPattern 
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2474
                ignoreCase:ign
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2475
        ] ifFalse:[
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2476
            self 
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2477
                searchFwd:lastSearchPattern 
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2478
                ignoreCase:ign
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2479
        ]
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2480
    ]
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2481
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2482
    "Modified: / 3.5.1999 / 15:00:28 / cg"
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2483
    "Created: / 3.5.1999 / 15:02:16 / cg"
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2484
!
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2485
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2486
searchBwd
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2487
    "search backward and -if found- position cursor"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2488
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  2489
    |ign|
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  2490
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  2491
    ign := lastSearchIgnoredCase ? false.
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  2492
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2493
    self setSearchPattern.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2494
    lastSearchPattern isNil ifTrue:[
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2495
        LastSearchPatterns size > 0 ifTrue:[
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2496
            lastSearchPattern := LastSearchPatterns first
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2497
        ]
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2498
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2499
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2500
    lastSearchPattern notNil ifTrue:[
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2501
        lastSearchDirection := #backward.
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2502
        self rememberSearchPattern:lastSearchPattern.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2503
        self 
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2504
            searchBwd:lastSearchPattern 
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2505
            ignoreCase:ign
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2506
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2507
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2508
    "Modified: / 3.5.1999 / 15:00:28 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2509
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2510
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2511
searchBwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2512
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2513
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2514
    self searchBwd:pattern ifAbsent:[self showNotFound].
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2515
    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2516
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2517
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2518
    "Modified: / 6.3.1999 / 23:46:40 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2519
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2520
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2521
searchBwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2522
    "do a backward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2523
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2524
    |startLine startCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2525
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2526
    selectionStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2527
	startLine := selectionStartLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2528
	startCol := selectionStartCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2529
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2530
	startLine := 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2531
	startCol := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2532
    ].
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2533
    self 
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2534
	searchBackwardFor:pattern startingAtLine:startLine col:startCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2535
	ifFound:[:line :col | self showMatch:pattern atLine:line col:col] 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2536
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2537
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2538
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2539
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2540
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2541
searchBwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2542
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2543
2372
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2544
    self searchBwd:pattern 
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2545
         ignoreCase:ign 
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2546
         ifAbsent:[
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2547
                    |sensor|
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2548
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2549
                    (sensor := self sensor) notNil ifTrue:[
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2550
                        sensor compressKeyPressEventsWithKey:#FindPrev.
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2551
                    ].
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2552
                    self showNotFound
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  2553
                  ].
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2554
    lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2555
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2556
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2557
    "Created: / 13.9.1997 / 06:18:00 / cg"
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2558
    "Modified: / 6.3.1999 / 23:46:47 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2559
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2560
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2561
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2562
    "do a backward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2563
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2564
    |startLine startCol|
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2565
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2566
    selectionStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2567
	startLine := selectionStartLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2568
	startCol := selectionStartCol
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2569
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2570
	startLine := 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2571
	startCol := 1
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2572
    ].
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2573
    self 
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2574
	searchBackwardFor:pattern 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2575
	ignoreCase:ign
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2576
	startingAtLine:startLine col:startCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2577
	ifFound:[:line :col | self showMatch:pattern atLine:line col:col] 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  2578
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2579
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2580
    "Modified: 13.9.1997 / 01:05:49 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2581
    "Created: 13.9.1997 / 06:18:41 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2582
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2583
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2584
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2585
    "select characters enclosed by matching parenthesis if one is under startLine/Col"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2586
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2587
    self 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2588
        searchForMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2589
        ifFound:[:line :col | 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2590
                  self selectFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2591
                               toLine:line col:col]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2592
        ifNotFound:[self showNotFound]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2593
        onError:[self beep]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2594
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2595
    "Modified: 9.10.1997 / 12:57:34 / cg"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2596
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2597
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2598
searchForMatchingParenthesisFromLine:startLine col:startCol
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2599
                     ifFound:foundBlock 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2600
                  ifNotFound:notFoundBlock
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2601
                     onError:failBlock
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2602
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2603
    "search for a matching parenthesis; start search with character at startLine/startCol.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2604
     Search for the corresponding character is done forward if its an opening,
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2605
     backwards if its a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2606
     Evaluate foundBlock with line/col as argument if found, notFoundBlock if not.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2607
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2608
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2609
    ^ self
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2610
        searchForMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2611
        ifFound:foundBlock 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2612
        ifNotFound:notFoundBlock
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2613
        onError:failBlock
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2614
        ignoring:(parenthesisSpecification at:#ignore) "/ #( $' $" '$[' '$]' '${' '$)' )
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2615
651
1e7153e21b36 skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents: 649
diff changeset
  2616
    "Modified: 18.5.1996 / 11:05:57 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2617
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2618
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2619
searchForMatchingParenthesisFromLine:startLine col:startCol
2324
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2620
                     ifFound:foundBlock 
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2621
                  ifNotFound:notFoundBlock
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2622
                     onError:failBlock
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2623
                    ignoring:ignoreSet
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2624
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2625
    "search for a matching parenthesis; start search with character at startLine/startCol.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2626
     Search for the corresponding character is done forward if its an opening,
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2627
     backwards if its a closing parenthesis.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2628
     Evaluate foundBlock with line/col as argument if found, notFoundBlock if not.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2629
     If there is a nesting error, evaluate failBlock."
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2630
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2631
    ^ self
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2632
        searchForMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2633
        ifFound:foundBlock 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2634
        ifNotFound:notFoundBlock
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2635
        onError:failBlock
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2636
        openingCharacters: (parenthesisSpecification at:#open)  "/ #( $( $[ ${ "$> $<") 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2637
        closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<")
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2638
        ignoredCharacters: ignoreSet
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2639
        specialEOLComment: (parenthesisSpecification at:#eolComment) "/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2640
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2641
"/    |i direction lineString 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2642
"/     parChar charSet  closingChar 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2643
"/     ignoring 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2644
"/     line   "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2645
"/     col    "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2646
"/     delta  "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2647
"/     endCol "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2648
"/     runCol "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2649
"/     cc prevCC nextCC incSet decSet 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2650
"/     nesting "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2651
"/     maxLine "{ Class: SmallInteger }"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2652
"/     ign skip anySet|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2653
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2654
"/    charSet := #( $( $) $[ $] ${ $} " $< $> " ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2655
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2656
"/    parChar := self characterAtLine:startLine col:startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2657
"/    i := charSet indexOf:parChar.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2658
"/    i == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2659
"/        ^ failBlock value   "not a parenthesis"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2660
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2661
"/    direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2662
"/    closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2663
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2664
"/    col := startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2665
"/    line := startLine.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2666
"/    direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2667
"/        delta := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2668
"/        incSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2669
"/        decSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2670
"/    ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2671
"/        delta := -1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2672
"/        incSet := #( $) $] $} "$>" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2673
"/        decSet := #( $( $[ ${ "$<" ).
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2674
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2675
"/    anySet := Set new.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2676
"/    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2677
"/    anySet := (anySet select:[:c | c isCharacter]) asString.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2678
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2679
"/    nesting := 1.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2680
"/    ignoring := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2681
"/    lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2682
"/    maxLine := list size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2683
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2684
"/    col := col + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2685
"/    [nesting ~~ 0] whileTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2686
"/        (lineString notNil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2687
"/        and:[lineString includesAny:anySet]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2688
"/            direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2689
"/                endCol := lineString size.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2690
"/            ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2691
"/                endCol := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2692
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2693
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2694
"/            col to:endCol by:delta do:[:rCol |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2695
"/                runCol := rCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2696
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2697
"/                cc := lineString at:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2698
"/                runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2699
"/                    nextCC := lineString at:runCol+1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2700
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2701
"/                    nextCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2702
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2703
"/                runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2704
"/                    prevCC := lineString at:runCol-1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2705
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2706
"/                    prevCC := nil
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2707
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2708
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2709
"/                ign := skip := false.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2710
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2711
"/                "/ check for comments.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2712
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2713
"/                ((cc == $" and:[nextCC == $/])
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2714
"/                or:[prevCC == $$ ]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2715
"/                    "/ do nothing
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2716
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2717
"/                    skip := true.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2718
"/                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2719
"/                    ignoreSet do:[:ignore |
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2720
"/                        ignore == cc ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2721
"/                            ign := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2722
"/                        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2723
"/                            ignore isString ifTrue:[ 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2724
"/                                cc == (ignore at:2) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2725
"/                                    runCol > 1 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2726
"/                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2727
"/                                            skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2728
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2729
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2730
"/                                ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2731
"/                                    cc == (ignore at:1) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2732
"/                                        runCol < lineString size ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2733
"/                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2734
"/                                                skip := true
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2735
"/                                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2736
"/                                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2737
"/                                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2738
"/                                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2739
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2740
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2741
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2742
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2743
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2744
"/                ign ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2745
"/                    ignoring := ignoring not
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2746
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2747
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2748
"/                ignoring ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2749
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2750
"/                        (incSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2751
"/                            nesting := nesting + 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2752
"/                        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2753
"/                            (decSet includes:cc) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2754
"/                                nesting := nesting - 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2755
"/                            ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2756
"/                        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2757
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2758
"/                ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2759
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2760
"/                nesting == 0 ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2761
"/                    "check if legal"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2762
"/
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2763
"/                    skip ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2764
"/                        cc == closingChar ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2765
"/                            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2766
"/                        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2767
"/                        ^ foundBlock value:line value:runCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2768
"/                    ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2769
"/                ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2770
"/            ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2771
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2772
"/        line := line + delta.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2773
"/        (line < 1 or:[line > maxLine]) ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2774
"/            ^ failBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2775
"/        ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2776
"/        lineString := list at:line.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2777
"/        direction == #fwd ifTrue:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2778
"/            col := 1
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2779
"/        ] ifFalse:[
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2780
"/            col := lineString size
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2781
"/        ]
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2782
"/    ].
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2783
"/    ^ notFoundBlock value
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2784
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2785
    "Modified: 15.10.1996 / 12:22:30 / cg"
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2786
!
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2787
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2788
searchForMatchingParenthesisFromLine:startLine col:startCol
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2789
                     ifFound:foundBlock 
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2790
                  ifNotFound:notFoundBlock
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2791
                     onError:failBlock
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2792
           openingCharacters:openingCharacters
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2793
           closingCharacters:closingCharacters
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2794
           ignoredCharacters:ignoreSet
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2795
          specialEOLComment:eolCommentSequence
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2796
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2797
    "search for a matching parenthesis; start search with character at startLine/startCol.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2798
     Search for the corresponding character is done forward if its an opening,
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2799
     backwards if its a closing parenthesis.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2800
     Evaluate foundBlock with line/col as argument if found, notFoundBlock if not.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2801
     If there is a nesting error, evaluate failBlock."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2802
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2803
    |i direction lineString 
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2804
     parChar charSet  closingChar 
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2805
     ignoring 
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2806
     line   "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2807
     col    "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2808
     delta  "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2809
     endCol "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2810
     runCol "{ Class: SmallInteger }"
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2811
     cc prevCC nextCC incSet decSet 
770
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2812
     nesting "{ Class: SmallInteger }"
a41466e3dfaa use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents: 758
diff changeset
  2813
     maxLine "{ Class: SmallInteger }"
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2814
     ign skip anySet
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2815
     eol1 eol2|
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2816
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2817
    charSet := openingCharacters , closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2818
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2819
    parChar := self characterAtLine:startLine col:startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2820
    i := charSet indexOf:parChar.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2821
    i == 0 ifTrue:[
2324
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2822
        ^ failBlock value   "not a parenthesis"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2823
    ].
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2824
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2825
    direction := ((openingCharacters collect:[:c | #fwd]) , (closingCharacters collect:[:c | #bwd])) at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2826
    closingChar := (closingCharacters , openingCharacters) at:i.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2827
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2828
    eol1 := eolCommentSequence at:1 ifAbsent:nil.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2829
    eol2 := eolCommentSequence at:2 ifAbsent:nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2830
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2831
    col := startCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2832
    line := startLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2833
    direction == #fwd ifTrue:[
2324
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2834
        delta := 1.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2835
        incSet := openingCharacters.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2836
        decSet := closingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2837
    ] ifFalse:[
2324
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2838
        delta := -1.
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2839
        incSet := closingCharacters.
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2840
        decSet := openingCharacters.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2841
    ].
1454
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  2842
    anySet := Set new.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  2843
    anySet addAll:incSet; addAll:decSet; addAll:ignoreSet.
ca768803f15d tuned searchForMatchingParen (with huge texts)
ca
parents: 1380
diff changeset
  2844
    anySet := (anySet select:[:c | c isCharacter]) asString.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2845
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2846
    nesting := 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2847
    ignoring := false.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2848
    lineString := list at:line.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2849
    maxLine := list size.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2850
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2851
    col := col + delta.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2852
    [nesting ~~ 0] whileTrue:[
2324
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2853
        (lineString notNil
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2854
        and:[lineString includesAny:anySet]) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2855
            direction == #fwd ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2856
                endCol := lineString size.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2857
            ] ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2858
                endCol := 1
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2859
            ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2860
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2861
            col to:endCol by:delta do:[:rCol |
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2862
                runCol := rCol.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2863
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2864
                cc := lineString at:runCol.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2865
                runCol < lineString size ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2866
                    nextCC := lineString at:runCol+1
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2867
                ] ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2868
                    nextCC := nil
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2869
                ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2870
                runCol > 1 ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2871
                    prevCC := lineString at:runCol-1
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2872
                ] ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2873
                    prevCC := nil
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2874
                ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2875
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2876
                ign := skip := false.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2877
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2878
                "/ check for comments.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2879
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  2880
                ((cc == eol1 and:[nextCC == eol2])
2324
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2881
                or:[prevCC == $$ ]) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2882
                    "/ do nothing
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2883
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2884
                    skip := true.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2885
                ] ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2886
                    ignoreSet do:[:ignore |
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2887
                        ignore == cc ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2888
                            ign := true
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2889
                        ] ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2890
                            ignore isString ifTrue:[ 
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2891
                                cc == (ignore at:2) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2892
                                    runCol > 1 ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2893
                                        (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2894
                                            skip := true
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2895
                                        ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2896
                                    ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2897
                                ] ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2898
                                    cc == (ignore at:1) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2899
                                        runCol < lineString size ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2900
                                            (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2901
                                                skip := true
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2902
                                            ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2903
                                        ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2904
                                    ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2905
                                ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2906
                            ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2907
                        ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2908
                    ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2909
                ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2910
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2911
                ign ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2912
                    ignoring := ignoring not
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2913
                ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2914
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2915
                ignoring ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2916
                    skip ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2917
                        (incSet includes:cc) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2918
                            nesting := nesting + 1
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2919
                        ] ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2920
                            (decSet includes:cc) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2921
                                nesting := nesting - 1
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2922
                            ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2923
                        ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2924
                    ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2925
                ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2926
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2927
                nesting == 0 ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2928
                    "check if legal"
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2929
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2930
                    skip ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2931
                        cc == closingChar ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2932
                            ^ failBlock value
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2933
                        ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2934
                        ^ foundBlock value:line value:runCol.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2935
                    ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2936
                ]
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2937
            ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2938
        ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2939
        line := line + delta.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2940
        (line < 1 or:[line > maxLine]) ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2941
            ^ failBlock value
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2942
        ].
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2943
        lineString := list at:line.
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2944
        direction == #fwd ifTrue:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2945
            col := 1
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2946
        ] ifFalse:[
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2947
            col := lineString size
98f7a9a4c50a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2306
diff changeset
  2948
        ]
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2949
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2950
    ^ notFoundBlock value
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2951
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2952
    "Modified: 15.10.1996 / 12:22:30 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2953
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2954
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2955
searchFwd
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2956
    "search forward for pattern or selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2957
1353
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  2958
    |ign|
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  2959
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  2960
    ign := lastSearchIgnoredCase ? false.
5dac6aa6ac96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1349
diff changeset
  2961
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2962
    selectStyle == #wordLeft ifTrue:[
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2963
        "
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2964
         remove the space from the selection
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2965
        "
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2966
        selectionStartCol := selectionStartCol + 1.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2967
        super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2968
        selectStyle := #word.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2969
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2970
    self setSearchPattern.
2414
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2971
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2972
    lastSearchPattern isNil ifTrue:[
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2973
        LastSearchPatterns size > 0 ifTrue:[
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2974
            lastSearchPattern := LastSearchPatterns first
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2975
        ]
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2976
    ].
ec98bcbd4c61 if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents: 2413
diff changeset
  2977
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2978
    lastSearchPattern notNil ifTrue:[
2201
ee684354d1d6 search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents: 2200
diff changeset
  2979
        self rememberSearchPattern:lastSearchPattern.
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2980
        lastSearchDirection := #forward.
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2981
        self 
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2982
            searchFwd:lastSearchPattern
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2983
            ignoreCase:ign
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2984
    ]
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2985
1893
bce50b364466 added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2986
    "Modified: / 3.5.1999 / 15:00:40 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2987
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2988
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2989
searchFwd:pattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2990
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2991
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2992
    self searchFwd:pattern ifAbsent:[self showNotFound].
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  2993
    lastSearchIgnoredCase := false.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2994
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2995
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  2996
    "Modified: / 6.3.1999 / 23:46:53 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2997
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2998
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  2999
searchFwd:pattern ifAbsent:aBlock
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3000
    "do a forward search"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3001
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3002
    |startLine startCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3003
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3004
    selectionStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3005
	startLine := selectionStartLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3006
	startCol := selectionStartCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3007
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3008
	startLine := 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3009
	startCol := 1
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3010
    ].
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3011
    self 
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3012
	searchForwardFor:pattern startingAtLine:startLine col:startCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3013
	ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3014
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3015
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3016
    "Modified: 13.9.1997 / 01:05:35 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3017
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3018
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3019
searchFwd:pattern ignoreCase:ign
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3020
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3021
2372
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3022
    self 
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3023
        searchFwd:pattern 
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3024
        ignoreCase:ign 
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3025
        ifAbsent:[
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3026
                    |sensor|
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3027
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3028
                    (sensor := self sensor) notNil ifTrue:[
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3029
                        sensor compressKeyPressEventsWithKey:#FindNext.
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3030
                    ].
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3031
                    self showNotFound
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3032
                 ].
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3033
    lastSearchIgnoredCase := ign.
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3034
    lastSearchPattern := pattern string
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3035
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3036
    "Created: / 13.9.1997 / 06:18:13 / cg"
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3037
    "Modified: / 6.3.1999 / 23:46:58 / cg"
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3038
!
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3039
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3040
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3041
    "do a forward search"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3042
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3043
    |startLine startCol|
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3044
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3045
    selectionStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3046
	startLine := selectionStartLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3047
	startCol := selectionStartCol
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3048
    ] ifFalse:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3049
	startLine := 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3050
	startCol := 1
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3051
    ].
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3052
    self 
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3053
	searchForwardFor:pattern 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3054
	ignoreCase:ign
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3055
	startingAtLine:startLine col:startCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3056
	ifFound:[:line :col | self showMatch:pattern atLine:line col:col]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3057
	ifAbsent:aBlock
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3058
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3059
    "Modified: 13.9.1997 / 01:05:35 / cg"
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3060
    "Created: 13.9.1997 / 06:18:27 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3061
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3062
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3063
searchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3064
    "return the last search pattern"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3065
1326
fbc08e9e2c55 allow case-ignoring search
Claus Gittinger <cg@exept.de>
parents: 1322
diff changeset
  3066
    ^ lastSearchPattern
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3067
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3068
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3069
setSearchPattern
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3070
    "set the searchpattern from the selection if there is one"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3071
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3072
    |sel|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3073
2206
d62d1bf91de2 searchPattern, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3074
"/    clickPos isNil ifTrue:[^ self].
d62d1bf91de2 searchPattern, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3075
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3076
    sel := self selection.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3077
    sel notNil ifTrue:[
2206
d62d1bf91de2 searchPattern, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  3078
        self setSearchPattern:sel asString withMatchEscapes 
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3079
    ]
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3080
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3081
    "Modified: / 6.3.1999 / 23:48:04 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3082
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3083
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3084
setSearchPattern:aString
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3085
    "set the searchpattern for future searches"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3086
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3087
    aString isNil ifTrue:[
1841
0c281de3baa7 checkin from browser
tm
parents: 1784
diff changeset
  3088
        lastSearchPattern := aString 
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3089
    ] ifFalse:[
1841
0c281de3baa7 checkin from browser
tm
parents: 1784
diff changeset
  3090
        lastSearchPattern := aString asString withoutSeparators string
1769
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3091
    ].
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3092
5e272292723b remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents: 1766
diff changeset
  3093
    "Modified: / 6.3.1999 / 23:47:36 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3094
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3095
2200
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  3096
setSearchPattern:aString ignoreCase:aBoolean
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  3097
    "set the searchpattern and caseIgnore for future searches"
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  3098
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  3099
    self setSearchPattern:aString.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  3100
    lastSearchIgnoredCase := aBoolean.
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  3101
!
8dad27a92dbd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2191
diff changeset
  3102
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3103
showMatch:pattern atLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3104
    "after a search, highlight the matched pattern.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3105
     The code below needs a rewrite to take care of match-characters
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3106
     (for now, it only highlights simple patterns and '*string*' correctly)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3107
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3108
    |realPattern|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3109
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3110
    realPattern := pattern.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3111
    (realPattern startsWith:$*) ifTrue:[
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3112
	realPattern := realPattern copyFrom:2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3113
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3114
    (realPattern endsWith:$*) ifTrue:[
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3115
	realPattern := realPattern copyWithoutLast:1
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3116
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3117
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3118
    self selectFromLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3119
		 toLine:line col:(col + realPattern size - 1).
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3120
    self makeLineVisible:line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3121
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3122
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3123
showNotFound
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3124
    "search not found - tell user by beeping and changing
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3125
     cursor for a while (sometimes I work with a headset :-)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3126
     (used to be: tell user by changing cursor for a while)"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3127
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3128
    |savedCursor|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3129
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3130
    savedCursor := cursor.
1028
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  3131
    [
2372
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3132
        self cursor:(Cursor cross).
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3133
        self beep.
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3134
        Processor activeProcess millisecondDelay:300.
2520
aed8069b4477 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3135
    ] ensure:[
2372
74102d251f55 avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents: 2350
diff changeset
  3136
        self cursor:savedCursor
1028
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  3137
    ]
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  3138
02048e7e493b showNotFound - unwinding
Claus Gittinger <cg@exept.de>
parents: 1016
diff changeset
  3139
    "Modified: 20.2.1997 / 12:49:27 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3140
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3141
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3142
!TextView methodsFor:'selections'!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3143
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3144
expandSelectionDown
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3145
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3146
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3147
    selectionStartLine notNil ifTrue:[
2442
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3148
        expandingTop ifTrue:[
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3149
            l := selectionStartLine.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3150
            selectionStartLine := selectionStartLine + 1.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3151
            (selectionStartLine > clickLine
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3152
            or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]])
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3153
            ifTrue:[
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3154
                t := selectionStartLine.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3155
                selectionStartLine := selectionEndLine.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3156
                selectionEndLine := t.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3157
                t := selectionStartCol.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3158
                selectionStartCol := selectionEndCol.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3159
                selectionEndCol := t.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3160
                expandingTop := false
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3161
            ].
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3162
        ] ifFalse:[
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3163
            l := selectionEndLine.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3164
            selectionEndLine := selectionEndLine + 1.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3165
        ].
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3166
"/        self redrawLine:l. 
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3167
"/        self redrawLine:l+1.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3168
        self redrawFromLine:l to:l+1.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3169
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3170
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3171
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3172
    "Created: 1.3.1996 / 23:35:08 / cg"
502
6f3d0d7a782c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3173
    "Modified: 18.3.1996 / 17:18:15 / cg"
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3174
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3175
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3176
expandSelectionLeft
502
6f3d0d7a782c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3177
    |c l t c1 c2|
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3178
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3179
    selectionStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3180
	expandingTop ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3181
	    selectionStartCol == 0 ifTrue:[^ self].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3182
	    l := selectionStartLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3183
	    selectionStartCol := (selectionStartCol - 1) max:1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3184
	    c := selectionStartCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3185
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3186
	    l := selectionEndLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3187
	    selectionEndCol := (selectionEndCol - 1) max:0.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3188
	    c := selectionEndCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3189
	    selectionEndLine == selectionStartLine ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3190
		selectionEndCol <= selectionStartCol ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3191
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3192
		    selectionEndCol := t.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3193
		    expandingTop := true.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3194
		    c := selectionStartCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3195
		]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3196
	    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3197
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3198
	c1 := c.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3199
	c2 := c1 + 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3200
	c1 == 0 ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3201
	    c1 := 1
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3202
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3203
	self redrawLine:l from:c1 to:c2. 
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3204
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3205
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3206
502
6f3d0d7a782c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 489
diff changeset
  3207
    "Modified: 18.3.1996 / 17:05:46 / cg"
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3208
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3209
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3210
expandSelectionRight
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3211
    |l c t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3212
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3213
    selectionStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3214
	expandingTop ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3215
	    l := selectionStartLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3216
	    c := selectionStartCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3217
	    selectionStartCol := selectionStartCol + 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3218
	    l == selectionEndLine ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3219
		c >= selectionEndCol ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3220
		    expandingTop := false.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3221
		    t := selectionStartCol. selectionStartCol := selectionEndCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3222
		    selectionEndCol := t.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3223
		    c := selectionStartCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3224
		]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3225
	    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3226
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3227
	    l := selectionEndLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3228
	    c := selectionEndCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3229
	    selectionEndCol := selectionEndCol + 1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3230
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3231
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3232
	self redrawLine:l from:c to:c+1.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3233
	self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3234
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3235
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3236
    "Created: 1.3.1996 / 23:33:17 / cg"
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3237
    "Modified: 6.3.1996 / 13:54:10 / cg"
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3238
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3239
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3240
expandSelectionUp
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3241
    |l t|
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3242
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3243
    selectionStartLine notNil ifTrue:[
2442
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3244
        expandingTop ifTrue:[
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3245
            selectionStartLine := (selectionStartLine - 1) max:1.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3246
            l := selectionStartLine. 
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3247
        ] ifFalse:[
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3248
            selectionEndLine := (selectionEndLine - 1) max:0.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3249
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3250
            l := selectionEndLine.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3251
            (selectionEndLine < clickLine
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3252
            or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])])
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3253
            ifTrue:[
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3254
                t := selectionStartLine.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3255
                selectionStartLine := selectionEndLine.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3256
                selectionEndLine := t.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3257
                t := selectionStartCol.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3258
                selectionStartCol := selectionEndCol.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3259
                selectionEndCol := t.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3260
                l := selectionStartLine.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3261
                expandingTop := true
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3262
            ].
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3263
        ].
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3264
        "/ self redrawLine:l. 
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3265
        "/ self redrawLine:l+1. 
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3266
        self redrawFromLine:l to:l+1.
914a5ef62334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3267
        self makeSelectionVisible.
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3268
    ].
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3269
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3270
    "Modified: 6.3.1996 / 14:12:06 / cg"
458
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3271
!
14e994e20eb5 selection via shift-cursor
Claus Gittinger <cg@exept.de>
parents: 447
diff changeset
  3272
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3273
hasSelection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3274
    "return true, if there is a selection"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3275
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3276
    ^ selectionStartLine notNil
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3277
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3278
2350
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  3279
hasSelectionForCopy
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  3280
    "return true, if there is a selection which can be copyied
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  3281
     (the same as #hasSelection, except for editfields in password-mode)"
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  3282
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  3283
    ^ self hasSelection
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  3284
!
c09d3dd534e3 do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  3285
2530
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  3286
hasSelectionWithinSingleLine
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  3287
    "return true, if there is a selection and it is within a line"
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  3288
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  3289
    ^ selectionStartLine notNil
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  3290
      and:[ selectionStartLine == selectionEndLine ]
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  3291
!
83e7b4b71496 searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  3292
2588
96256221e3af support drag
ca
parents: 2581
diff changeset
  3293
isInSelection:line col:aColNr
96256221e3af support drag
ca
parents: 2581
diff changeset
  3294
    "returns true, if the line, and column is in the selection
96256221e3af support drag
ca
parents: 2581
diff changeset
  3295
    "
96256221e3af support drag
ca
parents: 2581
diff changeset
  3296
    selectionStartLine ifNil:[^ false].
96256221e3af support drag
ca
parents: 2581
diff changeset
  3297
    selectionEndLine   ifNil:[^ false].
96256221e3af support drag
ca
parents: 2581
diff changeset
  3298
96256221e3af support drag
ca
parents: 2581
diff changeset
  3299
    (line between:selectionStartLine and:selectionEndLine) ifFalse:[
96256221e3af support drag
ca
parents: 2581
diff changeset
  3300
        ^ false
96256221e3af support drag
ca
parents: 2581
diff changeset
  3301
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  3302
96256221e3af support drag
ca
parents: 2581
diff changeset
  3303
    line == selectionStartLine ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
  3304
        aColNr < selectionStartCol ifTrue:[^ false]
96256221e3af support drag
ca
parents: 2581
diff changeset
  3305
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  3306
96256221e3af support drag
ca
parents: 2581
diff changeset
  3307
    line == selectionEndLine ifTrue:[
96256221e3af support drag
ca
parents: 2581
diff changeset
  3308
        (selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false]
96256221e3af support drag
ca
parents: 2581
diff changeset
  3309
    ].
96256221e3af support drag
ca
parents: 2581
diff changeset
  3310
    ^ true
96256221e3af support drag
ca
parents: 2581
diff changeset
  3311
!
96256221e3af support drag
ca
parents: 2581
diff changeset
  3312
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3313
makeSelectionVisible
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3314
    "scroll to make the selection visible"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3315
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3316
    |line col|
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3317
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3318
    selectionStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3319
	expandingTop ~~ false ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3320
	    line := selectionStartLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3321
	    col := selectionStartCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3322
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3323
	    line := selectionEndLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3324
	    col := selectionEndCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3325
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3326
	self makeLineVisible:line.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3327
	self makeColVisible:col inLine:line.        
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3328
    ]
478
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3329
180275291838 show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  3330
    "Modified: 6.3.1996 / 13:53:45 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3331
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3332
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3333
selectAll
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3334
    "select the whole text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3335
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3336
    self selectFromLine:1 col:1 toLine:(list size + 1) col:0
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3337
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3338
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3339
selectFromCharacterPosition:pos1 to:pos2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3340
    "compute line/col from character positions and select the text"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3341
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3342
    |line1 col1 line2 col2|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3343
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3344
    line1 := self lineOfCharacterPosition:pos1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3345
    col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3346
    line2 := self lineOfCharacterPosition:pos2.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3347
    col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3348
    self selectFromLine:line1 col:col1 toLine:line2 col:col2
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3349
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3350
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3351
selectFromLine:startLine col:startCol toLine:endLine col:endCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3352
    "select a piece of text and redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3353
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3354
    self unselect.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3355
    startLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3356
	"new:"
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3357
	endLine < startLine ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3358
	    ^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3359
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3360
	(endLine == startLine and:[endCol < startCol]) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3361
	    endCol ~~ 0 ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3362
		self selectFromLine:endLine col:endCol toLine:startLine col:startCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3363
	    ].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3364
	    ^ self
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3365
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3366
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3367
" old:
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3368
	endLine < startLine ifTrue:[^ self].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3369
	(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3370
"
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3371
	selectionStartLine := startLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3372
	selectionStartCol := startCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3373
	selectionEndLine := endLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3374
	selectionEndCol := endCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3375
	self validateNewSelection.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3376
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3377
	(selectionStartLine == selectionEndLine) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3378
	    self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3379
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3380
	    selectionStartLine to:selectionEndLine do:[:lineNr |
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3381
		self redrawLine:lineNr
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3382
	    ]
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3383
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3384
	selectStyle := nil.
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3385
    ]
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3386
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3387
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3388
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3389
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3390
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3391
     v contents:('smalltalk.rc' asFilename contentsOfEntireFile).
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3392
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3393
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3394
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3395
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3396
     v selectFromLine:2 col:2 toLine:10 col:15
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3397
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3398
904
597bf5cfe653 care for changed selection from #validateNewSelection
Claus Gittinger <cg@exept.de>
parents: 896
diff changeset
  3399
    "Modified: 2.1.1997 / 13:32:25 / cg"
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3400
!
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3401
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3402
selectFromLine:startLine toLine:endLine
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3403
    "select a piece of text and redraw that area"
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3404
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3405
    self selectFromLine:startLine col:1 toLine:endLine+1 col:0
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3406
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3407
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3408
     |v|
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3409
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3410
     v := TextView extent:300@300.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3411
     v contents:('smalltalk.rc' asFilename contentsOfEntireFile).
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3412
     v openAndWait.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3413
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3414
     Delay waitForSeconds:1.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3415
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3416
     v selectFromLine:2 toLine:10
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3417
    "
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3418
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3419
    "Modified: 29.4.1996 / 12:23:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3420
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3421
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3422
selectLine:selectLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3423
    "select one line and redraw it"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3424
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3425
    self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3426
    wordStartCol := selectionStartCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3427
    wordEndCol := selectionEndCol.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3428
    wordStartLine := selectionStartLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3429
    wordEndLine := selectionEndLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3430
    selectStyle := #line
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3431
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3432
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3433
selectLineAtY:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3434
    "select the line at given y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3435
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  3436
    |selectLine|
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  3437
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  3438
    selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3439
    selectLine notNil ifTrue:[
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2411
diff changeset
  3440
        self selectLine:selectLine
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3441
    ]
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3442
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3443
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3444
selectLineWhereCharacterPosition:pos
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3445
    "select the line, where characterPosition pos is living.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3446
     The argument pos starts at 1 from the start of the text
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3447
     and counts characters (i.e. can be used to convert from 
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3448
     character position within a string to line-position in view)."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3449
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3450
    self selectLine:(self lineOfCharacterPosition:pos)
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3451
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3452
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3453
selectWordAtLine:line col:col
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3454
    "select the word at given line/col"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3455
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3456
    self wordAtLine:line col:col do:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3457
	:beginLine :beginCol :endLine :endCol :style |
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3458
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3459
	self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3460
	selectStyle := style
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3461
    ]
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  3462
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  3463
    "Modified: 18.3.1996 / 17:30:38 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3464
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3465
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3466
selectWordAtX:x y:y
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3467
    "select the word at given x/y-(view-)coordinate"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3468
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3469
    |selectVisibleLine selectLine selectCol|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3470
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3471
    selectStyle := nil.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3472
    selectVisibleLine := self visibleLineOfY:y.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3473
    selectLine := self visibleLineToListLine:selectVisibleLine.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3474
    selectLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3475
	selectCol := self colOfX:x inVisibleLine:selectVisibleLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3476
	self selectWordAtLine:selectLine col:selectCol
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3477
    ]
1661
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  3478
bf446f457d95 fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents: 1619
diff changeset
  3479
    "Modified: / 8.9.1998 / 21:22:46 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3480
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3481
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3482
selection
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3483
    "return the selection as a collection of (line-)strings.
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3484
     If the selection ends in a full line, the last entry in the returned
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3485
     collection will be an empty string."
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3486
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3487
    selectionStartLine isNil ifTrue:[^ nil].
2158
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
  3488
    ^ self textFromLine:selectionStartLine col:selectionStartCol toLine:selectionEndLine col:selectionEndCol
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
  3489
1fbe3297506f generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents: 2120
diff changeset
  3490
    "Modified: / 22.2.2000 / 23:54:54 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3491
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3492
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3493
selectionAsString
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3494
    "return the selection as a String (i.e. without emphasis)"
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3495
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3496
    |sel s|
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3497
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3498
    (sel := self selection) isNil ifTrue:[^ nil].
2419
2ae3350454bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  3499
    sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]].
2217
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3500
    ^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3501
!
08502466e36d added #selectionAsString
Claus Gittinger <cg@exept.de>
parents: 2206
diff changeset
  3502
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3503
selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3504
    ^ selectionEndCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3505
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3506
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3507
selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3508
    ^ selectionEndLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3509
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3510
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3511
selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3512
    ^ selectionStartCol
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3513
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3514
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3515
selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3516
    ^ selectionStartLine
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3517
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3518
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3519
unselect
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3520
    "unselect - if there was a selection redraw that area"
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3521
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3522
    |startLine endLine startVisLine endVisLine|
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3523
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3524
    selectionStartLine notNil ifTrue:[
1728
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3525
	startLine := selectionStartLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3526
	endLine := selectionEndLine.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3527
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3528
	self unselectWithoutRedraw.
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3529
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3530
	"/ if the selection is not visible, we are done
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3531
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3532
	startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3533
	endLine < firstLineShown ifTrue:[^ self].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3534
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3535
	startLine < firstLineShown ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3536
	    startVisLine := 1
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3537
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3538
	    startVisLine := self listLineToVisibleLine:startLine
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3539
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3540
	endLine >= (firstLineShown + nLinesShown) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3541
	    endVisLine := nLinesShown
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3542
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3543
	    endVisLine := self listLineToVisibleLine:endLine
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3544
	].
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3545
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3546
	"/ if its only part of a line, just redraw what has to be
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3547
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3548
	(startLine == endLine) ifTrue:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3549
	    super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3550
	] ifFalse:[
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3551
	    self redrawFromVisibleLine:startVisLine to:endVisLine
516cb89919f1 moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents: 1677
diff changeset
  3552
	].
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3553
    ].
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3554
    selectStyle := nil
503
468d4a36ed67 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
  3555
715
a5856fcdbf0f fixed unselect-redraw
Claus Gittinger <cg@exept.de>
parents: 712
diff changeset
  3556
    "Modified: 29.5.1996 / 14:54:11 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3557
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3558
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3559
unselectWithoutRedraw
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3560
    "forget selection but do not redraw the selection area
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3561
     - can be done when the selected area is redrawn anyway or
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3562
     known to be invisible (however, redraw knows about that anyway)."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3563
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3564
    selectionStartLine := nil.
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3565
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3566
    "Modified: 29.4.1996 / 12:33:28 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3567
!
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3568
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3569
validateNewSelection
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3570
     "make certain that the selection is valid.
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3571
      This is a dummy here, but subclasses (like single-line editFields)
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3572
      may redefine it to limit the selection to a single line, or whatever."
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3573
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3574
    ^ self
504
36599ce06054 spaceCatching optional
Claus Gittinger <cg@exept.de>
parents: 503
diff changeset
  3575
599
aae5e752e1cf characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3576
    "Modified: 29.4.1996 / 12:32:08 / cg"
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3577
! !
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3578
844
03e45d817dce fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  3579
!TextView class methodsFor:'documentation'!
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3580
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3581
version
2600
27417bb497f3 comment
Claus Gittinger <cg@exept.de>
parents: 2596
diff changeset
  3582
    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.187 2002-09-04 19:02:27 cg Exp $'
248
c58fabf73c35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 209
diff changeset
  3583
! !
2553
9838f1097a2f allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents: 2547
diff changeset
  3584
TextView initialize!